Skip to content

Commit 6fe4c67

Browse files
wkk-ssmartinkpetersen
authored andcommitted
scsi: ufs: core: Initialize value of an attribute returned by uic cmd
If ufshcd_send_cmd() fails, *mib_val may have a garbage value. It can get an unintended value of an attribute. Make ufshcd_dme_get_attr() always initialize *mib_val. Fixes: 12b4fdb ("[SCSI] ufs: add dme configuration primitives") Signed-off-by: Wonkon Kim <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e23ef4f commit 6fe4c67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4282,8 +4282,8 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
42824282
get, UIC_GET_ATTR_ID(attr_sel),
42834283
UFS_UIC_COMMAND_RETRIES - retries);
42844284

4285-
if (mib_val && !ret)
4286-
*mib_val = uic_cmd.argument3;
4285+
if (mib_val)
4286+
*mib_val = ret == 0 ? uic_cmd.argument3 : 0;
42874287

42884288
if (peer && (hba->quirks & UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE)
42894289
&& pwr_mode_change)

0 commit comments

Comments
 (0)