From: sashiko-bot@kernel.org
To: "Damien Le Moal" <dlemoal@kernel.org>
Cc: dlemoal@kernel.org, linux-ide@vger.kernel.org, cassel@kernel.org
Subject: Re: [PATCH v1 3/6] ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes()
Date: Thu, 02 Jul 2026 02:11:30 +0000 [thread overview]
Message-ID: <20260702021131.12F101F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702015646.1702539-4-dlemoal@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] ata_scsi_supported_cmd_has_sa() and ata_supported_cmds incorrectly handle service actions of value 0, breaking REPORT SUPPORTED OPERATION CODES.
--
commit 976ae28e21b5ac80b95af84b459ff3561417568d
Author: Damien Le Moal <dlemoal@kernel.org>
ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes()
This commit updates ata_scsi_report_supported_opcodes() to take service actions
into consideration. It adds ata_scsi_supported_cmd_has_sa() to check if an
opcode has service actions and uses both opcode and service action to look up
supported commands.
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 380ca3886a777..e432e521ad318 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
[ ... ]
> @@ -3641,32 +3641,46 @@ static const struct ata_scsi_cmd ata_supported_cmds[] = {
> { ZBC_OUT, 16, ZO_RESET_WRITE_POINTER },
> };
>
> -static const struct ata_scsi_cmd *ata_scsi_get_supported_cmd(u8 op)
> +static const struct ata_scsi_cmd *ata_scsi_get_supported_cmd(u8 op, u16 sa)
> {
> const struct ata_scsi_cmd *cmd;
> int i;
>
> for (i = 0; i < ARRAY_SIZE(ata_supported_cmds); i++) {
> cmd = &ata_supported_cmds[i];
> - if (cmd->op == op)
> + if (cmd->op == op && cmd->sa == sa)
[Severity: Medium]
Does this strict service action matching cause issues for VARIABLE_LENGTH_CMD?
Looking at the ata_supported_cmds array, VARIABLE_LENGTH_CMD uses service
actions (e.g., ATA_32 = 0x1FF0) but is mapped with sa = 0. Will this cause the
matching here to fail for valid service actions under reporting option 3?
> return cmd;
> }
>
> return NULL;
> }
>
> +static bool ata_scsi_supported_cmd_has_sa(u8 op)
> +{
> + const struct ata_scsi_cmd *cmd;
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(ata_supported_cmds); i++) {
> + cmd = &ata_supported_cmds[i];
> + if (cmd->op == op)
> + return cmd->sa != 0;
[Severity: Medium]
Will this incorrectly handle service actions with a value of 0?
Because 0 is a valid service action (e.g., ZBC_IN uses ZI_REPORT_ZONES = 0),
this condition will incorrectly cause ata_scsi_supported_cmd_has_sa() to
return false for ZBC_IN.
> + }
> +
> + return false;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702015646.1702539-1-dlemoal@kernel.org?part=3
next prev parent reply other threads:[~2026-07-02 2:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 1:56 [PATCH v1 0/6] Improve ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02 1:56 ` [PATCH v1 1/6] ata: libata: rename ata_dev_is_zac() Damien Le Moal
2026-07-02 1:56 ` [PATCH v1 2/6] ata: libata-scsi: refactor ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02 1:56 ` [PATCH v1 3/6] ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02 2:11 ` sashiko-bot [this message]
2026-07-02 1:56 ` [PATCH v1 4/6] ata: libata-scsi: improves checks for ZBC_IN and ZBC_OUT commands support Damien Le Moal
2026-07-02 2:07 ` sashiko-bot
2026-07-02 2:19 ` Damien Le Moal
2026-07-02 1:56 ` [PATCH v1 5/6] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES Damien Le Moal
2026-07-02 2:13 ` sashiko-bot
2026-07-02 1:56 ` [PATCH v1 6/6] ata: libata-scsi: support the all command format for reporting supported commands Damien Le Moal
2026-07-02 2:11 ` sashiko-bot
2026-07-02 2:27 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260702021131.12F101F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox