summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_common.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-02-14 20:15:55 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2017-02-22 19:33:00 -0500
commit148cff67b401e2229c076c0ea418712654be77e4 (patch)
tree4ba819ea59c862f64644505f643de264ec4ab844 /drivers/scsi/scsi_common.c
parent4d7d39a18b8b81511f0b893b7d2203790bf8a58b (diff)
scsi: always zero sshdr in scsi_normalize_sense
This gives us a clear state even if a command didn't return sense data. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_common.c')
-rw-r--r--drivers/scsi/scsi_common.c4
1 files 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))