Skip to contentSkip to conversation

fix potential return of uninitialized variable in scsi_scan (resend)

PATCH In review Jesper Juhl 2 participants 3 messages Mar 18, 2006 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix potential return of uninitialized variable in scsi_scan (resend)

( The patch below was already send on March 9, 2006. )
( This is a resend, re-diff'ed against 2.6.16-rc6 )

The coverity checker found out that we potentially return sdev uninitialized. This should fix coverity #879

---

 drivers/scsi/scsi_scan.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/scsi_scan.c +3 -1
@@ -1277,7 +1277,9 @@ struct scsi_device *__scsi_add_device(st
 					     hostdata);
 		if (res != SCSI_SCAN_LUN_PRESENT)
 			sdev = ERR_PTR(-ENODEV);
-	}
+	} else 
+		sdev = ERR_PTR(-EACCES);
+
 	mutex_unlock(&shost->scan_mutex);
 	scsi_target_reap(starget);
 	put_device(&starget->dev);
#2 lore raw
Quoted 10 lines · James Bottomley
Quoted 6 lines · Jesper Juhl

( The patch below was already send on March 9, 2006. )
( This is a resend, re-diff'ed against 2.6.16-rc6 )

The coverity checker found out that we potentially return sdev uninitialized. This should fix coverity #879

The fix for this is already in scsi-misc.

Ok, I was unaware of that.
I'll try to remember to check that git tree in the future.

Thanks.

--
Jesper Juhl <[email protected]>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html