Hide irrelevant fixup message

Signed-off-by: Anton Arapov <arapov@gmail.com>
This commit is contained in:
Anton Arapov 2016-05-30 15:27:11 +02:00
parent 512bb40af7
commit 75ce9be660
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From cff11afa886a0147d734b650755d232b5e7f2099 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Tue, 3 May 2016 15:32:21 +0200
Subject: [PATCH 11/11] dmidecode: Hide irrelevant fixup message
Only display the message about type 34 length fixup if the entry in
question is going to be displayed. Otherwise it's only confusing.
This fixes bug #109024:
http://savannah.nongnu.org/support/?109024
Fixes: 3f70b3515d91 ("dmidecode: Fix up invalid DMI type 34 structure length")
---
dmidecode.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 0c26685..84c18e1 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -2949,7 +2949,7 @@ static void dmi_64bit_memory_error_address(u64 code)
* first 5 characters of the device name to be trimmed. It's easy to
* check and fix, so do it, but warn.
*/
-static void dmi_fixup_type_34(struct dmi_header *h)
+static void dmi_fixup_type_34(struct dmi_header *h, int display)
{
u8 *p = h->data;
@@ -2957,7 +2957,9 @@ static void dmi_fixup_type_34(struct dmi_header *h)
if (h->length == 0x10
&& is_printable(p + 0x0B, 0x10 - 0x0B))
{
- printf("Invalid entry length (%u). Fixed up to %u.\n", 0x10, 0x0B);
+ if (!(opt.flags & FLAG_QUIET) && display)
+ printf("Invalid entry length (%u). Fixed up to %u.\n",
+ 0x10, 0x0B);
h->length = 0x0B;
}
}
@@ -4446,7 +4448,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
/* Fixup a common mistake */
if (h.type == 34)
- dmi_fixup_type_34(&h);
+ dmi_fixup_type_34(&h, display);
/* look for the next handle */
next = data + h.length;
--
2.7.4

View File

@ -1,7 +1,7 @@
Summary: Tool to analyse BIOS DMI data
Name: dmidecode
Version: 3.0
Release: 2%{?dist}
Release: 3%{?dist}
Epoch: 1
Group: System Environment/Base
License: GPLv2+
@ -17,6 +17,7 @@ Patch7: 0007-Let-read_file-return-the-actual-data-size.patch
Patch8: 0008-dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch
Patch9: 0009-dmidecode-Check-sysfs-entry-point-length.patch
Patch10: 0010-Use-DWORD-for-Structure-table-maximum-size-in-SMBIOS.patch
Patch11: 0011-dmidecode-Hide-irrelevant-fixup-message.patch
BuildRequires: automake autoconf
ExclusiveArch: %{ix86} x86_64 ia64 aarch64
@ -43,6 +44,7 @@ I/O ports (e.g. serial, parallel, USB).
%patch8 -p1 -b .read_file
%patch9 -p1 -b .sysfs_entry_check
%patch10 -p1 -b .dword
%patch11 -p1 -b .hide_fixup_msg
%build
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"
@ -63,6 +65,10 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install-
%{_mandir}/man8/*
%changelog
* Mon May 30 2016 Anton Arapov <arapov@gmail.com> - 1:3.0-3
- Hide irrelevant fixup message
- patched up to commit cff11afa886
* Tue Feb 02 2016 Anton Arapov <arapov@gmail.com> - 1:3.0-2
- Use DWORD for Structure table maximum size in SMBIOS3
- patched up to commit ab02b117511