From: Christoph Hellwig <hch@lst.de>
To: axboe@kernek.dk
Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: [PATCH 1/6] scsi: always zero sshdr in scsi_normalize_sense
Date: Tue, 14 Feb 2017 20:15:55 +0100 [thread overview]
Message-ID: <20170214191600.17480-2-hch@lst.de> (raw)
In-Reply-To: <20170214191600.17480-1-hch@lst.de>
This gives us a clear state even if a command didn't return sense data.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
drivers/scsi/scsi_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_common.c b/drivers/scsi/scsi_common.c
index b1383a71400e..a75673bb82b3 100644
--- a/drivers/scsi/scsi_common.c
+++ b/drivers/scsi/scsi_common.c
@@ -137,11 +137,11 @@ EXPORT_SYMBOL(int_to_scsilun);
bool scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
struct scsi_sense_hdr *sshdr)
{
+ memset(sshdr, 0, sizeof(struct scsi_sense_hdr));
+
if (!sense_buffer || !sb_len)
return false;
- memset(sshdr, 0, sizeof(struct scsi_sense_hdr));
-
sshdr->response_code = (sense_buffer[0] & 0x7f);
if (!scsi_sense_valid(sshdr))
--
2.11.0
next prev parent reply other threads:[~2017-02-14 19:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 19:15 sense handling improvements Christoph Hellwig
2017-02-14 19:15 ` Christoph Hellwig [this message]
2017-02-15 7:59 ` [PATCH 1/6] scsi: always zero sshdr in scsi_normalize_sense Hannes Reinecke
2017-02-14 19:15 ` [PATCH 2/6] sd: improve TUR handling in sd_check_events Christoph Hellwig
2017-02-15 8:00 ` Hannes Reinecke
2017-02-14 19:15 ` [PATCH 3/6] scsi: make the sense header argument to scsi_test_unit_ready mandatory Christoph Hellwig
2017-02-14 19:15 ` [PATCH 4/6] scsi: simplify scsi_execute_req_flags Christoph Hellwig
2017-02-14 19:15 ` [PATCH 5/6] scsi: merge __scsi_execute into scsi_execute Christoph Hellwig
2017-02-14 19:16 ` [PATCH 6/6] scsi: remove scsi_execute_req_flags Christoph Hellwig
2017-02-15 8:19 ` sense handling improvements Hannes Reinecke
2017-02-15 15:04 ` Christoph Hellwig
2017-02-15 15:30 ` Bart Van Assche
2017-02-16 3:42 ` Martin K. Petersen
2017-02-16 14:33 ` Christoph Hellwig
2017-02-22 7:19 ` Christoph Hellwig
2017-02-22 13:52 ` Martin K. Petersen
2017-02-23 0:51 ` Martin K. Petersen
2017-02-23 9:49 ` Christoph Hellwig
2017-02-23 14:28 ` Martin K. Petersen
2017-02-23 14:31 ` Christoph Hellwig
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=20170214191600.17480-2-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernek.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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