change kmalloc() auditing in aha1542.c
Subsystems (2)
PATCH 1/1 change kmalloc() auditing in aha1542.c
Hi,
The aha1542 driver calls panic() if kmalloc() fails, which it shouldn't do. This patch changes that by having the code return a nonzero value, so it tells the SCSI mid-layer to retry the command, as suggested by Randy.
drivers/scsi/aha1542.c +1 -1
@@ -708,7 +708,7 @@ sgpnt = (struct scatterlist *) SCpnt->request_buffer; cptr = (struct chain *) SCpnt->host_scribble;if (cptr =NULL ) -panic ("aha1542.c: unable to allocate DMA memory\n" ); +return -ENOMEM ;for (i =0 ; i < SCpnt->use_sg; i++) {if (sgpnt[i].length =0 || SCpnt->use_sg >16 || (((int ) sgpnt[i].offset) &1 ) || (sgpnt[i].length &1 )) {
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 18 lines
Hi,
The aha1542 driver calls
panic()ifkmalloc()fails, which it shouldn't do. This patch changes that by having the code return a nonzero value, so it tells the SCSI mid-layer to retry the command, as suggested by Randy.---
linux-2.6.1/drivers/scsi/aha1542.c2003-08-09 18:19:18.000000000
-0700 +++linux-2.6.1-mpi/drivers/scsi/aha1542.c2004-01-20
19:12:07.000000000 -0800 @@ -708,7 +708,7 @@drivers/scsi/aha1542.c +1
-1sgpnt = (struct scatterlist *) SCpnt->request_buffer; cptr = (struct chain *) SCpnt->host_scribble;if (cptr =NULL ) -panic ("aha1542.c: unable to allocate DMA memory\n" ); +return -ENOMEM ;for (i =0 ; i < SCpnt->use_sg; i++) {if (sgpnt[i].length =0 || SCpnt->use_sg >16 || (((int ) sgpnt[i].offset) &1 ) || (sgpnt[i].length &1 )) {
Quoted 1 line
_______________________________________________
I'll change it to return 1 since that's what is typically used for errors from queuecommand().
Thanks,
~Randy
_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors
On Tue, 20 Jan 2004 19:32:14 -0800 Timmy Yee <[email protected]> wrote:
| Hi,
|
| The aha1542 driver calls panic() if kmalloc() fails, which it shouldn't
| do. This patch changes that by having the code return a nonzero value, so
| it tells the SCSI mid-layer to retry the command, as suggested by Randy.
|
| --- linux-2.6.1/drivers/scsi/aha1542.c 2003-08-09 18:19:18.000000000 -0700
| +++ linux-2.6.1-mpi/drivers/scsi/aha1542.c 2004-01-20 19:12:07.000000000 -0800
| @@ -708,7 +708,7 @@
| sgpnt = (struct scatterlist *) SCpnt->request_buffer;
| cptr = (struct chain *) SCpnt->host_scribble;
| if (cptr = NULL)
| - panic("aha1542.c: unable to allocate DMA memory\n");
| + return -ENOMEM;
| for (i = 0; i < SCpnt->use_sg; i++) {
| if (sgpnt[i].length = 0 || SCpnt->use_sg > 16 ||
| (((int) sgpnt[i].offset) & 1) || (sgpnt[i].length & 1)) {
| _______________________________________________I think that this is OK (after changing it to return 1;). I was checking on whether the mailbox that is being used <mbo> needs to be returned (unallocated, unreserved) here or not, but I don't see a problem.. Did anyone else check this?
Thanks,
--
~Randy
kernel-janitors project: http://janitor.kernelnewbies.org/
_______________________________________________
Kernel-janitors mailing list [email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors