summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorNiklas Cassel <cassel@kernel.org>2026-11-03 21:54:55 +0100
committerNiklas Cassel <cassel@kernel.org>2026-11-07 13:34:39 +0100
commit0fdb8eef88a886751e33600d446a66c529384f11 (patch)
tree975173f76e61e793ffe069fb876ed30472ae7ed0 /tools/lib/python
parenta3e52dcf0fbaa1a103accef3e8861cdc250ee5d6 (diff)
ata: libata-scsi: pass the whole mode page to the MODE SELECT handlers
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") Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20261103205448.931471-16-cassel@kernel.org Signed-off-by: Niklas Cassel <cassel@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions