public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 13/27] scsi: remove superfluous NULL pointer check from scsi_kill_request()
@ 2010-07-20 22:28 akpm
  2010-07-21 11:07 ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2010-07-20 22:28 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, akpm, bzolnier, corbet, error27, eteo

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Dan's list included:

drivers/scsi/scsi_lib.c +1365 scsi_kill_request(9) warning: variable derefenced in initializer 'cmd'
drivers/scsi/scsi_lib.c +1365 scsi_kill_request(9) warning: variable derefenced before check 'cmd'

We dereference cmd (and possible OOPS if cmd == NULL) before starting the
request so just remove the superfluous debugging code altogether.

[ bart: the potential NULL pointer dereference was finally fixed in
  (much later than mine) commit 03b1470 but my patch is still valid ]

Reported-by: Dan Carpenter <error27@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Eugene Teo <eteo@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/scsi/scsi_lib.c |    6 ------
 1 file changed, 6 deletions(-)

diff -puN drivers/scsi/scsi_lib.c~scsi-remove-superfluous-null-pointer-check-from-scsi_kill_request drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c~scsi-remove-superfluous-null-pointer-check-from-scsi_kill_request
+++ a/drivers/scsi/scsi_lib.c
@@ -1370,12 +1370,6 @@ static void scsi_kill_request(struct req
 
 	blk_start_request(req);
 
-	if (unlikely(cmd == NULL)) {
-		printk(KERN_CRIT "impossible request in %s.\n",
-				 __func__);
-		BUG();
-	}
-
 	sdev = cmd->device;
 	starget = scsi_target(sdev);
 	shost = sdev->host;
_

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

* Re: [patch 13/27] scsi: remove superfluous NULL pointer check from scsi_kill_request()
  2010-07-20 22:28 [patch 13/27] scsi: remove superfluous NULL pointer check from scsi_kill_request() akpm
@ 2010-07-21 11:07 ` Bartlomiej Zolnierkiewicz
  2010-07-21 17:21   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2010-07-21 11:07 UTC (permalink / raw)
  To: akpm; +Cc: James.Bottomley, linux-scsi, corbet, error27, eteo


Hi,

This one may be dropped as after almost a year of trying to get it
merged [1] it seems that an added complexity of the patch is not worth
the potential gains (although I can't tell for sure since feedback has
been always 'minimal').

[1] http://lkml.indiana.edu/hypermail/linux/kernel/0907.3/00416.html

Thanks.

On Wednesday 21 July 2010 12:28:53 am akpm@linux-foundation.org wrote:
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> 
> Dan's list included:
> 
> drivers/scsi/scsi_lib.c +1365 scsi_kill_request(9) warning: variable derefenced in initializer 'cmd'
> drivers/scsi/scsi_lib.c +1365 scsi_kill_request(9) warning: variable derefenced before check 'cmd'
> 
> We dereference cmd (and possible OOPS if cmd == NULL) before starting the
> request so just remove the superfluous debugging code altogether.
> 
> [ bart: the potential NULL pointer dereference was finally fixed in
>   (much later than mine) commit 03b1470 but my patch is still valid ]
> 
> Reported-by: Dan Carpenter <error27@gmail.com>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Eugene Teo <eteo@redhat.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  drivers/scsi/scsi_lib.c |    6 ------
>  1 file changed, 6 deletions(-)
> 
> diff -puN drivers/scsi/scsi_lib.c~scsi-remove-superfluous-null-pointer-check-from-scsi_kill_request drivers/scsi/scsi_lib.c
> --- a/drivers/scsi/scsi_lib.c~scsi-remove-superfluous-null-pointer-check-from-scsi_kill_request
> +++ a/drivers/scsi/scsi_lib.c
> @@ -1370,12 +1370,6 @@ static void scsi_kill_request(struct req
>  
>  	blk_start_request(req);
>  
> -	if (unlikely(cmd == NULL)) {
> -		printk(KERN_CRIT "impossible request in %s.\n",
> -				 __func__);
> -		BUG();
> -	}
> -
>  	sdev = cmd->device;
>  	starget = scsi_target(sdev);
>  	shost = sdev->host;
> _

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

* Re: [patch 13/27] scsi: remove superfluous NULL pointer check from scsi_kill_request()
  2010-07-21 11:07 ` Bartlomiej Zolnierkiewicz
@ 2010-07-21 17:21   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2010-07-21 17:21 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: James.Bottomley, linux-scsi, corbet, error27, eteo

On Wed, 21 Jul 2010 13:07:15 +0200 Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:

> This one may be dropped as after almost a year of trying to get it
> merged [1] it seems that an added complexity of the patch is not worth
> the potential gains (although I can't tell for sure since feedback has
> been always 'minimal').

There's nothing wrong with the patch - the problem lies elsewhere.

For 2.6.36-rc1 I'll re-review these scsi patches and will directly
merge those which still look good to me.

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

end of thread, other threads:[~2010-07-21 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20 22:28 [patch 13/27] scsi: remove superfluous NULL pointer check from scsi_kill_request() akpm
2010-07-21 11:07 ` Bartlomiej Zolnierkiewicz
2010-07-21 17:21   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox