From nobody Wed Jul 1 04:19:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E582C433F5 for ; Sun, 2 Jan 2022 23:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231178AbiABXc7 (ORCPT ); Sun, 2 Jan 2022 18:32:59 -0500 Received: from angie.orcam.me.uk ([78.133.224.34]:38422 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbiABXcz (ORCPT ); Sun, 2 Jan 2022 18:32:55 -0500 X-Greylist: delayed 555 seconds by postgrey-1.27 at vger.kernel.org; Sun, 02 Jan 2022 18:32:55 EST Received: by angie.orcam.me.uk (Postfix, from userid 500) id F3B4C92009D; Mon, 3 Jan 2022 00:23:45 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id EC96192009B; Sun, 2 Jan 2022 23:23:45 +0000 (GMT) Date: Sun, 2 Jan 2022 23:23:45 +0000 (GMT) From: "Maciej W. Rozycki" To: Khalid Aziz , "James E.J. Bottomley" , "Martin K. Petersen" cc: Christoph Hellwig , Nix , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] scsi: Provide for avoiding trailing allocation length with VPD inquiries In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Allow SCSI hosts to request avoiding trailing allocation length with VPD=20 inquiries, and use the mechanism to work around an issue with at least=20 some BusLogic MultiMaster host bus adapters and observed with the BT-958=20 model specifically where issuing commands that return less data than=20 provided for causes fatal failures: scsi host0: BusLogic BT-958 scsi 0:0:0:0: Direct-Access IBM DDYS-T18350M SA5A PQ: 0 ANSI: 3 scsi 0:0:1:0: Direct-Access SEAGATE ST336607LW 0006 PQ: 0 ANSI: 3 scsi 0:0:5:0: Direct-Access IOMEGA ZIP 100 E.08 PQ: 0 ANSI: 2 sd 0:0:1:0: [sdb] 71687372 512-byte logical blocks: (36.7 GB/34.2 GiB) sd 0:0:0:0: [sda] 35843670 512-byte logical blocks: (18.4 GB/17.1 GiB) sd 0:0:1:0: [sdb] Write Protect is off sd 0:0:5:0: [sdc] Attached SCSI removable disk sd 0:0:0:0: [sda] Write Protect is off sd 0:0:1:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO a= nd FUA sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't suppor= t DPO or FUA scsi0: *** BusLogic BT-958 Initialized Successfully *** scsi0: *** BusLogic BT-958 Initialized Successfully *** scsi0: *** BusLogic BT-958 Initialized Successfully *** scsi0: *** BusLogic BT-958 Initialized Successfully *** sd 0:0:0:0: Device offlined - not ready after error recovery sd 0:0:1:0: Device offlined - not ready after error recovery sd 0:0:0:0: scsi_vpd_inquiry(0): buf[64] =3D> -5 sd 0:0:1:0: scsi_vpd_inquiry(0): buf[64] =3D> -5 sd 0:0:0:0: [sda] Attached SCSI disk sd 0:0:1:0: [sdb] Attached SCSI disk VFS: Cannot open root device "802" or unknown-block(8,2): error -6 (here and elsewhere reported with some instrumentation added so as to=20 show the causing requests and with irrelevant messages filtered out). As already observed back in 2003 and worked around in smartmontools at=20 least some versions of BusLogic firmware such as 5.07B are unable to=20 handle such commands, but it is possible to request enough data first=20 for the length of the data response to be determined and then reissue=20 the same command with the allocation length matching the response=20 expected. It is what this change does on a host-by-host basis, by providing a flag=20 for individual HBA drivers to enable this workaround, currently set by=20 the BusLogic driver, and then issuing these double calls as requested,=20 which then produce results as expected: sd 0:0:1:0: [sdb] Write cache: enabled, read cache: enabled, supports DPO a= nd FUA sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't suppor= t DPO or FUA sd 0:0:1:0: scsi_vpd_inquiry(0): buf[64] =3D> 13 sd 0:0:0:0: scsi_vpd_inquiry(0): buf[64] =3D> 7 sdb: sdb1 sdb2 sd 0:0:1:0: scsi_vpd_inquiry(0): buf[64] =3D> 13 sd 0:0:1:0: [sdb] Attached SCSI disk sda: sda1 sda2 sda3 sda4 < sda5 sda6 sda7 sda8 sda9 sda10 > sd 0:0:0:0: scsi_vpd_inquiry(0): buf[64] =3D> 7 sd 0:0:0:0: [sda] Attached SCSI disk EXT4-fs (sda2): mounting ext2 file system using the ext4 subsystem EXT4-fs (sda2): mounted filesystem without journal. Opts: (null). Quota mod= e: disabled. VFS: Mounted root (ext2 filesystem) readonly on device 8:2. The minimum request size of 4 for the repeated call has been chosen to=20 match one required for a successful return from `scsi_vpd_inquiry'. Interestingly enough it has only started triggering with not so recent=20 commit af73623f5f10 ("[SCSI] sd: Reduce buffer size for vpd request")=20 that decreased the allocation length for the originating request from=20 512 down to 64. Previously the request was rejected outright by the=20 respective targets as invalid and therefore did not trigger the issue=20 with MultiMaster firmware as that would only happen for a command that=20 succeeded but produced less data than provided for: scsi0: CCB #36 Target 0: Result 2 Host Adapter Status 00 Target Status 02 scsi0: CDB 12 01 00 02 00 00 scsi0: Sense 70 00 05 00 00 00 00 18 00 00 00 00 24 00 00 C0 00 03 00 [...] sd 0:0:0:0: scsi_vpd_inquiry(0): buf[512] =3D> -5 scsi0: CCB #37 Target 1: Result 2 Host Adapter Status 00 Target Status 02 scsi0: CDB 12 01 00 02 00 00 scsi0: Sense 70 00 05 00 00 00 00 0A 00 00 00 00 24 00 01 C9 00 03 00 [...] sd 0:0:1:0: scsi_vpd_inquiry(0): buf[512] =3D> -5 (here with the buffer size set back to 512, the `BusLogic=3DTraceErrors'=20 parameter and trailing sense data zeros trimmed for brevity). Note the=20 sense key of 0x5 returned denoting an illegal request even for page 0. Signed-off-by: Maciej W. Rozycki Fixes: 881a256d84e6 ("[SCSI] Add VPD helper") Cc: stable@vger.kernel.org # v2.6.30+ --- No changes from v2. No changes from v1. --- drivers/scsi/BusLogic.c | 1 + drivers/scsi/scsi.c | 24 +++++++++++++++++++++--- include/scsi/scsi_host.h | 3 +++ 3 files changed, 25 insertions(+), 3 deletions(-) linux-buslogic-get-vpd-page-buffer.diff Index: linux-macro/drivers/scsi/BusLogic.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/drivers/scsi/BusLogic.c +++ linux-macro/drivers/scsi/BusLogic.c @@ -2149,6 +2149,7 @@ static void __init blogic_inithoststruct host->can_queue =3D adapter->drvr_qdepth; host->sg_tablesize =3D adapter->drvr_sglimit; host->cmd_per_lun =3D adapter->untag_qdepth; + host->no_trailing_allocation_length =3D true; } =20 /* Index: linux-macro/drivers/scsi/scsi.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/drivers/scsi/scsi.c +++ linux-macro/drivers/scsi/scsi.c @@ -344,8 +344,19 @@ int scsi_get_vpd_page(struct scsi_device if (sdev->skip_vpd_pages) goto fail; =20 - /* Ask for all the pages supported by this device */ - result =3D scsi_vpd_inquiry(sdev, buf, 0, buf_len); + /* + * Ask for all the pages supported by this device. Determine the + * actual data length first if so required by the host, e.g. + * BusLogic BT-958. + */ + if (sdev->host->no_trailing_allocation_length) { + result =3D scsi_vpd_inquiry(sdev, buf, 0, min(4, buf_len)); + if (result < 4) + goto fail; + } else { + result =3D buf_len; + } + result =3D scsi_vpd_inquiry(sdev, buf, 0, min(result, buf_len)); if (result < 4) goto fail; =20 @@ -364,7 +375,14 @@ int scsi_get_vpd_page(struct scsi_device goto fail; =20 found: - result =3D scsi_vpd_inquiry(sdev, buf, page, buf_len); + if (sdev->host->no_trailing_allocation_length) { + result =3D scsi_vpd_inquiry(sdev, buf, page, min(4, buf_len)); + if (result < 4) + goto fail; + } else { + result =3D buf_len; + } + result =3D scsi_vpd_inquiry(sdev, buf, page, min(result, buf_len)); if (result < 0) goto fail; =20 Index: linux-macro/include/scsi/scsi_host.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/include/scsi/scsi_host.h +++ linux-macro/include/scsi/scsi_host.h @@ -659,6 +659,9 @@ struct Scsi_Host { /* The transport requires the LUN bits NOT to be stored in CDB[1] */ unsigned no_scsi2_lun_in_cdb:1; =20 + /* Allocation length must not exceed actual data length. */ + unsigned no_trailing_allocation_length:1; + /* * Optional work queue to be utilized by the transport */ From nobody Wed Jul 1 04:19:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63B72C433EF for ; Sun, 2 Jan 2022 23:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbiABXdF (ORCPT ); Sun, 2 Jan 2022 18:33:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231140AbiABXcz (ORCPT ); Sun, 2 Jan 2022 18:32:55 -0500 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7EA04C061761; Sun, 2 Jan 2022 15:32:54 -0800 (PST) Received: by angie.orcam.me.uk (Postfix, from userid 500) id F3BE192009E; Mon, 3 Jan 2022 00:23:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id ECFF792009B; Sun, 2 Jan 2022 23:23:51 +0000 (GMT) Date: Sun, 2 Jan 2022 23:23:51 +0000 (GMT) From: "Maciej W. Rozycki" To: Khalid Aziz , "James E.J. Bottomley" , "Martin K. Petersen" cc: Christoph Hellwig , Nix , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] scsi: Avoid using reserved length byte with VPD inquiries In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As discussed in a previous workaround for a BusLogic BT-958 problem with=20 VPD inquiries with an allocation length of 512 bytes as requested before=20 commit af73623f5f10 ("[SCSI] sd: Reduce buffer size for vpd request")=20 are rejected outright as invalid at least by some SCSI target devices as=20 are any requests with a non-zero value in byte #3: scsi host0: BusLogic BT-958 scsi 0:0:0:0: Direct-Access IBM DDYS-T18350M SA5A PQ: 0 ANSI: 3 scsi 0:0:1:0: Direct-Access SEAGATE ST336607LW 0006 PQ: 0 ANSI: 3 scsi 0:0:5:0: Direct-Access IOMEGA ZIP 100 E.08 PQ: 0 ANSI: 2 [...] scsi0: CCB #36 Target 0: Result 2 Host Adapter Status 00 Target Status 02 scsi0: CDB 12 01 00 01 06 00 scsi0: Sense 70 00 05 00 00 00 00 18 00 00 00 00 24 00 00 C0 00 03 00 [...] sd 0:0:0:0: scsi_vpd_inquiry(0): buf[262] =3D> -5 scsi0: CCB #37 Target 1: Result 2 Host Adapter Status 00 Target Status 02 scsi0: CDB 12 01 00 01 06 00 scsi0: Sense 70 00 05 00 00 00 00 0A 00 00 00 00 24 00 01 C8 00 03 00 [...] sd 0:0:1:0: scsi_vpd_inquiry(0): buf[262] =3D> -5 (here with the buffer size tweaked to 262 so as to verify if a bit in=20 byte #3 of the INQUIRY command is ignored and the length of 6 assumed or=20 tripped over, the `BusLogic=3DTraceErrors' parameter and trailing sense=20 data zeros trimmed for brevity). Note the sense key of 0x5 denoting an=20 illegal request. For the record with the buffer size of 6 requests for page 0 complete=20 successfully and due to page truncation `scsi_get_vpd_page' proceeds=20 with an attempt to get inexistent page 0x89: sd 0:0:0:0: scsi_vpd_inquiry(0): buf[6] =3D> 7 sd 0:0:1:0: scsi_vpd_inquiry(0): buf[6] =3D> 13 sd 0:0:0:0: scsi_vpd_inquiry(137): buf[6] =3D> -5 sd 0:0:1:0: scsi_vpd_inquiry(137): buf[6] =3D> -5 Upon a further investigation it has turned out at least SCSI-2 considers=20 byte #3 of the INQUIRY command[1] as well as byte #2 of vital product=20 data pages[2] reserved and expects a value of zero there. The response=20 from SCSI-3 devices shown above indicates the same expectation. Therefore it is unsafe to issue INQUIRY requests unconditionally with=20 the allocation length beyond 255, as they may fail with an otherwise=20 supported request or cause undefined behaviour with some hardware. Now we actually never do that as all our callers of `scsi_get_vpd_page'=20 either hardcode the buffer size to a value between 8 and 255 or=20 calculate it from a structure size, of which the largest is: struct c2_inquiry { u8 peripheral_info; /* 0 1 */ u8 page_code; /* 1 1 */ u8 reserved1; /* 2 1 */ u8 page_len; /* 3 1 */ u8 page_id[4]; /* 4 4 */ u8 sw_version[3]; /* 8 3 */ u8 sw_date[3]; /* 11 3 */ u8 features_enabled; /* 14 1 */ u8 max_lun_supported; /* 15 1 */ u8 partitions[239]; /* 16 239 */ /* size: 255, cachelines: 2, members: 10 */ /* last cacheline: 127 bytes */ }; As from commit b3ae8780b429 ("[SCSI] Add EVPD page 0x83 and 0x80 to sysfs") we now also have the SCSI_VPD_PG_LEN macro that reflects the limitation. However for the sake of a possible future requirement to support VPD=20 pages that do have a length exceeding 255 bytes and now that the danger=20 of using the formerly reserved byte #3 of the INQUIRY command has been=20 identified execute calls to `scsi_get_vpd_page' with a request size=20 exceeding 255 bytes in two stages, by determining the actual length of=20 data to be returned first and only then issuing the intended request for=20 full data. References: [1] "Information technology - Small Computer System Interface - 2",=20 WORKING DRAFT, X3T9.2, Project 375D, Revision 10L, 7-SEP-93, Section=20 8.2.5 "INQUIRY command", pp.104-108 [2] same, Section 8.3.4 "Vital product data parameters", pp.154-159 Signed-off-by: Maciej W. Rozycki Fixes: 881a256d84e6 ("[SCSI] Add VPD helper") --- No changes from v2. No changes from v1. --- drivers/scsi/scsi.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) linux-scsi-vpd-inquiry-buffer.diff Index: linux-macro/drivers/scsi/scsi.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/drivers/scsi/scsi.c +++ linux-macro/drivers/scsi/scsi.c @@ -346,10 +346,15 @@ int scsi_get_vpd_page(struct scsi_device =20 /* * Ask for all the pages supported by this device. Determine the - * actual data length first if so required by the host, e.g. - * BusLogic BT-958. + * actual data length first if the length requested is beyond 255 + * bytes as the high order length byte used to be reserved with + * older SCSI standard revisions and a non-zero value there may + * cause either such an INQUIRY command to be rejected by a target + * or undefined behaviour to occur. Also do so if so required by + * the host, e.g. BusLogic BT-958. */ - if (sdev->host->no_trailing_allocation_length) { + if (buf_len > SCSI_VPD_PG_LEN || + sdev->host->no_trailing_allocation_length) { result =3D scsi_vpd_inquiry(sdev, buf, 0, min(4, buf_len)); if (result < 4) goto fail; @@ -375,7 +380,8 @@ int scsi_get_vpd_page(struct scsi_device goto fail; =20 found: - if (sdev->host->no_trailing_allocation_length) { + if (buf_len > SCSI_VPD_PG_LEN || + sdev->host->no_trailing_allocation_length) { result =3D scsi_vpd_inquiry(sdev, buf, page, min(4, buf_len)); if (result < 4) goto fail; From nobody Wed Jul 1 04:19:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EDBDC433F5 for ; Sun, 2 Jan 2022 23:33:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231182AbiABXdD (ORCPT ); Sun, 2 Jan 2022 18:33:03 -0500 Received: from angie.orcam.me.uk ([78.133.224.34]:38430 "EHLO angie.orcam.me.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbiABXcz (ORCPT ); Sun, 2 Jan 2022 18:32:55 -0500 Received: by angie.orcam.me.uk (Postfix, from userid 500) id 6D8829200B3; Mon, 3 Jan 2022 00:23:57 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 69AB092009B; Sun, 2 Jan 2022 23:23:57 +0000 (GMT) Date: Sun, 2 Jan 2022 23:23:57 +0000 (GMT) From: "Maciej W. Rozycki" To: Khalid Aziz , "James E.J. Bottomley" , "Martin K. Petersen" cc: Christoph Hellwig , Nix , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] scsi: Set allocation length to 255 for ATA Information VPD page In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Set the allocation length to 255 for the ATA Information VPD page=20 requested in the WRITE SAME handler, so as not to limit information=20 examined by `scsi_get_vpd_page' in the supported vital product data=20 pages unnecessarily. Originally it was thought that Areca hardware may have issues with a=20 valid allocation length supplied for a VPD inquiry, however older SCSI=20 standard revisions[1] consider 255 the maximum length allowed and what=20 has later become the high order byte is considered reserved and must be=20 zero with the INQUIRY command. Therefore it was unnecessary to reduce=20 the amount of data requested from 512 as far down as to 64, arbitrarily=20 chosen, and 255 would as well do. With commit b3ae8780b429 ("[SCSI] Add EVPD page 0x83 and 0x80 to sysfs")=20 we have since got the SCSI_VPD_PG_LEN macro, so use that instead. References: [1] "Information technology - Small Computer System Interface - 2", WORKING DRAFT, X3T9.2, Project 375D, Revision 10L, 7-SEP-93, Section 8.2.5 "INQUIRY command", pp.104-108 Signed-off-by: Maciej W. Rozycki Fixes: af73623f5f10 ("[SCSI] sd: Reduce buffer size for vpd request") Tested-by: Nick Alcock --- Changes from v2: - Add Nick's Tested-by annotation.=20 No changes from v1. --- drivers/scsi/sd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) linux-scsi-write-same-vpd-buffer.diff Index: linux-macro/drivers/scsi/sd.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-macro.orig/drivers/scsi/sd.c +++ linux-macro/drivers/scsi/sd.c @@ -3101,16 +3101,13 @@ static void sd_read_write_same(struct sc } =20 if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) { - /* too large values might cause issues with arcmsr */ - int vpd_buf_len =3D 64; - sdev->no_report_opcodes =3D 1; =20 /* Disable WRITE SAME if REPORT SUPPORTED OPERATION * CODES is unsupported and the device has an ATA * Information VPD page (SAT). */ - if (!scsi_get_vpd_page(sdev, 0x89, buffer, vpd_buf_len)) + if (!scsi_get_vpd_page(sdev, 0x89, buffer, SCSI_VPD_PG_LEN)) sdev->no_write_same =3D 1; } =20