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

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