From: Santosh Y <santoshsy@gmail.com>
To: james.bottomley@hansenpartnership.com
Cc: linux-scsi@vger.kernel.org, vinholikatti@gmail.com,
Santosh Y <santoshsy@gmail.com>
Subject: [PATCH 2/3] [SCSI] ufs: Limit sense data size to 18 bytes
Date: Sat, 21 Apr 2012 14:39:18 +0530 [thread overview]
Message-ID: <1334999359-3181-2-git-send-email-santoshsy@gmail.com> (raw)
In-Reply-To: <1334999359-3181-1-git-send-email-santoshsy@gmail.com>
As per the UFS specification a UFS device server should return upto
18 bytes of sense data. Currently, if a SCSI command completes with
a check condition, min_t(sense_data_length, SCSI_SENSE_BUFFERSIZE)
bytes of sense data is being copied to sense_buffer.
Correct sense_data_length(<= 18 bytes), from a UFS device will not
cause any problem. If a UFS device returns wrong sense_data_length
( > 18 bytes), then the wrong sense data will be copied to
sense_buffer.
Signed-off-by: Santosh Y <santoshsy@gmail.com>
Reviewed-by: Vinayak Holikatti <vinholikatti@gmail.com>
---
drivers/scsi/ufs/ufs.h | 1 +
drivers/scsi/ufs/ufshcd.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index b207529..0af1aac 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -47,6 +47,7 @@
#define _UFS_H
#define MAX_CDB_SIZE 16
+#define MAX_SENSE_SIZE 18
#define UPIU_HEADER_DWORD(byte3, byte2, byte1, byte0)\
((byte3 << 24) | (byte2 << 16) |\
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 3e4e102..662d00f 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -479,7 +479,7 @@ static inline void ufshcd_copy_sense_data(struct ufshcd_lrb *lrbp)
len = be16_to_cpu(lrbp->ucd_rsp_ptr->sense_data_len);
memcpy(lrbp->sense_buffer,
lrbp->ucd_rsp_ptr->sense_data,
- min_t(int, len, SCSI_SENSE_BUFFERSIZE));
+ min_t(int, len, MAX_SENSE_SIZE));
}
}
--
1.7.5.4
next prev parent reply other threads:[~2012-04-21 9:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-21 9:09 [PATCH 1/3] [SCSI] ufs: Remove unused member sense_bufflen Santosh Y
2012-04-21 9:09 ` Santosh Y [this message]
2012-04-21 9:09 ` [PATCH 3/3] [SCSI] ufs: Process SCSI command for UFS device Santosh Y
2012-04-21 10:59 ` James Bottomley
2012-04-23 5:14 ` Santosh Y
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=1334999359-3181-2-git-send-email-santoshsy@gmail.com \
--to=santoshsy@gmail.com \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=vinholikatti@gmail.com \
/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