dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] dmioem: HPE type 242: Fix ID on 32-bit systems


From: Jean Delvare
Subject: [PATCH] dmioem: HPE type 242: Fix ID on 32-bit systems
Date: Fri, 24 Feb 2023 10:05:55 +0100

I noticed that the reported ID is different when building dmidecode
in 32-bit mode. The reason is that %lx isn't a valid format to print
a 64-bit integer. It works by accident on 64-bit systems because
types "long integer" and "long long integer" are the same there, but
on 32-bit systems, only the latter can actually store a 64-bit value.

Change the format to %llx so that it works on 32-bit systems too.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Fixes: 90d1323a8d14 ("dmioem: Decode HPE OEM Record 242")
Cc: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 dmioem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- dmidecode.orig/dmioem.c
+++ dmidecode/dmioem.c
@@ -1230,7 +1230,7 @@ static int dmi_decode_hp(const struct dm
                        if (!(opt.flags & FLAG_QUIET))
                                pr_attr("Associated Handle", "0x%04X", 
WORD(data + 0x4));
                        dmi_hp_242_hdd_type(data[0x06]);
-                       pr_attr("ID", "%lx", QWORD(data + 0x07));
+                       pr_attr("ID", "%llx", QWORD(data + 0x07));
                        if (h->length < 0x3E)
                                pr_attr("Capacity", "%u MB", DWORD(data + 
0x0F));
                        else


-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]