From 2775494cb0a3ffbb2f87d2ce8ef9bdff7f7920e1 Mon Sep 17 00:00:00 2001 From: Anton Arapov Date: Mon, 14 Nov 2011 15:03:35 +0100 Subject: [PATCH] fix the dmi_chassis_type function and its caller. --- dmidecode-2.11-chassis_fix.patch | 42 ++++++++++++++++++++++++++++++++ dmidecode.spec | 13 +++++++--- 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 dmidecode-2.11-chassis_fix.patch diff --git a/dmidecode-2.11-chassis_fix.patch b/dmidecode-2.11-chassis_fix.patch new file mode 100644 index 0000000..f6a1063 --- /dev/null +++ b/dmidecode-2.11-chassis_fix.patch @@ -0,0 +1,42 @@ +diff -up dmidecode-2.11/AUTHORS.chassis_fix dmidecode-2.11/AUTHORS +--- dmidecode-2.11/AUTHORS.chassis_fix 2010-11-24 10:29:09.000000000 +0100 ++++ dmidecode-2.11/AUTHORS 2011-11-14 14:56:08.000000000 +0100 +@@ -81,3 +81,5 @@ Murlin Wenzel + Harald Mueller-Ney + Lars Mueller + Thomas Mingarelli ++Andrey Matveyev ++Stefan Tauner +diff -up dmidecode-2.11/CHANGELOG.chassis_fix dmidecode-2.11/CHANGELOG +--- dmidecode-2.11/CHANGELOG.chassis_fix 2011-11-14 14:56:39.804855909 +0100 ++++ dmidecode-2.11/CHANGELOG 2011-11-14 14:56:15.000000000 +0100 +@@ -1,3 +1,8 @@ ++2011-11-14 Anton Arapov ++ ++ * dmidecode.c: Make dmi_chassis_type aware of the lock bit. ++ Patch from Stefan Tauner. ++ + 2011-04-20 Jean Delvare + + Update to support SMBIOS specification version 2.7.1. +diff -up dmidecode-2.11/dmidecode.c.chassis_fix dmidecode-2.11/dmidecode.c +--- dmidecode-2.11/dmidecode.c.chassis_fix 2011-11-14 14:56:39.805855910 +0100 ++++ dmidecode-2.11/dmidecode.c 2011-11-14 14:55:12.000000000 +0100 +@@ -532,6 +532,8 @@ static const char *dmi_chassis_type(u8 c + "Blade Enclosing" /* 0x1D */ + }; + ++ code &= 0x7F; /* bits 6:0 are chassis type, 7th bit is the lock bit */ ++ + if (code >= 0x01 && code <= 0x1D) + return type[code - 0x01]; + return out_of_spec; +@@ -3237,7 +3239,7 @@ static void dmi_decode(const struct dmi_ + printf("\tManufacturer: %s\n", + dmi_string(h, data[0x04])); + printf("\tType: %s\n", +- dmi_chassis_type(data[0x05] & 0x7F)); ++ dmi_chassis_type(data[0x05])); + printf("\tLock: %s\n", + dmi_chassis_lock(data[0x05] >> 7)); + printf("\tVersion: %s\n", diff --git a/dmidecode.spec b/dmidecode.spec index 4a220b6..901da14 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,7 +1,7 @@ Summary: Tool to analyse BIOS DMI data Name: dmidecode Version: 2.11 -Release: 4%{?dist} +Release: 5%{?dist} Epoch: 1 Group: System Environment/Base License: GPLv2+ @@ -9,6 +9,7 @@ Source0: %{name}-%{version}.tar.bz2 URL: http://www.nongnu.org/dmidecode/ Patch0: dmidecode-2.11-type16-fix.patch Patch1: dmidecode-2.11-smbios-271.patch +Patch2: dmidecode-2.11-chassis_fix.patch Buildroot: %{_tmppath}/%{name}-%{version}-root BuildRequires: automake autoconf ExclusiveArch: %{ix86} x86_64 ia64 @@ -28,6 +29,7 @@ I/O ports (e.g. serial, parallel, USB). %setup -q %patch0 -p1 -b .type16_fix %patch1 -p1 -b .smbios271 +%patch2 -p1 -b .chassis_fix %build make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" @@ -51,9 +53,14 @@ rm -rf ${buildroot} %{_mandir}/man8/* %changelog +* Mon Nov 14 2011 Anton Arapov - 1:2.11-5 +- Fix the wrong call of the dmi_chassis_type function call. Thus fix + an issue on the systems with the chassis lock available, application + doesn't fall out with the out of spec error anymore. + * Tue May 03 2011 Anton Arapov - 1:2.11-4 -- update to SMBIOS 2.7.1 -- fix the boundaries check in type16 +- Update to SMBIOS 2.7.1 +- Fix the boundaries check in type16 * Tue Feb 08 2011 Fedora Release Engineering - 1:2.11-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild