scsi: ufs: Add back a missing sanity check to ufshcd_read_desc_param()
Commit a78751da13c9e
("scsi: ufs: Fix unexpected values get from ufshcd_read_desc_param()")
wrongly deletes a condition check for tmp buffer allocation, this change
adds it back.
Change-Id: I0f27f30c90fd6592e10af039ce8227d48a85c790
Signed-off-by: Can Guo <cang@codeaurora.org>
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
33a5e16376
commit
7ced4b974d
@@ -4569,7 +4569,7 @@ int ufshcd_read_desc_param(struct ufs_hba *hba,
|
||||
}
|
||||
|
||||
/* Check whether we need temp memory */
|
||||
if (param_offset != 0) {
|
||||
if (param_offset != 0 || param_size < buff_len) {
|
||||
desc_buf = kzalloc(buff_len, GFP_KERNEL);
|
||||
if (!desc_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user