Blame SOURCES/0048-Fix-getting-size-of-memory-banks-32GiB.patch

121cca
From 74e23540335254b8fca6a81cc891c52d96937d40 Mon Sep 17 00:00:00 2001
121cca
From: Lyonel Vincent <lyonel@ezix.org>
121cca
Date: Thu, 29 Apr 2021 16:40:37 +0200
121cca
Subject: [PATCH 48/65] Fix getting size of memory banks <32GiB
121cca
121cca
PR65 on Github (thanks to Z.Bitter)
121cca
121cca
Due to a regression introduced by 8ff1efb, no size was recorded for memory banks <32GiB in size on systems with an SMBIOS version of 2.7 or later. On these systems the Type 17 size field from SMBIOS was only recorded if the extended size field was used.
121cca
121cca
Modify the code to use the regular size field whenever it is valid (not 0xFFFF) and not set to 0x7FFF on versions >2.7 (indicating the extended size field is in use).
121cca
---
121cca
 src/core/dmi.cc | 15 +++++++--------
121cca
 1 file changed, 7 insertions(+), 8 deletions(-)
121cca
121cca
diff --git a/src/core/dmi.cc b/src/core/dmi.cc
121cca
index fe6ad39..96b6506 100644
121cca
--- a/src/core/dmi.cc
121cca
+++ b/src/core/dmi.cc
121cca
@@ -1567,15 +1567,14 @@ int dmiversionrev)
121cca
 
121cca
 // size
121cca
           u = data[0x0D] << 8 | data[0x0C];
121cca
-          if ((dmiversionmaj > 2)
121cca
-            || ((dmiversionmaj == 2) && (dmiversionmin >= 7))) {
121cca
-             if(u == 0x7FFF) {
121cca
-                unsigned long long extendsize = (data[0x1F] << 24) | (data[0x1E] << 16) | (data[0x1D] << 8) | data[0x1C];
121cca
-                extendsize &= 0x7FFFFFFFUL;
121cca
-                size = extendsize * 1024ULL * 1024ULL;
121cca
-             }
121cca
+          if (((dmiversionmaj > 2)
121cca
+            || ((dmiversionmaj == 2) && (dmiversionmin >= 7)))
121cca
+            && u == 0x7FFF) {
121cca
+              unsigned long long extendsize = (data[0x1F] << 24) | (data[0x1E] << 16) | (data[0x1D] << 8) | data[0x1C];
121cca
+              extendsize &= 0x7FFFFFFFUL;
121cca
+              size = extendsize * 1024ULL * 1024ULL;
121cca
           }
121cca
-	  else
121cca
+          else
121cca
           if (u != 0xFFFF)
121cca
             size = (1024ULL * (u & 0x7FFF) * ((u & 0x8000) ? 1 : 1024ULL));
121cca
           description += string(dmi_memory_device_form_factor(data[0x0E]));
121cca
-- 
121cca
2.33.1
121cca