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

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