From 4c6be9cb63ff66ce49a6f733c1e00d1889f2c95f Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 10 Apr 2022 20:37:51 +0300 Subject: add basic ubsan and fix issues reported by it --- include/libfdt.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/libfdt.h') diff --git a/include/libfdt.h b/include/libfdt.h index b59d6e4..ffe979d 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -1,6 +1,7 @@ #ifndef APOS_LIBFDT_H #define APOS_LIBFDT_H #include "../dtc/libfdt/libfdt.h" +#include #include /* apos additions, implementation can be found in common/fdt.c */ @@ -20,7 +21,7 @@ void __dbg_fdt(const void *fdt, int node_offset, int depth); #endif #define fdt_load_int_ptr(c, p) \ - ((c) == 2 ? fdt64_to_cpu(*(fdt64_t *)(p)) : \ - fdt32_to_cpu(*(fdt32_t *)(p))) + ((c) == 2 ? fdt64_to_cpu(get_unaligned((uint64_t *)p)) : \ + fdt32_to_cpu(get_unaligned((uint32_t *)p))) #endif -- cgit v1.3