[PATCH] vmalloc NULL Check Bug Fix

Philip Wang (PXWang@stanford.edu)
Sun, 13 May 2001 01:07:03 -0700


Hello!

I'm Philip, from Professor Dawson Engler's Meta-Compilation Group at
Stanford University.

This simple and obvious bug fix makes sure that vmalloc() does not return
NULL. My addition of returning -1 is consistent with how the rest of the
code deals with allocation failures.

Warmly,

Philip

---drivers/mtd/ftl.c Fri Feb 9
11:30:23 2001
+++ ftl.c Sun May 13 00:25:26 2001
@@ -375,6 +375,8 @@
/* Set up virtual page map */
blocks = le32_to_cpu(header.FormattedSize) >> header.BlockSize;
part->VirtualBlockMap = vmalloc(blocks * sizeof(u_int32_t));
+ if(!part->VirtualBlockMap) return -1;
+
memset(part->VirtualBlockMap, 0xff, blocks * sizeof(u_int32_t));
part->BlocksPerUnit = (1 << header.EraseUnitSize) >> header.BlockSize;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/