[PATCH] pcmcia/rsrc_mgr.c

Victor Wong (victor.wong@stanford.edu)
Mon, 14 May 2001 23:40:58 -0700


Hi,

The following is a patch to the pcmcia code in which a kmalloc failure could
cause the code to crash since the pointer is dereferenced. I've instead
allocated the fixed sized array on the stack. The patch was made against
v2.4.4 of the kernel and result from some errors found during checker runs
against the kernel source.

Victor Wong
victor.wong@stanford.edu

--- drivers/pcmcia/rsrc_mgr.c.orig Mon May 7 00:39:20 2001
+++ drivers/pcmcia/rsrc_mgr.c Mon May 7 00:40:29 2001
@@ -182,13 +182,12 @@
{

ioaddr_t i, j, bad, any;
- u_char *b, hole, most;
+ u_char b[256], hole, most;

printk(KERN_INFO "cs: IO port probe 0x%04x-0x%04x:",
base, base+num-1);

/* First, what does a floating port look like? */
- b = kmalloc(256, GFP_KERNEL);
memset(b, 0, 256);
for (i = base, most = 0; i < base+num; i += 8) {
if (check_io_resource(i, 8))
@@ -200,7 +199,6 @@
most = hole;
if (b[most] == 127) break;
}
- kfree(b);

bad = any = 0;
for (i = base; i < base+num; i += 8) {

-
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/