mtd/drivers/mtd/chips gen_probe.c,1.14,1.15
gleixner at infradead.org
gleixner at infradead.org
Thu Jun 24 14:10:42 EDT 2004
Update of /home/cvs/mtd/drivers/mtd/chips
In directory phoenix.infradead.org:/tmp/cvs-serv15090
Modified Files:
gen_probe.c
Log Message:
zero chip_map memory before using it. Pointed out by Robert Schwebel <rschwebel at pengutronix dot de>
Index: gen_probe.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/chips/gen_probe.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- gen_probe.c 8 Nov 2003 00:51:21 -0000 1.14
+++ gen_probe.c 24 Jun 2004 18:10:39 -0000 1.15
@@ -56,7 +56,7 @@
struct cfi_private cfi;
struct cfi_private *retcfi;
unsigned long *chip_map;
- int i, j;
+ int i, j, mapsize;
int max_chips;
memset(&cfi, 0, sizeof(cfi));
@@ -108,12 +108,14 @@
* Align bitmap storage size to full byte.
*/
max_chips = map->size >> cfi.chipshift;
- chip_map = kmalloc((max_chips / 8) + ((max_chips % 8) ? 1 : 0), GFP_KERNEL);
+ mapsize = (max_chips / 8) + ((max_chips % 8) ? 1 : 0);
+ chip_map = kmalloc(mapsize, GFP_KERNEL);
if (!chip_map) {
printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name);
kfree(cfi.cfiq);
return NULL;
}
+ memset (chip_map, 0, mapsize);
set_bit(0, chip_map); /* Mark first chip valid */
More information about the linux-mtd-cvs
mailing list