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