public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: Return -EINVAL when "id == max_id" in scsi_scan_host_selected()
@ 2006-05-19 23:14 Amit Arora
  2006-05-20  4:21 ` Matthew Wilcox
  0 siblings, 1 reply; 11+ messages in thread
From: Amit Arora @ 2006-05-19 23:14 UTC (permalink / raw)
  To: linux-scsi; +Cc: patmans

The scsi_scan_host_selected() should return -EINVAL when the id is equal
to the max_id. Currently it uses ">" when comparing with max_id, and
hence leaves the border case when "id==max_id".
The channel and lun have values valid from 0 up to,
and including, max_channel or max_lun. But, the valid values for id
range from 0 to max_id-1. This patch fixes the problem.

Regards,
Amit Arora

Signed-off-by: Amit Arora <aarora@in.ibm.com>
---
diff -Nuarp linux-2.6.17-rc4.orig/drivers/scsi/scsi_scan.c
linux-2.6.17-rc4/drivers/scsi/scsi_scan.c
--- linux-2.6.17-rc4.orig/drivers/scsi/scsi_scan.c      2006-05-18
20:25:32.000000000 -0600
+++ linux-2.6.17-rc4/drivers/scsi/scsi_scan.c   2006-05-18
20:28:09.000000000 -0600
@@ -1473,7 +1473,7 @@ int scsi_scan_host_selected(struct Scsi_
                __FUNCTION__, channel, id, lun));
  
        if (((channel != SCAN_WILD_CARD) && (channel >
shost->max_channel)) ||
-           ((id != SCAN_WILD_CARD) && (id > shost->max_id)) ||
+           ((id != SCAN_WILD_CARD) && (id >= shost->max_id)) ||
            ((lun != SCAN_WILD_CARD) && (lun > shost->max_lun)))
                return -EINVAL;






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

end of thread, other threads:[~2006-05-26 23:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-19 23:14 [PATCH] scsi: Return -EINVAL when "id == max_id" in scsi_scan_host_selected() Amit Arora
2006-05-20  4:21 ` Matthew Wilcox
2006-05-20 19:41   ` Amit Arora
2006-05-21  3:34     ` Luben Tuikov
2006-05-21  4:05       ` Matthew Wilcox
2006-05-22 19:01       ` Amit Arora
2006-05-23  0:54     ` James Bottomley
2006-05-23  1:16       ` Matthew Wilcox
2006-05-23  7:47         ` Hannes Reinecke
2006-05-23  8:29           ` Hannes Reinecke
2006-05-26 23:50         ` Luben Tuikov

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