dmidecode-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]