From: Bart Van Assche Date: Fri, 15 May 2026 20:52:20 +0000 (-0700) Subject: scsi: core: Use the INQUIRY-related constants X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28ff38b9d8e1a189606e36319401dc98419a3746;p=thirdparty%2Flinux.git scsi: core: Use the INQUIRY-related constants Use symbolic names instead of numeric constants to access the vendor and model information. Signed-off-by: Bart Van Assche Tested-by: Brian Bunker Link: https://patch.msgid.link/20260515205222.1754621-3-bvanassche@acm.org Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index a35a5f777d16..b0473f4595c1 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -728,9 +728,13 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, } if (result == 0) { - scsi_sanitize_inquiry_string(&inq_result[8], 8); - scsi_sanitize_inquiry_string(&inq_result[16], 16); - scsi_sanitize_inquiry_string(&inq_result[32], 4); + scsi_sanitize_inquiry_string(&inq_result[INQUIRY_VENDOR_OFFSET], + INQUIRY_VENDOR_LEN); + scsi_sanitize_inquiry_string(&inq_result[INQUIRY_MODEL_OFFSET], + INQUIRY_MODEL_LEN); + scsi_sanitize_inquiry_string( + &inq_result[INQUIRY_REVISION_OFFSET], + INQUIRY_REVISION_LEN); response_len = inq_result[4] + 5; if (response_len > 255) @@ -743,8 +747,9 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, * corresponding bit fields in scsi_device, so bflags * need not be passed as an argument. */ - *bflags = scsi_get_device_flags(sdev, &inq_result[8], - &inq_result[16]); + *bflags = scsi_get_device_flags(sdev, + &inq_result[INQUIRY_VENDOR_OFFSET], + &inq_result[INQUIRY_MODEL_OFFSET]); /* When the first pass succeeds we gain information about * what larger transfer lengths might work. */