[PATCH 2/2] sandbox: hostfile: fix UB-inducing shift

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

 



On 32-bit hosts, UBSan reports:

====================================================================
UBSAN: Undefined behaviour in ./arch/sandbox/board/hostfile.c:135:12
shift exponent 32 is too large for 32-bit type 'long unsigned int'
====================================================================

Fix this by using a unsigned long long for base. The upper 32-bit
won't be set, but device tree fixups can now read them.

Signed-off-by: Ahmad Fatoum <ahmad@xxxxxx>
---
 arch/sandbox/mach-sandbox/include/mach/hostfile.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/mach-sandbox/include/mach/hostfile.h b/arch/sandbox/mach-sandbox/include/mach/hostfile.h
index 627fe28e765b..54f690be5f7f 100644
--- a/arch/sandbox/mach-sandbox/include/mach/hostfile.h
+++ b/arch/sandbox/mach-sandbox/include/mach/hostfile.h
@@ -3,7 +3,7 @@
 
 struct hf_info {
 	int fd;
-	unsigned long base;
+	unsigned long long base;
 	size_t size;
 	const char *devname;
 	const char *filename;
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux