Blame SOURCES/0002-dmidecode-Don-t-choke-on-invalid-processor-voltage.patch

dfabe0
From 5bb7eb173b72256f70c6b3f3916d7a444be93340 Mon Sep 17 00:00:00 2001
dfabe0
From: Jean Delvare <jdelvare@suse.de>
dfabe0
Date: Mon, 23 Mar 2020 16:47:23 +0100
dfabe0
Subject: [PATCH 02/23] dmidecode: Don't choke on invalid processor voltage
dfabe0
dfabe0
If the processor voltage encoding has some of the reserved bits set
dfabe0
and none of the proper bits set, print it as "Unknown" instead of an
dfabe0
empty field.
dfabe0
dfabe0
Signed-off-by: Jean Delvare <jdelvare@suse.de>
dfabe0
---
dfabe0
 dmidecode.c | 4 ++--
dfabe0
 1 file changed, 2 insertions(+), 2 deletions(-)
dfabe0
dfabe0
diff --git a/dmidecode.c b/dmidecode.c
dfabe0
index 71c166f0595d..ef9bbd54b7f8 100644
dfabe0
--- a/dmidecode.c
dfabe0
+++ b/dmidecode.c
dfabe0
@@ -1190,13 +1190,13 @@ static void dmi_processor_voltage(u8 code)
dfabe0
 
dfabe0
 	if (code & 0x80)
dfabe0
 		printf(" %.1f V", (float)(code & 0x7f) / 10);
dfabe0
+	else if ((code & 0x07) == 0x00)
dfabe0
+		printf(" Unknown");
dfabe0
 	else
dfabe0
 	{
dfabe0
 		for (i = 0; i <= 2; i++)
dfabe0
 			if (code & (1 << i))
dfabe0
 				printf(" %s", voltage[i]);
dfabe0
-		if (code == 0x00)
dfabe0
-			printf(" Unknown");
dfabe0
 	}
dfabe0
 }
dfabe0
 
dfabe0
-- 
dfabe0
2.17.1
dfabe0