lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230214103318.1294909-1-arnd@kernel.org>
Date:   Tue, 14 Feb 2023 11:33:14 +0100
From:   Arnd Bergmann <arnd@...nel.org>
To:     Yazen Ghannam <yazen.ghannam@....com>,
        Borislav Petkov <bp@...en8.de>, Tony Luck <tony.luck@...el.com>
Cc:     Arnd Bergmann <arnd@...db.de>, James Morse <james.morse@....com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Robert Richter <rric@...nel.org>,
        William Roche <william.roche@...cle.com>,
        Muralidhara M K <muralimk@....com>,
        Jia He <justin.he@....com>, linux-edac@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] EDAC/amd64: avoid uninitialized variable use

From: Arnd Bergmann <arnd@...db.de>

hw_info_get() tries to reserve two sibling devices, but the device IDs are
no longer initialized for Fam17 CPUs:

drivers/edac/amd64_edac.c:3936:7: error: variable 'pci_id1' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                if (!pvt->umc)
                    ^~~~~~~~~
drivers/edac/amd64_edac.c:3943:37: note: uninitialized use occurs here
        ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
                                           ^~~~~~~
drivers/edac/amd64_edac.c:3936:3: note: remove the 'if' if its condition is always true
                if (!pvt->umc)
                ^~~~~~~~~~~~~~
drivers/edac/amd64_edac.c:3936:7: error: variable 'pci_id2' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                if (!pvt->umc)
                    ^~~~~~~~~
drivers/edac/amd64_edac.c:3943:46: note: uninitialized use occurs here
        ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
                                                    ^~~~~~~
drivers/edac/amd64_edac.c:3936:3: note: remove the 'if' if its condition is always true
                if (!pvt->umc)
                ^~~~~~~~~~~~~~

Move this code into the 'else' branch where it is still possible.

Fixes: 6229235f7c66 ("EDAC/amd64: Remove PCI Function 6")
Fixes: cf981562e627 ("EDAC/amd64: Remove PCI Function 0")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
I have no idea if this change makes sense, this is merely a guess
based on the description of the two other commits.
---
 drivers/edac/amd64_edac.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 1c4bef1cdf28..a149cd95e806 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -3938,11 +3938,11 @@ static int hw_info_get(struct amd64_pvt *pvt)
 	} else {
 		pci_id1 = fam_type->f1_id;
 		pci_id2 = fam_type->f2_id;
-	}
 
-	ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
-	if (ret)
-		return ret;
+		ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2);
+		if (ret)
+			return ret;
+	}
 
 	read_mc_regs(pvt);
 
-- 
2.39.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ