Skip to content

Commit 587c3c9

Browse files
bwh-ctmartinkpetersen
authored andcommitted
scsi: sg: Re-fix off by one in sg_fill_request_table()
Commit 109bade ("scsi: sg: use standard lists for sg_requests") introduced an off-by-one error in sg_ioctl(), which was fixed by commit bd46fc4 ("scsi: sg: off by one in sg_ioctl()"). Unfortunately commit 4759df9 ("scsi: sg: factor out sg_fill_request_table()") moved that code, and reintroduced the bug (perhaps due to a botched rebase). Fix it again. Fixes: 4759df9 ("scsi: sg: factor out sg_fill_request_table()") Cc: [email protected] Signed-off-by: Ben Hutchings <[email protected]> Acked-by: Douglas Gilbert <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 45348de commit 587c3c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/sg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ sg_fill_request_table(Sg_fd *sfp, sg_req_info_t *rinfo)
837837

838838
val = 0;
839839
list_for_each_entry(srp, &sfp->rq_list, entry) {
840-
if (val > SG_MAX_QUEUE)
840+
if (val >= SG_MAX_QUEUE)
841841
break;
842842
rinfo[val].req_state = srp->done + 1;
843843
rinfo[val].problem =

0 commit comments

Comments
 (0)