Blame SOURCES/0004-dmidecode-Skip-details-of-uninstalled-memory-modules.patch

d384d2
From 02ff0488f7d7a0f7e69ff7141236cbc1392c3b4c Mon Sep 17 00:00:00 2001
d384d2
From: Jean Delvare <jdelvare@suse.de>
d384d2
Date: Fri, 30 Oct 2020 15:36:19 +0100
d384d2
Subject: [PATCH 2/2] dmidecode: Skip details of uninstalled memory modules
d384d2
d384d2
If a memory slot is empty then by definition the fields containing
d384d2
the memory module details are irrelevant. Best case they are filled
d384d2
with "Unused" and "None", but in some cases they are even invalid
d384d2
because the manufacturer did not bother setting the fields to
d384d2
valid neutral values. So it is better to not print these fields
d384d2
at all, so as to not confuse the user.
d384d2
d384d2
Signed-off-by: Jean Delvare <jdelvare@suse.de>
d384d2
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
d384d2
---
d384d2
 dmidecode.c | 3 +++
d384d2
 1 file changed, 3 insertions(+)
d384d2
d384d2
diff --git a/dmidecode.c b/dmidecode.c
d384d2
index 0e480d3e337b..657a1341470b 100644
d384d2
--- a/dmidecode.c
d384d2
+++ b/dmidecode.c
d384d2
@@ -4465,6 +4465,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
d384d2
 				dmi_memory_device_type(data[0x12]));
d384d2
 			dmi_memory_device_type_detail(WORD(data + 0x13));
d384d2
 			if (h->length < 0x17) break;
d384d2
+			/* If no module is present, the remaining fields are irrelevant */
d384d2
+			if (WORD(data + 0x0C) == 0)
d384d2
+				break;
d384d2
 			dmi_memory_device_speed("Speed", WORD(data + 0x15));
d384d2
 			if (h->length < 0x1B) break;
d384d2
 			pr_attr("Manufacturer", "%s",
d384d2
-- 
d384d2
2.17.1
d384d2