diff options
author | Avri Altman <avri.altman@wdc.com> | 2018-10-07 16:30:36 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-10-11 05:09:46 +0200 |
commit | 220d17a69de432e520461531cb569f75a43ed6f5 (patch) | |
tree | 73c9cd4fff2e16de7042efc05dcb39316ff8bd34 /drivers/scsi/ufs | |
parent | scsi: ufs: Add a bsg endpoint that supports UPIUs (diff) | |
download | linux-220d17a69de432e520461531cb569f75a43ed6f5.tar.xz linux-220d17a69de432e520461531cb569f75a43ed6f5.zip |
scsi: ufs: Use data structure size in pointer arithmetic
Use the structure size in pointer arithmetic instead of an opaque 32
bytes for the over-allocation of descriptors.
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/ufs')
-rw-r--r-- | drivers/scsi/ufs/ufs.h | 2 | ||||
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index f1d77dc2a1af..f5800c3203b0 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -40,7 +40,7 @@ #include <linux/types.h> #include <uapi/scsi/scsi_bsg_ufs.h> -#define GENERAL_UPIU_REQUEST_SIZE 32 +#define GENERAL_UPIU_REQUEST_SIZE (sizeof(struct utp_upiu_req)) #define QUERY_DESC_MAX_SIZE 255 #define QUERY_DESC_MIN_SIZE 2 #define QUERY_DESC_HDR_SIZE 2 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 69d023788e14..cc48518e9639 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2262,7 +2262,6 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba, struct utp_upiu_req *ucd_req_ptr = lrbp->ucd_req_ptr; struct ufs_query *query = &hba->dev_cmd.query; u16 len = be16_to_cpu(query->request.upiu_req.length); - u8 *descp = (u8 *)lrbp->ucd_req_ptr + GENERAL_UPIU_REQUEST_SIZE; /* Query request header */ ucd_req_ptr->header.dword_0 = UPIU_HEADER_DWORD( @@ -2284,7 +2283,7 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba, /* Copy the Descriptor */ if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC) - memcpy(descp, query->descriptor, len); + memcpy(ucd_req_ptr + 1, query->descriptor, len); memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp)); } |