Skip to content

Commit 16d3ea2

Browse files
martinkpetersenJames Bottomley
authored andcommitted
[SCSI] Fix VPD inquiry page wrapper
Fix two bugs in the VPD page wrapper: - Don't return failure if the user asked for page 0 - The end of buffer check failed to account for the page header size and consequently didn't work Signed-off-by: Martin K. Petersen <[email protected]> Cc: Stable Tree <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent 9c03f16 commit 16d3ea2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/scsi/scsi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,13 +1046,13 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
10461046

10471047
/* If the user actually wanted this page, we can skip the rest */
10481048
if (page == 0)
1049-
return -EINVAL;
1049+
return 0;
10501050

10511051
for (i = 0; i < min((int)buf[3], buf_len - 4); i++)
10521052
if (buf[i + 4] == page)
10531053
goto found;
10541054

1055-
if (i < buf[3] && i > buf_len)
1055+
if (i < buf[3] && i >= buf_len - 4)
10561056
/* ran off the end of the buffer, give us benefit of doubt */
10571057
goto found;
10581058
/* The device claims it doesn't support the requested page */

0 commit comments

Comments
 (0)