Message ID | 20200603091959.27618-4-huobean@gmail.com |
---|---|
State | New |
Headers | show |
Series | scsi: ufs: cleanup ufs initialization | expand |
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c18c2aadbe14..7163b268ed0b 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -3210,8 +3210,8 @@ int ufshcd_read_desc_param(struct ufs_hba *hba, } /* Check wherher we will not copy more data, than available */ - if (is_kmalloc && param_size > buff_len) - param_size = buff_len; + if (is_kmalloc && (param_offset + param_size) > buff_len) + param_size = buff_len - param_offset; if (is_kmalloc) memcpy(param_read_buf, &desc_buf[param_offset], param_size);