Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 091686d3 authored by Amit Arora's avatar Amit Arora Committed by James Bottomley
Browse files

[SCSI] Return -EINVAL when "id == max_id" in scsi_scan_host_selected()



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.

Signed-off-by: default avatarAmit Arora <aarora@in.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 93ef5887
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1503,7 +1503,7 @@ int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
		__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;