diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 5f963df0906a8f36eff640ebf4bc9a4e12837462..b7ac1457141577223b19fa4082bda5c2d9ff82fc 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -3065,12 +3065,13 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) } memset(id, 0, id_len); - d = vpd_pg83->data + 4; - while (d < vpd_pg83->data + vpd_pg83->len) { + for (d = vpd_pg83->data + 4; + d < vpd_pg83->data + vpd_pg83->len; + d += d[3] + 4) { u8 prio = designator_prio(d); if (prio == 0 || cur_id_prio > prio) - goto next_desig; + continue; switch (d[1] & 0xf) { case 0x1: @@ -3150,8 +3151,6 @@ int scsi_vpd_lun_id(struct scsi_device *sdev, char *id, size_t id_len) default: break; } -next_desig: - d += d[3] + 4; } rcu_read_unlock();