All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Damien Le Moal" <dlemoal@kernel.org>
Cc: dlemoal@kernel.org, cassel@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v3 4/5] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES
Date: Fri, 03 Jul 2026 04:27:56 +0000	[thread overview]
Message-ID: <20260703042757.2FC8D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260703040532.2152614-5-dlemoal@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Reporting Option 3 fails to ignore the REQUESTED SERVICE ACTION field for commands that do not have service actions, causing supported commands to be reported as unsupported.
--

commit dc113e618a2abb6f7c7b971f3095bb3e3f08a158
Author: Damien Le Moal <dlemoal@kernel.org>

ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES

Add support for the reporting options value 2 of the in REPORT SUPPORTED
OPERATION CODES command in ata_scsi_report_supported_opcodes(). With this
reporting option, the specified opcode to check must have a service
action. Use ata_scsi_supported_cmd_has_sa() to check for this and fill the
command reply buffer using the one command format based on the command
support.

> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 4d4cdf3047405..5dd76579327e9 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3774,6 +3774,13 @@ static unsigned int ata_scsi_report_supported_opcodes(struct ata_device *dev,
>  			return 0;
>  		}
>  		break;
> +	case 2:
> +		/* One command format, must have sa. */
> +		if (!ata_scsi_supported_cmd_use_sa(cdb[3])) {
> +			ata_scsi_set_invalid_field(dev, cmd, 3, 0xff);
> +			return 0;
> +		}
> +		fallthrough;
>  	case 3:
>  		/* One command format */
>  		sa = get_unaligned_be16(&cdb[4]);

[Severity: Medium]
Does this code incorrectly fail to ignore the REQUESTED SERVICE ACTION field
for commands without service actions under Option 3?

If a legitimate SCSI query uses Option 3 with a non-zero service action field
for a command that does not use service actions, this block extracts the
non-zero sa value from the CDB.

Later in ata_scsi_get_supported_cmd(), the code enforces a strict match:

	for (i = 0; i < ARRAY_SIZE(ata_supported_cmds); i++) {
		cmd = &ata_supported_cmds[i];
		if (cmd->op == op && cmd->sa == sa)
			return cmd;
	}

Because cmd->sa is 0 for commands without service actions, this strict match
will fail. Will this cause valid commands (like READ_10) to be incorrectly
reported as unsupported?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260703040532.2152614-1-dlemoal@kernel.org?part=4

  reply	other threads:[~2026-07-03  4:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03  4:05 [PATCH v3 0/5] Improve ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03  4:05 ` [PATCH v3 1/5] ata: libata: rename ata_dev_is_zac() Damien Le Moal
2026-07-03  4:59   ` sashiko-bot
2026-07-03  6:15     ` Damien Le Moal
2026-07-03  4:05 ` [PATCH v3 2/5] ata: libata-scsi: refactor ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03  6:44   ` Hannes Reinecke
2026-07-03  7:05     ` Damien Le Moal
2026-07-03  7:06       ` Hannes Reinecke
2026-07-03  4:05 ` [PATCH v3 3/5] ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03  4:05 ` [PATCH v3 4/5] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES Damien Le Moal
2026-07-03  4:27   ` sashiko-bot [this message]
2026-07-03  4:05 ` [PATCH v3 5/5] ata: libata-scsi: support the all command format for reporting supported commands 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=20260703042757.2FC8D1F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.