summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2023-03-10 15:12:48 +0100
committerJean Delvare <jdelvare@suse.de>2023-03-10 15:15:03 +0100
commit8427888ccf068f2ae1105e0c9276a15191a16ee5 (patch)
treeafe79a3afa9d0a8ea542a3de929ded7ae55cc708
parent6ca381c1247c81f74e1ca4e7706f70bdda72e6f2 (diff)
downloaddmidecode-git-8427888ccf068f2ae1105e0c9276a15191a16ee5.tar.gz
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>
-rw-r--r--dmidecode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/dmidecode.c b/dmidecode.c
index 82efa2d..54f59c1 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -5386,12 +5386,12 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
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);