diff --git a/SOURCES/0001-Fix-getting-size-of-memory-banks-32GiB.patch b/SOURCES/0001-Fix-getting-size-of-memory-banks-32GiB.patch new file mode 100644 index 0000000..e517632 --- /dev/null +++ b/SOURCES/0001-Fix-getting-size-of-memory-banks-32GiB.patch @@ -0,0 +1,44 @@ +From 74e23540335254b8fca6a81cc891c52d96937d40 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Thu, 29 Apr 2021 16:40:37 +0200 +Subject: [PATCH] Fix getting size of memory banks <32GiB + +PR65 on Github (thanks to Z.Bitter) + +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. + +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). +--- + src/core/dmi.cc | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +diff --git a/src/core/dmi.cc b/src/core/dmi.cc +index fe6ad39..96b6506 100644 +--- a/src/core/dmi.cc ++++ b/src/core/dmi.cc +@@ -1567,15 +1567,14 @@ int dmiversionrev) + + // size + u = data[0x0D] << 8 | data[0x0C]; +- if ((dmiversionmaj > 2) +- || ((dmiversionmaj == 2) && (dmiversionmin >= 7))) { +- if(u == 0x7FFF) { +- unsigned long long extendsize = (data[0x1F] << 24) | (data[0x1E] << 16) | (data[0x1D] << 8) | data[0x1C]; +- extendsize &= 0x7FFFFFFFUL; +- size = extendsize * 1024ULL * 1024ULL; +- } ++ if (((dmiversionmaj > 2) ++ || ((dmiversionmaj == 2) && (dmiversionmin >= 7))) ++ && u == 0x7FFF) { ++ unsigned long long extendsize = (data[0x1F] << 24) | (data[0x1E] << 16) | (data[0x1D] << 8) | data[0x1C]; ++ extendsize &= 0x7FFFFFFFUL; ++ size = extendsize * 1024ULL * 1024ULL; + } +- else ++ else + if (u != 0xFFFF) + size = (1024ULL * (u & 0x7FFF) * ((u & 0x8000) ? 1 : 1024ULL)); + description += string(dmi_memory_device_form_factor(data[0x0E])); +-- +2.29.2 + diff --git a/SPECS/lshw.spec b/SPECS/lshw.spec index 10fe40c..59d171c 100644 --- a/SPECS/lshw.spec +++ b/SPECS/lshw.spec @@ -1,7 +1,7 @@ Summary: Hardware lister Name: lshw Version: B.02.19.2 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2 Group: Applications/System URL: http://ezix.org/project/wiki/HardwareLiSter @@ -48,6 +48,7 @@ Patch39: 0018-fix-man-page-after-previous-update.patch Patch40: rhelonly-cleanup-remove-unused-support.c-support.h-generated-.patch Patch41: 0001-Report-correct-memory-size-on-SMBIOS-2.7.patch Patch42: 0001-devtree-Add-UUID-property.patch +Patch43: 0001-Fix-getting-size-of-memory-banks-32GiB.patch BuildRequires: cmake BuildRequires: desktop-file-utils @@ -125,6 +126,7 @@ format. %patch40 -p1 %patch41 -p1 %patch42 -p1 +%patch43 -p1 %build mkdir build && pushd build @@ -172,6 +174,9 @@ src/lshw -json \ %{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy %changelog +* Tue Jun 08 2021 Tao Liu - B.02.19.2-6 +- Fix getting size of memory banks <32GiB + * Tue Feb 02 2021 Lianbo Jiang - B.02.19.2-5 - Fix the wrong memory information in azure m or mv2 series - Add UUID property to PowerVM LPAR