Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1424289 > unrolled thread

[PATCH 1/2] x86/amd_nb: Return negative value when no northbridges

Started byBorislav Petkov <bp@alien8.de>
First post2016-06-16 19:20 +0200
Last post2016-06-16 19:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] x86/amd_nb: Return negative value when no northbridges Borislav Petkov <bp@alien8.de> - 2016-06-16 19:20 +0200

#1424289 — [PATCH 1/2] x86/amd_nb: Return negative value when no northbridges

FromBorislav Petkov <bp@alien8.de>
Date2016-06-16 19:20 +0200
Subject[PATCH 1/2] x86/amd_nb: Return negative value when no northbridges
Message-ID<rKJ7r-2Jr-5@gated-at.bofh.it>
From: Borislav Petkov <bp@suse.de>

AMD northbridges users call amd_cache_northbridges() and it returns
a negative value to signal that we weren't able to cache/detect any
northbridges on the system.

At least, it should do so as all its callers expect it to do so. But it
does return a negative value only when kmalloc fails.

Fix it to return -ENODEV if there are no NBs cached as otherwise, amd_nb
users like amd64_edac, for example, which relies on it to know whether
it should load or not, gets loaded on systems like Intel Xeons where it
shouldn't.

Reported-and-tested-by: Tony Battersby <tonyb@cybernetics.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/5761BEB0.9000807@cybernetics.com
---
 arch/x86/kernel/amd_nb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index a147e676fc7b..e991d5c8bb3a 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -71,8 +71,8 @@ int amd_cache_northbridges(void)
 	while ((misc = next_northbridge(misc, amd_nb_misc_ids)) != NULL)
 		i++;
 
-	if (i == 0)
-		return 0;
+	if (!i)
+		return -ENODEV;
 
 	nb = kzalloc(i * sizeof(struct amd_northbridge), GFP_KERNEL);
 	if (!nb)
-- 
2.7.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web