richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
4bff0a
From 7b3ef169e3142fb471c48f265881b371380d77e0 Mon Sep 17 00:00:00 2001
4bff0a
From: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
4bff0a
Date: Mon, 13 May 2019 18:41:55 +0800
4bff0a
Subject: [PATCH] udev/scsi_id: fix incorrect page length when get device
4bff0a
 identification VPD page
4bff0a
4bff0a
The length of device identification VPD page is filled with two bytes,
4bff0a
but scsi_id only gets the low byte. Fix it.
4bff0a
4bff0a
Signed-off-by: Zhang Xianwei <zhang.xianwei8@zte.com.cn>
4bff0a
(cherry picked from commit 1f7b6872dbe8ccae1f3bda9aa6aeb87c9b42e01e)
4bff0a
4bff0a
Resolves: #1713227
4bff0a
---
4bff0a
 src/udev/scsi_id/scsi_serial.c | 2 +-
4bff0a
 1 file changed, 1 insertion(+), 1 deletion(-)
4bff0a
4bff0a
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
4bff0a
index fd91657a32..fb6055395d 100644
4bff0a
--- a/src/udev/scsi_id/scsi_serial.c
4bff0a
+++ b/src/udev/scsi_id/scsi_serial.c
4bff0a
@@ -661,7 +661,7 @@ static int do_scsi_page83_inquiry(struct udev *udev,
4bff0a
                  * Examine each descriptor returned. There is normally only
4bff0a
                  * one or a small number of descriptors.
4bff0a
                  */
4bff0a
-                for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) {
4bff0a
+                for (j = 4; j <= ((unsigned)page_83[2] << 8) + (unsigned)page_83[3] + 3; j += page_83[j + 3] + 4) {
4bff0a
                         retval = check_fill_0x83_id(udev,
4bff0a
                                                     dev_scsi, &page_83[j],
4bff0a
                                                     &id_search_list[id_ind],