Rebase upstream 3.5

Resolves: RHEL-15487
Resolves: RHEL-16484

Signed-off-by: Lichen Liu <lichliu@redhat.com>
This commit is contained in:
Lichen Liu 2023-12-20 13:56:13 +08:00
parent cf4139583b
commit 715b44b516
4 changed files with 72 additions and 12 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
SOURCES/dmidecode-3.3.tar.xz SOURCES/dmidecode-3.3.tar.xz
/dmidecode-3.3.tar.xz /dmidecode-3.3.tar.xz
/dmidecode-3.5.tar.xz

View File

@ -0,0 +1,64 @@
From c76ddda0ba0aa99a55945e3290095c2ec493c892 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Wed, 26 Apr 2023 15:44:27 +0200
Subject: [PATCH] Consistently use read_file() when reading from a dump file
Use read_file() instead of mem_chunk() to read the entry point from a
dump file. This is faster, and consistent with how we then read the
actual DMI table from that dump file.
This made no functional difference so far, which is why it went
unnoticed for years. But now that a file type check was added to the
mem_chunk() function, we must stop using it to read from regular
files.
This will again allow root to use the --from-dump option.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
dmidecode.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index 54f59c1..52ddbf1 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -6025,17 +6025,25 @@ int main(int argc, char * const argv[])
pr_comment("dmidecode %s", VERSION);
/* Read from dump if so instructed */
+ size = 0x20;
if (opt.flags & FLAG_FROM_DUMP)
{
if (!(opt.flags & FLAG_QUIET))
pr_info("Reading SMBIOS/DMI data from file %s.",
opt.dumpfile);
- if ((buf = mem_chunk(0, 0x20, opt.dumpfile)) == NULL)
+ if ((buf = read_file(0, &size, opt.dumpfile)) == NULL)
{
ret = 1;
goto exit_free;
}
+ /* Truncated entry point can't be processed */
+ if (size < 0x20)
+ {
+ ret = 1;
+ goto done;
+ }
+
if (memcmp(buf, "_SM3_", 5) == 0)
{
if (smbios3_decode(buf, opt.dumpfile, 0))
@@ -6059,7 +6067,6 @@ int main(int argc, char * const argv[])
* contain one of several types of entry points, so read enough for
* the largest one, then determine what type it contains.
*/
- size = 0x20;
if (!(opt.flags & FLAG_NO_SYSFS)
&& (buf = read_file(0, &size, SYS_ENTRY_FILE)) != NULL)
{
--
2.43.0

View File

@ -1,22 +1,13 @@
Summary: Tool to analyse BIOS DMI data Summary: Tool to analyse BIOS DMI data
Name: dmidecode Name: dmidecode
Version: 3.3 Version: 3.5
Release: 5%{?dist} Release: 1%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2+ License: GPLv2+
Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz
URL: http://www.nongnu.org/dmidecode/ URL: http://www.nongnu.org/dmidecode/
Patch0: 0001-dmidecode-Add-new-system-slot-types-from-SMBIOS-spec.patch Patch0: 0001-Consistently-use-read_file-when-reading-from-a-dump-.patch
Patch1: 0002-dmidecode-Add-new-processor-characteristics-bits-from-SMBIOS-s.patch
Patch2: 0003-dmidecode-Missing-comma-in-the-dmi_slot_type.patch
Patch3: 0004-dmidecode-Skip-details-of-uninstalled-memory-modules.patch
Patch4: 0005-dmidecode-Add-new-processor-upgrades-from-SMBIOS-spec-3.4.0.patch
Patch5: 0006-dmidecode-Add-new-memory-device-types-from-SMBIOS-spec-3.4.0.patch
Patch6: 0007-dmidecode-Fix-crash-with-u-option.patch
Patch7: 0008-dmidecode-Split-table-fetching-from-decoding.patch
Patch8: 0009-dmidecode-Write-the-whole-dump-file-at-once.patch
Patch9: 0010-dmidecode-Do-not-let-dump-bin-overwrite-an-existing-.patch
BuildRequires: gcc make BuildRequires: gcc make
ExclusiveArch: %{ix86} x86_64 ia64 aarch64 ExclusiveArch: %{ix86} x86_64 ia64 aarch64
@ -54,6 +45,9 @@ make %{?_smp_mflags} DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install-
%{_mandir}/man8/* %{_mandir}/man8/*
%changelog %changelog
* Wed Dec 20 2023 Lichen Liu <lichliu@redhat.com> - 1:3.5-1
- Rebase to upstream 3.5
* Thu Jun 08 2023 Lichen Liu <lichliu@redhat.com> - 1:3.3-5 * Thu Jun 08 2023 Lichen Liu <lichliu@redhat.com> - 1:3.3-5
- Resolves: rhbz#2186860 - Resolves: rhbz#2186860

View File

@ -1 +1,2 @@
SHA512 (dmidecode-3.3.tar.xz) = dc77f40a7898011cea1b747d4677be2fbe8f52ec6ac460a5656de2f3389eca83bc416d6494acbe759971b5afce37b78f21ab55c34d62b1105b800e31566d1d22 SHA512 (dmidecode-3.3.tar.xz) = dc77f40a7898011cea1b747d4677be2fbe8f52ec6ac460a5656de2f3389eca83bc416d6494acbe759971b5afce37b78f21ab55c34d62b1105b800e31566d1d22
SHA512 (dmidecode-3.5.tar.xz) = 690c9bea391f6bbfc8cd48e8db408a61d5b551a07a2823c29d03a09607fc2043cc1bea44ee9fd27fd0e7bc0b287bf9de9f22a1a66053f5b1e63d77c03d93e1ae