lkml.org 
[lkml]   [2001]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] pcmcia/rsrc_mgr.c
Date
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/

\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.040 / U:23.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site