[PATCH] uefi: uefirtvariable: use sizeof() for finding the bit size of long integer
Keng-Yu Lin
kengyu at canonical.com
Thu Dec 20 15:52:44 UTC 2012
The size of long integer can vary on different architectures.
The patch uses sizeof() to find the bit size of the long integer rather than
a fixed value.
This also matches the definition in Linux kernel's efi.h.
Signed-off-by: Keng-Yu Lin <kengyu at canonical.com>
---
src/uefi/uefirtvariable/uefirtvariable.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c
index 1599c5b..0459160 100644
--- a/src/uefi/uefirtvariable/uefirtvariable.c
+++ b/src/uefi/uefirtvariable/uefirtvariable.c
@@ -40,8 +40,10 @@
0xDD, 0xB7, 0x11, 0xD0, 0x6E} \
}
+#define BITS_PER_LONG (sizeof(long) * 8)
+
#define EFI_SUCCESS 0
-#define EFI_NOT_FOUND (14 | (1UL << 63))
+#define EFI_NOT_FOUND (14 | (1UL << (BITS_PER_LONG-1)))
#define MAX_DATA_LENGTH 1024
--
1.7.9.5
More information about the fwts-devel
mailing list