Blame SOURCES/0001-dmidecode-Hide-irrelevant-fixup-message.patch

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