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 <jdelv...@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.hoem...@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 -----------------------------------------------------------------------------