Skip to content

Commit

Permalink
scsi: remove superfluous NULL pointer check from scsi_kill_request()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Bartlomiej Zolnierkiewicz authored and Linus Torvalds committed Aug 11, 2010
1 parent 85bc081 commit d6e9fb4
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1370,12 +1370,6 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)

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;
Expand Down

0 comments on commit d6e9fb4

Please sign in to comment.