diff mbox

[03/14] libata-scsi: sanitize ata_gen_ata_sense()

Message ID 1459763047-125551-4-git-send-email-hare@suse.de
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Hannes Reinecke April 4, 2016, 9:43 a.m. UTC
ata_to_sense_error() is called conditionally, so we should be
generating a default sense if the condition is not met.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/ata/libata-scsi.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Sergei Shtylyov April 4, 2016, 11:26 a.m. UTC | #1
On 4/4/2016 12:43 PM, Hannes Reinecke wrote:

> ata_to_sense_error() is called conditionally, so we should be
> generating a default sense if the condition is not met.
>
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>   drivers/ata/libata-scsi.c | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 6dc2fad..e331077 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -1074,6 +1074,12 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc)
>   		ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
>   				   &sb[1], &sb[2], &sb[3], verbose);
>   		sb[1] &= 0x0f;
> +	} else {
> +		/* Could not decode error */
> +		ata_dev_warn(dev, "could not decode error status 0x%x err_mask 0x%x\n",

    "%#x" is equivalent and takes up less space.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tejun Heo April 4, 2016, 4:22 p.m. UTC | #2
On Mon, Apr 04, 2016 at 02:26:51PM +0300, Sergei Shtylyov wrote:
> >+	} else {
> >+		/* Could not decode error */
> >+		ata_dev_warn(dev, "could not decode error status 0x%x err_mask 0x%x\n",
> 
>    "%#x" is equivalent and takes up less space.

Oops, gmail for some reason put Sergei's messages into spam folder.
Hannes, can you please generate incremental patches for Sergei's
comments?

Thanks.
Sergei Shtylyov April 4, 2016, 5:33 p.m. UTC | #3
On 04/04/2016 07:22 PM, Tejun Heo wrote:

>>> +	} else {
>>> +		/* Could not decode error */
>>> +		ata_dev_warn(dev, "could not decode error status 0x%x err_mask 0x%x\n",
>>
>>     "%#x" is equivalent and takes up less space.

> Oops, gmail for some reason put Sergei's messages into spam folder.

    My (dynamic) IP was even blacklisted by the Freenode's IRC servers not so 
long ago. :-)

> Hannes, can you please generate incremental patches for Sergei's
> comments?

    Don't think it's worth it. Perhaps only the comment typos...

> Thanks.

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 6dc2fad..e331077 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1074,6 +1074,12 @@  static void ata_gen_ata_sense(struct ata_queued_cmd *qc)
 		ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
 				   &sb[1], &sb[2], &sb[3], verbose);
 		sb[1] &= 0x0f;
+	} else {
+		/* Could not decode error */
+		ata_dev_warn(dev, "could not decode error status 0x%x err_mask 0x%x\n",
+			     tf->command, qc->err_mask);
+		ata_scsi_set_sense(cmd, ABORTED_COMMAND, 0, 0);
+		return;
 	}
 
 	block = ata_tf_read_block(&qc->result_tf, dev);