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

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