Skip to content

Commit 8427888

Browse files
committed
dmidecode: Use the right variable for -s bios-revision/firmware-revision
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> Tested-by: Jerry Hoemann <jerry.hoemann@hpe.com>
1 parent 6ca381c commit 8427888

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dmidecode.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5386,12 +5386,12 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
53865386
switch (key)
53875387
{
53885388
case 0x015: /* -s bios-revision */
5389-
if (data[key - 1] != 0xFF && data[key] != 0xFF)
5390-
printf("%u.%u\n", data[key - 1], data[key]);
5389+
if (data[offset - 1] != 0xFF && data[offset] != 0xFF)
5390+
printf("%u.%u\n", data[offset - 1], data[offset]);
53915391
break;
53925392
case 0x017: /* -s firmware-revision */
5393-
if (data[key - 1] != 0xFF && data[key] != 0xFF)
5394-
printf("%u.%u\n", data[key - 1], data[key]);
5393+
if (data[offset - 1] != 0xFF && data[offset] != 0xFF)
5394+
printf("%u.%u\n", data[offset - 1], data[offset]);
53955395
break;
53965396
case 0x108:
53975397
dmi_system_uuid(NULL, NULL, data + offset, ver);

0 commit comments

Comments
 (0)