Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 12b4fdb4f6bc ("[SCSI] ufs: add dme configuration primitives")
Signed-off-by: Wonkon Kim <wkon.kim@samsung.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251020061539.28661-2-wkon.kim@samsung.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Wonkon Kim and committed by
Martin K. Petersen
6fe4c679 e23ef4f2

+2 -2
+2 -2
drivers/ufs/core/ufshcd.c
··· 4282 4282 get, UIC_GET_ATTR_ID(attr_sel), 4283 4283 UFS_UIC_COMMAND_RETRIES - retries); 4284 4284 4285 - if (mib_val && !ret) 4286 - *mib_val = uic_cmd.argument3; 4285 + if (mib_val) 4286 + *mib_val = ret == 0 ? uic_cmd.argument3 : 0; 4287 4287 4288 4288 if (peer && (hba->quirks & UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE) 4289 4289 && pwr_mode_change)