Commit 6fe4c679 authored by Wonkon Kim's avatar Wonkon Kim Committed by Martin K. Petersen
Browse files

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: 12b4fdb4 ("[SCSI] ufs: add dme configuration primitives")
Signed-off-by: default avatarWonkon Kim <wkon.kim@samsung.com>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251020061539.28661-2-wkon.kim@samsung.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e23ef4f2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4282,8 +4282,8 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32 attr_sel,
			get, UIC_GET_ATTR_ID(attr_sel),
			UFS_UIC_COMMAND_RETRIES - retries);

	if (mib_val && !ret)
		*mib_val = uic_cmd.argument3;
	if (mib_val)
		*mib_val = ret == 0 ? uic_cmd.argument3 : 0;

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