Skip to contentSkip to conversation

lib: aes: build failure with DEBUG=1

PATCH New Heinrich Schuchardt 3 participants 3 messages Dec 28, 2020 – Jan 18, 2021 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: aes: build failure with DEBUG=1

Building fails with DEBUG=1:

lib/aes.c: In function ?debug_print_vector?:
lib/aes.c:622:45: error:
cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
622 | printf("%s [%d] @0x%08x", name, num_bytes, (u32)data);

Pointers can only be cast to (uintptr_t). But anyway we have %p for printing pointers.

---
 lib/aes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/aes.c +1 -1
index c998aecb3c..05ec235702 100644
@@ -619,7 +619,7 @@ void aes_decrypt(u32 key_len, u8 *in, u8 *expkey, u8 *out)
 static void debug_print_vector(char *name, u32 num_bytes, u8 *data)
 {
 #ifdef DEBUG
-	printf("%s [%d] @0x%08x", name, num_bytes, (u32)data);
+	printf("%s [%d] @0x%p", name, num_bytes, data);
 	print_buffer(0, data, 1, num_bytes, 16);
 #endif
 }

--
2.29.2

#1 lore raw

PATCH 1/1 lib: aes: build failure with DEBUG=1

Quoted 9 lines · Heinrich Schuchardt

Building fails with DEBUG=1:

lib/aes.c: In function ?debug_print_vector?:
lib/aes.c:622:45: error:
cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
622 | printf("%s [%d] @0x%08x", name, num_bytes, (u32)data);

Quoted 7 lines

Pointers can only be cast to (uintptr_t). But anyway we have %p for printing pointers.

---
 lib/aes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw

PATCH 1/1 lib: aes: build failure with DEBUG=1

In reply to Heinrich Schuchardt
Quoted 8 lines · Heinrich Schuchardt

Building fails with DEBUG=1:

lib/aes.c: In function ?debug_print_vector?:
lib/aes.c:622:45: error:
cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
622 | printf("%s [%d] @0x%08x", name, num_bytes, (u32)data);

Quoted 5 lines

Pointers can only be cast to (uintptr_t). But anyway we have %p for printing pointers.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210118/f468a2df/attachment.sig>