[PATCH] ftl.c - Null ptr fixes 2.4.4

From: Praveen Srinivasan (praveens@stanford.edu)
Date: Thu May 24 2001 - 02:29:52 EST


Hi,
Using the Stanford checker, we searched for null-pointer bugs in the linux
kernel code. This patch fixes an unchecked pointer in an MTD driver (ftl.c).

Praveen Srinivasan and Frederick Akalin

--- ../linux/./drivers/mtd/ftl.c Fri Feb 9 11:30:23 2001
+++ ./drivers/mtd/ftl.c Mon May 7 22:01:29 2001
@@ -375,6 +375,11 @@
     /* Set up virtual page map */
     blocks = le32_to_cpu(header.FormattedSize) >> header.BlockSize;
     part->VirtualBlockMap = vmalloc(blocks * sizeof(u_int32_t));
+
+ if(part->VirtualBlockMap==NULL) {
+ 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/



This archive was generated by hypermail 2b29 : Thu May 31 2001 - 21:00:14 EST