diff options
author | Jean Delvare <jdelvare@suse.de> | 2020-10-30 15:36:19 +0100 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2020-10-30 15:36:19 +0100 |
commit | d64af9778d795c7318653f5bc3016295bf67d700 (patch) | |
tree | 394b871ac6bf307a80193143ab9535d5fd62b13f /dmidecode.c | |
parent | b289de9deb325eeef7919a1f4e3ac1f93b099c16 (diff) | |
download | dmidecode-git-d64af9778d795c7318653f5bc3016295bf67d700.tar.gz |
dmidecode: Skip details of uninstalled memory modules
If a memory slot is empty then by definition the fields containing
the memory module details are irrelevant. Best case they are filled
with "Unused" and "None", but in some cases they are even invalid
because the manufacturer did not bother setting the fields to
valid neutral values. So it is better to not print these fields
at all, so as to not confuse the user.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'dmidecode.c')
-rw-r--r-- | dmidecode.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/dmidecode.c b/dmidecode.c index 67f6048..404c7e1 100644 --- a/dmidecode.c +++ b/dmidecode.c @@ -4484,6 +4484,9 @@ static void dmi_decode(const struct dmi_header *h, u16 ver) dmi_memory_device_type(data[0x12])); dmi_memory_device_type_detail(WORD(data + 0x13)); if (h->length < 0x17) break; + /* If no module is present, the remaining fields are irrelevant */ + if (WORD(data + 0x0C) == 0) + break; dmi_memory_device_speed("Speed", WORD(data + 0x15), h->length >= 0x5C ? DWORD(data + 0x54) : 0); |