dmidecode/dmidecode-dont-choke-on-invalid-processor-voltage.patch
Jean Delvare 84e0754eb1 Accepting request 796018 from home:jdelvare:branches:Base:System
3 recommended fixes from upstream:
- dmidecode-print-type-33-name-unconditionally.patch: Print type 33
  name unconditionally.
- dmidecode-dont-choke-on-invalid-processor-voltage.patch: Don't
  choke on invalid processor voltage.
- dmidecode-fix-the-alignment-of-type-25-name.patch: Fix the
  alignment of type 25 name.
Build fix:
- dmidecode-allow-overriding-build-settings-from-env.patch: Fix the
  build system so that the compilation flags passed by OBS are
  added to the ones dmidecode needs, instead of overriding them
  entirely.
- dmidecode.spec: Pass the CFLAGS through the environment, instead
  of as a parameter.

OBS-URL: https://build.opensuse.org/request/show/796018
OBS-URL: https://build.opensuse.org/package/show/Base:System/dmidecode?expand=0&rev=56
2020-04-21 10:36:12 +00:00

34 lines
866 B
Diff

From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 23 Mar 2020 16:47:23 +0100
Subject: dmidecode: Don't choke on invalid processor voltage
Git-commit: 5bb7eb173b72256f70c6b3f3916d7a444be93340
Patch-mainline: yes
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 <jdelvare@suse.de>
---
dmidecode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -1186,13 +1186,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");
}
}