Blame SOURCES/0007-dmidecode-Move-type-42-warning-messages-to-stderr.patch

f877e3
From 30121a064378b2c0174659cd52449c70aa2c271f Mon Sep 17 00:00:00 2001
f877e3
From: Jean Delvare <jdelvare@suse.de>
f877e3
Date: Mon, 23 Mar 2020 16:47:40 +0100
f877e3
Subject: [PATCH 07/23] dmidecode: Move type 42 warning messages to stderr
f877e3
f877e3
Write warning messages about invalid type 42 structures to stderr as
f877e3
we do for all other warning messages.
f877e3
f877e3
Also include the handle and record numbers in these warning messages
f877e3
to make the problem easier to analyze.
f877e3
f877e3
Signed-off-by: Jean Delvare <jdelvare@suse.de>
f877e3
---
f877e3
 dmidecode.c | 10 ++++++----
f877e3
 1 file changed, 6 insertions(+), 4 deletions(-)
f877e3
f877e3
diff --git a/dmidecode.c b/dmidecode.c
f877e3
index fc140e7e36a9..50fd0bffa26d 100644
f877e3
--- a/dmidecode.c
f877e3
+++ b/dmidecode.c
f877e3
@@ -3780,8 +3780,9 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
f877e3
 	total_read++;
f877e3
 	if (total_read > h->length)
f877e3
 	{
f877e3
-		printf("%s\tWARN: Total read length %d exceeds total structure length %d\n",
f877e3
-			prefix, total_read, h->length);
f877e3
+		fprintf(stderr,
f877e3
+			"Total read length %d exceeds total structure length %d (handle 0x%04hx)\n",
f877e3
+			total_read, h->length, h->handle);
f877e3
 		return;
f877e3
 	}
f877e3
 
f877e3
@@ -3801,8 +3802,9 @@ static void dmi_parse_controller_structure(const struct dmi_header *h,
f877e3
 			total_read += rec[1] + 2;
f877e3
 			if (total_read > h->length)
f877e3
 			{
f877e3
-				printf("%s\tWARN: Total read length %d exceeds total structure length %d\n",
f877e3
-					prefix, total_read, h->length);
f877e3
+				fprintf(stderr,
f877e3
+					"Total read length %d exceeds total structure length %d (handle 0x%04hx, record %d)\n",
f877e3
+					total_read, h->length, h->handle, i + 1);
f877e3
 				return;
f877e3
 			}
f877e3
 
f877e3
-- 
f877e3
2.17.1
f877e3