* [PATCH] mptctl.c memory leak on failure
@ 2001-01-07 3:12 Arnaldo Carvalho de Melo
2001-01-07 13:37 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-01-07 3:12 UTC (permalink / raw)
To: Steve.Ralston; +Cc: Alan Cox, linux-kernel
Hi,
Please consider applying this patch. And I got confused by the
kmalloc and the comment: the buffer is used for DMA but the kmalloc doesn't
has GFP_DMA, maybe I'm missing something here, its about time for me to
sleep 8) but if it doesn't needs DMA you should consider using vmalloc and
you'll get rid of the 32 pages limitation, like I did for wanrouter that
used kmalloc but didn't needed DMA, so I've changed it to vmalloc as per
Alan's cluebating^Wsuggestion at the time 8)
- Arnaldo
--- linux-2.4.0-ac3/drivers/message/fusion/mptctl.c Sat Jan 6 23:13:11 2001
+++ linux-2.4.0-ac3.acme/drivers/message/fusion/mptctl.c Sun Jan 7 01:02:52 2001
@@ -290,6 +290,7 @@
dma_addr_t fwbuf_dma;
FWDownloadTCSGE_t *fwVoodoo;
SGEAllUnion_t *fwSgl;
+ int ret;
dprintk((KERN_INFO "mptctl_do_fwdl called. mptctl_id = %xh.\n", mptctl_id)); //tc
@@ -309,20 +310,22 @@
}
//dprintk((KERN_INFO "DbG: fwbuf = %p\n", fwbuf));
+ ret = -EFAULT;
if (copy_from_user(fwbuf, ufwbuf, fwlen) < 0) {
printk(KERN_ERR "%s@%d::_ioctl_fwdl - "
"Unable to copy f/w buffer @ %p\n",
__FILE__, __LINE__, (void*)ufwbuf);
- return -EFAULT;
+ goto out;
}
/* Perform Firmware download.
*/
+ ret = -ENXIO; /* (-6) No such device or address */
if ((ioc = mpt_verify_adapter(ioc, &iocp)) < 0) {
printk("%s@%d::_ioctl_fwdl - ioc%d not found!\n",
__FILE__, __LINE__, ioc);
- return -ENXIO; /* (-6) No such device or address */
+ goto out;
}
mf = MptGetMsgFrame(mptctl_id, ioc);
@@ -373,8 +376,9 @@
"In ReplyMsg loop - iteration %d\n",
foo)); //tc
}
+ ret = -ETIME;
if (++foo > 60000000)
- return -ETIME;
+ goto out;
mb();
schedule();
barrier();
@@ -402,6 +406,9 @@
printk(KERN_WARNING MYNAM ": (bad VooDoo):\n");
return -ENOMSG;
}
+ return 0;
+out: kfree(fwbuf);
+ return ret;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mptctl.c memory leak on failure
2001-01-07 3:12 [PATCH] mptctl.c memory leak on failure Arnaldo Carvalho de Melo
@ 2001-01-07 13:37 ` Alan Cox
2001-01-07 16:09 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2001-01-07 13:37 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Steve.Ralston, Alan Cox, linux-kernel
> kmalloc and the comment: the buffer is used for DMA but the kmalloc doesn't
> has GFP_DMA, maybe I'm missing something here, its about time for me to
It should be kmalloc (or 2.4 wise pci_alloc_* I guess eventually). Its driven
by 32bit busmaster DMA. Its non ISA so it doesnt need GFP_DMA
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mptctl.c memory leak on failure
2001-01-07 13:37 ` Alan Cox
@ 2001-01-07 16:09 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2001-01-07 16:09 UTC (permalink / raw)
To: Alan Cox; +Cc: Steve.Ralston, linux-kernel
Em Sun, Jan 07, 2001 at 01:37:15PM +0000, Alan Cox escreveu:
> > kmalloc and the comment: the buffer is used for DMA but the kmalloc doesn't
> > has GFP_DMA, maybe I'm missing something here, its about time for me to
>
> It should be kmalloc (or 2.4 wise pci_alloc_* I guess eventually). Its driven
> by 32bit busmaster DMA. Its non ISA so it doesnt need GFP_DMA
yap, I should have have some sleep before suggesting that 8) Now back
looking at the other files, I've found another not so grave potential
memory leak, patch in some minutes
- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-01-07 17:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-07 3:12 [PATCH] mptctl.c memory leak on failure Arnaldo Carvalho de Melo
2001-01-07 13:37 ` Alan Cox
2001-01-07 16:09 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox