Re: [CHECKER] 32 Memory Leaks on Error Paths

From: Chris Wright
Date: Mon Sep 22 2003 - 17:58:11 EST


* David Yu Chen (dychen@xxxxxxxxxxxx) wrote:
> [FILE: 2.6.0-test5/drivers/scsi/NCR_Q720.c]
> START -->
> 153: p = kmalloc(sizeof(*p), GFP_KERNEL);
> 154: if (!p)
> 155: return -ENOMEM;
<snip>
> 180: if(i != NCR_Q720_MCA_ID) {
> 181: printk(KERN_ERR "NCR_Q720, adapter failed to I/O map registers correctly at 0x%x(0x%x)\n", io_base, i);
> END -->
> 182: return -ENODEV;

Yes, looks like a valid bug. Patch below. James, look ok?
thanks,
-chris

===== drivers/scsi/NCR_Q720.c 1.4 vs edited =====
--- 1.4/drivers/scsi/NCR_Q720.c Sun Aug 17 13:10:45 2003
+++ edited/drivers/scsi/NCR_Q720.c Mon Sep 22 15:05:02 2003
@@ -179,7 +179,7 @@
i = inb(io_base) | (inb(io_base+1)<<8);
if(i != NCR_Q720_MCA_ID) {
printk(KERN_ERR "NCR_Q720, adapter failed to I/O map registers correctly at 0x%x(0x%x)\n", io_base, i);
- return -ENODEV;
+ goto out_free;
}

/* Phase II, find the ram base and memory map the board register */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/