[PATCH] bulkmem.c - null ptr fixes for 2.4.4

Praveen Srinivasan (praveens@stanford.edu)
Thu, 24 May 2001 00:24:21 -0700


Hi,
Using the Stanford checker, we searched for null-pointer bugs in the linux
kernel code. This patch fixes numerous unchecked pointers in the PCMCIA
bulkmem driver.

Praveen Srinivasan and Frederick Akalin

--- ../linux/./drivers/pcmcia/bulkmem.c Tue Mar 6 19:28:32 2001
+++ ./drivers/pcmcia/bulkmem.c Mon May 7 21:53:49 2001
@@ -229,6 +229,10 @@
else {
erase->State = 1;
busy = kmalloc(sizeof(erase_busy_t), GFP_KERNEL);
+
+ if(busy == NULL) {
+ return;
+ }
busy->erase = erase;
busy->client = handle;
init_timer(&busy->timeout);
@@ -360,6 +364,10 @@
if ((device.dev[i].type != CISTPL_DTYPE_NULL) &&
(device.dev[i].size != 0)) {
r = kmalloc(sizeof(*r), GFP_KERNEL);
+ if(r == NULL) {
+ return;
+ }
+
r->region_magic = REGION_MAGIC;
r->state = 0;
r->dev_info[0] = '\0';
-
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/