linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 15/26] scsi: remove superfluous NULL pointer check from scsi_kill_request()
@ 2010-05-24 19:22 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2010-05-24 19:22 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
@@ -1372,12 +1372,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] only message in thread

only message in thread, other threads:[~2010-05-24 19:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-24 19:22 [patch 15/26] scsi: remove superfluous NULL pointer check from scsi_kill_request() akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).