[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] dmidecode: Use the right variable for -s bios-revision/firmw
From: |
Jerry Hoemann |
Subject: |
Re: [PATCH] dmidecode: Use the right variable for -s bios-revision/firmware-revision |
Date: |
Mon, 6 Mar 2023 10:50:45 -0700 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Sun, Mar 05, 2023 at 05:32:17PM +0100, Jean Delvare wrote:
> It turns out that variables "offset" and "key" have the same value
> for these lines of code, so there is no actual bug, nevertheless
> using the right variable makes the code more obviously correct, and
> less prone to introduce a bug later when adding support for new
> strings.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> ---
> dmidecode.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Verified that output of:
dmidecode -s bios-revision --from-dump $i;
dmidecode -s firmware-revision --from-dump $i;
Was same w/ or w/o the patch across my saved platforms.
Tested-by: Jerry Hoemann <jerry.hoemann@hpe.com>
> --- dmidecode.orig/dmidecode.c
> +++ dmidecode/dmidecode.c
> @@ -5386,12 +5386,12 @@ static void dmi_table_string(const struc
> switch (key)
> {
> case 0x015: /* -s bios-revision */
> - if (data[key - 1] != 0xFF && data[key] != 0xFF)
> - printf("%u.%u\n", data[key - 1], data[key]);
> + if (data[offset - 1] != 0xFF && data[offset] != 0xFF)
> + printf("%u.%u\n", data[offset - 1],
> data[offset]);
> break;
> case 0x017: /* -s firmware-revision */
> - if (data[key - 1] != 0xFF && data[key] != 0xFF)
> - printf("%u.%u\n", data[key - 1], data[key]);
> + if (data[offset - 1] != 0xFF && data[offset] != 0xFF)
> + printf("%u.%u\n", data[offset - 1],
> data[offset]);
> break;
> case 0x108:
> dmi_system_uuid(NULL, NULL, data + offset, ver);
>
>
> --
> Jean Delvare
> SUSE L3 Support
--
-----------------------------------------------------------------------------
Jerry Hoemann Software Engineer Hewlett Packard Enterprise
-----------------------------------------------------------------------------