[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH 2/8] dmidecode: Don't choke on invalid processor volt
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH 2/8] dmidecode: Don't choke on invalid processor voltage |
Date: |
Mon, 16 Mar 2020 10:38:27 +0100 |
If the processor voltage encoding has some of the reserved bits set
and none of the proper bits set, print it as "Unknown" instead of an
empty field.
Signed-off-by: Jean Delvare <address@hidden>
---
dmidecode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- dmidecode.orig/dmidecode.c 2020-02-19 11:24:43.293067794 +0100
+++ dmidecode/dmidecode.c 2020-02-19 11:42:35.564558142 +0100
@@ -1190,13 +1190,13 @@ static void dmi_processor_voltage(u8 cod
if (code & 0x80)
printf(" %.1f V", (float)(code & 0x7f) / 10);
+ else if ((code & 0x07) == 0x00)
+ printf(" Unknown");
else
{
for (i = 0; i <= 2; i++)
if (code & (1 << i))
printf(" %s", voltage[i]);
- if (code == 0x00)
- printf(" Unknown");
}
}
--
Jean Delvare
SUSE L3 Support
- [dmidecode] [PATCH 0/8] dmidecode: Minors fixes and clean-ups, Jean Delvare, 2020/03/16
- [dmidecode] [PATCH 1/8] dmidecode: Print type 33 name unconditionally, Jean Delvare, 2020/03/16
- [dmidecode] [PATCH 2/8] dmidecode: Don't choke on invalid processor voltage,
Jean Delvare <=
- [dmidecode] [PATCH 3/8] dmidecode: Simplify the formatting of memory error status, Jean Delvare, 2020/03/16
- [dmidecode] [PATCH 4/8] dmidecode: Fix the alignment of type 25 name, Jean Delvare, 2020/03/16
- [dmidecode] [PATCH 5/8] dmidecode: Code indentation fixes, Jean Delvare, 2020/03/16
- [dmidecode] [PATCH 6/8] dmidecode: Reduce the indentation of type 42 structures, Jean Delvare, 2020/03/16
- [dmidecode] [PATCH 7/8] dmidecode: Move type 42 warning messages to stderr, Jean Delvare, 2020/03/16
- [dmidecode] [PATCH 8/8] dmidecode: Refactor ASCII filtering of DMI strings, Jean Delvare, 2020/03/16