Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793741617; b=OUYZr4KXR+KYcYJ0s1PjiJ5e3NHnjugkkxhnC6t0PA7MbnhnXP88TDHSuwmDCL5xkr05 ex4ZcD01L4O3LUZFNNG+kGE62FUPMGmINzLGRZ2XQpGYP9KmJgaEHlKLExKFIvx4PHzZf v0OCsnR3qSEy8O1+92gpYzez1ieu9vQeyeyW7fJyS5ljJQ2ZnYecO+7nUOdhcJnQun94Q n28xszFn2wx8fPoayAin2x3oNtEqcedmDnWxrIkHBt0SccPTxrh+iKYcYgwBGGN75ndg4 PpfCgXI590xjSebnapTXnDu/lF3r8BqLSFiZ6GBrp5Cc0X/yyklaZOcV0etkvApyvaA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793741617; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:Organization: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=wapEgtLUfTIoM91fMioMPYCmQRbZO1ArnWP371evDBY=; b=oz1JKAzHZenksjeyCeJulGVwiJMN7LlTzC4rZcREI3ZreXabb/BZgslqXAqe0EDc7/+I YwGtTDnlbp+JfN/p3Io//n1seGxY6X1bzk3DdrMGjevucUfxSv9y2ABSRvnMp5QIPZYPU Ozi5Jndd04+bqwUyenTxelVy7g0gCVe0NT/6jEpvsW7O9h9AjgazsrM2dP/6QrGXO+Uv7 Rpzrreo9QsMoObOkSGM0KTIVAULG3s8Eub2GRiiy0M/myhNFKXfVCSyLbQjNuSkBnYWcv wMIz1i5fwuq2qtTp6ARPEta4thWMW3Hq9YWml3KN6ZUqNaWWpZrnYlCk+Yw5VlMyZgQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nS7v6ezo; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73928606A31B for ; Tue, 3 Nov 2026 21:33:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=nS7v6ezo Received: by smtp.kernel.org (Postfix) with ESMTPSA id A42521F000C1; Tue, 3 Nov 2026 21:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793741617; bh=wapEgtLUfTIoM91fMioMPYCmQRbZO1ArnWP371evDBY=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=nS7v6ezoJU2tigLKlJBYSVV9GPAd5F/Oyv5/wkMlgM2biG3bxBwiB5BQF7xMVH8nF 4MiNdIHEhifvUg2MFRVjP4GPIRDM4tdKxyAWXRDoahhVdxXciguWo4MIMlnZxDZuI0 79YCXOewqIf1h5cVOX7oHl8QoHK0PRH46tuD03KNc/2JHvOxTW/11nLEP07TSuuOXb V3vEccIQsUj2CmMKls/anEofQFemv+r2vQduWR7mcpwOyliLo9uR3lTf+5by2xc/q4 hYOaYbdp0ZCwtDurJo/jET9CBbFP0AlUrNUkn0wYYmUd3F4EX6m3Qu8YGnD3ybFxvU VMHSDG07QUXAA== Message-ID: <5b7e567f-08e3-4ac0-905e-592638f49041@kernel.org> Date: Wed, 4 Nov 2026 06:33:35 +0900 X-Mailing-List: linux-ide@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 6/8] ata: libata-scsi: pass the whole mode page to the MODE SELECT handlers To: Niklas Cassel Cc: linux-ide@vger.kernel.org, Igor Pylypiv , Shao Mingyin , Hannes Reinecke References: <20261103205448.931471-10-cassel@kernel.org> <20261103205448.931471-16-cassel@kernel.org> Content-Language: en-US From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20261103205448.931471-16-cassel@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/4/26 05:54, Niklas Cassel wrote: > ata_scsi_mode_select_xlat() strips the mode page header before calling > the mode page handlers, which report the position of an invalid field > as an offset relative to the mode page data. It then converts this > offset into an offset in the parameter list by adding the length of the > mode parameter header and of the block descriptors, but not the length > of the mode page header. As a result, the FIELD POINTER of the INVALID > FIELD IN PARAMETER LIST sense data points 2 bytes (page_0 format) or 4 > bytes (sub_page format) before the byte that is actually invalid. For > example, changing byte 3 of the caching mode page in a MODE SELECT(10) > parameter list without block descriptors reports byte 9 instead of > byte 11. > > Pass the whole mode page, starting with its mode page header, to the > handlers instead, like the ata_msense_*() functions, which generate the > whole mode page. Offsets in buf are then the byte numbers of the mode > page, as used in the mode page definitions of SPC, SBC and SAT, the > handlers can compare buf with the mode page generated by the matching > ata_msense_*() function without adjusting offsets, and the conversion > done by ata_scsi_mode_select_xlat() becomes correct. This also allows > reporting an invalid PAGE LENGTH at the PAGE LENGTH field, which was not > part of buf before. As ata_scsi_mode_select_xlat() rejects SUBPAGE CODE > FFh and mode pages with a wrong SPF bit, each handler only gets its mode > page in a single format, so the mode page header length is known. > > Document what buf, len and fp are, and the return values, in kernel-doc > comments for all the handlers. > > Fixes: 7780081c1f04 ("libata-scsi: Set information sense field for invalid parameter") > Signed-off-by: Niklas Cassel Looks good. Reviewed-by: Damien Le Moal -- Damien Le Moal Western Digital Research