]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev/scsi_id: fix incorrect page length when get device identification VPD page
authorZhang Xianwei <zhang.xianwei8@zte.com.cn>
Mon, 13 May 2019 10:41:55 +0000 (18:41 +0800)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 22 May 2019 04:25:20 +0000 (13:25 +0900)
The length of device identification VPD page is filled with two bytes,
but scsi_id only gets the low byte. Fix it.

Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
src/udev/scsi_id/scsi_serial.c

index e1940e7d38f63d21f94c75aecad9dc5e2282f383..080b027d18a74850e54f3354d8742e52b6a71b21 100644 (file)
@@ -612,7 +612,7 @@ static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd,
                  * Examine each descriptor returned. There is normally only
                  * one or a small number of descriptors.
                  */
-                for (j = 4; j <= (unsigned)page_83[3] + 3; j += page_83[j + 3] + 4) {
+                for (j = 4; j <= ((unsigned)page_83[2] << 8) + (unsigned)page_83[3] + 3; j += page_83[j + 3] + 4) {
                         retval = check_fill_0x83_id(dev_scsi, page_83 + j,
                                                     id_search_list + id_ind,
                                                     serial, serial_short, len,