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

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