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

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