Skip to contentSkip to conversation

platform/x86: amd-pmc: uninitialized variable in amd_pmc_s2d_init()

PATCH In review Dan Carpenter 2 participants 2 messages Mar 7, 2022 – Mar 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: amd-pmc: uninitialized variable in amd_pmc_s2d_init()

The "size" variable can be uninitialized if amd_pmc_send_cmd() fails.

Fixes 3d7d407dfb05 ("platform/x86: amd-pmc: Add support for AMD Spill to DRAM STB feature")
---
 drivers/platform/x86/amd-pmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/amd-pmc.c +2 -1
index 425a86108f75..fc0b4d628dec 100644
@@ -708,8 +708,9 @@ static const struct pci_device_id pmc_pci_ids[] = {
 
 static int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
 {
-	u32 size, phys_addr_low, phys_addr_hi;
+	u32 phys_addr_low, phys_addr_hi;
 	u64 stb_phys_addr;
+	u32 size = 0;
 
 	/* Spill to DRAM feature uses separate SMU message port */
 	dev->msg_port = 1;
Signature · 1 line
2.20.1
#1 lore raw

Hi,

Quoted 4 lines · Dan Carpenter

The "size" variable can be uninitialized if amd_pmc_send_cmd() fails.

Fixes 3d7d407dfb05 ("platform/x86: amd-pmc: Add support for AMD Spill to DRAM STB feature")

Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.

Regards,

Hans

Quoted 19 lines
---
 drivers/platform/x86/amd-pmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/amd-pmc.c +2 -1
index 425a86108f75..fc0b4d628dec 100644
@@ -708,8 +708,9 @@ static const struct pci_device_id pmc_pci_ids[] = {
 
 static int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
 {
-	u32 size, phys_addr_low, phys_addr_hi;
+	u32 phys_addr_low, phys_addr_hi;
 	u64 stb_phys_addr;
+	u32 size = 0;
 
 	/* Spill to DRAM feature uses separate SMU message port */
 	dev->msg_port = 1;