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

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