All of lore.kernel.org
 help / color / mirror / Atom feed
* [Kernel-janitors] [PATCH] change kmalloc() auditing in aha1542.c
@ 2004-01-21  3:32 Timmy Yee
  2004-01-21  4:28 ` rddunlap
  2004-01-21 19:49 ` Randy.Dunlap
  0 siblings, 2 replies; 3+ messages in thread
From: Timmy Yee @ 2004-01-21  3:32 UTC (permalink / raw)
  To: kernel-janitors

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)) {
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Kernel-janitors] [PATCH] change kmalloc() auditing in aha1542.c
  2004-01-21  3:32 [Kernel-janitors] [PATCH] change kmalloc() auditing in aha1542.c Timmy Yee
@ 2004-01-21  4:28 ` rddunlap
  2004-01-21 19:49 ` Randy.Dunlap
  1 sibling, 0 replies; 3+ messages in thread
From: rddunlap @ 2004-01-21  4:28 UTC (permalink / raw)
  To: kernel-janitors

> 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'll change it to return 1 since that's what is typically used for
errors from queuecommand().

Thanks,
~Randy



_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Kernel-janitors] [PATCH] change kmalloc() auditing in aha1542.c
  2004-01-21  3:32 [Kernel-janitors] [PATCH] change kmalloc() auditing in aha1542.c Timmy Yee
  2004-01-21  4:28 ` rddunlap
@ 2004-01-21 19:49 ` Randy.Dunlap
  1 sibling, 0 replies; 3+ messages in thread
From: Randy.Dunlap @ 2004-01-21 19:49 UTC (permalink / raw)
  To: kernel-janitors

On Tue, 20 Jan 2004 19:32:14 -0800 Timmy Yee <shoujun@masterofpi.org> 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
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-21 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-21  3:32 [Kernel-janitors] [PATCH] change kmalloc() auditing in aha1542.c Timmy Yee
2004-01-21  4:28 ` rddunlap
2004-01-21 19:49 ` Randy.Dunlap

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.