Blame SOURCES/0002-Fix-wrong-DMI-structures-count.patch

0235d0
From 5643ecc7530489bf0875c4fe96031671b3cda435 Mon Sep 17 00:00:00 2001
0235d0
From: Lichen Liu <lichliu@redhat.com>
0235d0
Date: Fri, 17 Feb 2023 11:09:05 +0800
0235d0
Subject: [PATCH] Fix wrong DMI structures count
0235d0
0235d0
SMBIOS v3 64-bit entry points do not announce a structures count,
0235d0
and only indicate a maximum size for the table.
0235d0
0235d0
Remove debug log.
0235d0
0235d0
Signed-off-by: Lichen Liu <lichliu@redhat.com>
0235d0
---
0235d0
 src/dmidecode.c | 10 +++++++---
0235d0
 src/efi.c       |  4 ----
0235d0
 2 files changed, 7 insertions(+), 7 deletions(-)
0235d0
0235d0
diff --git a/src/dmidecode.c b/src/dmidecode.c
0235d0
index d1a10c1..a013c53 100644
0235d0
--- a/src/dmidecode.c
0235d0
+++ b/src/dmidecode.c
0235d0
@@ -6241,13 +6241,17 @@ static void dmi_table(Log_t *logp, int type, u32 base, u32 len, u16 num, u32 ver
0235d0
                 dmixml_AddAttribute(handle_n, "type", "%i", type);
0235d0
                 dmixml_AddAttribute(handle_n, "notfound", "1");
0235d0
         }
0235d0
-
0235d0
-        if(i != num) {
0235d0
+	/*
0235d0
+	 * SMBIOS v3 64-bit entry points do not announce a structures count,
0235d0
+	 * and only indicate a maximum size for the table.
0235d0
+	 */
0235d0
+        if(num && i != num) {
0235d0
                 log_append(logp, LOGFL_NODUPS, LOG_WARNING,
0235d0
                            "Wrong DMI structures count: %d announced, only %d decoded.", num, i);
0235d0
         }
0235d0
 
0235d0
-        if(data - buf != len) {
0235d0
+        if((unsigned long)(data - buf) > len
0235d0
+		 || (num && (unsigned long)(data - buf) < len)) {
0235d0
                 log_append(logp, LOGFL_NODUPS, LOG_WARNING,
0235d0
                         "Wrong DMI structures length: %d bytes announced, structures occupy %d bytes.",
0235d0
                         len, (unsigned int)(data - buf));
0235d0
diff --git a/src/efi.c b/src/efi.c
0235d0
index e519257..362e2f9 100644
0235d0
--- a/src/efi.c
0235d0
+++ b/src/efi.c
0235d0
@@ -83,10 +83,6 @@ int address_from_efi(Log_t *logp, size_t * address)
0235d0
                 log_append(logp, LOGFL_NODUPS, LOG_WARNING, "%s: SMBIOS entry point missing", filename);
0235d0
         }
0235d0
 
0235d0
-        if(ret == 0){
0235d0
-                log_append(logp, LOGFL_NODUPS, LOG_DEBUG, "%s: entry point at 0x%08llx", eptype, (unsigned long long)*address);
0235d0
-        }
0235d0
-
0235d0
         return ret;
0235d0
 }
0235d0
 
0235d0
-- 
0235d0
2.39.1
0235d0