diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-04-10 20:37:51 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-04-10 20:37:51 +0300 |
| commit | 4c6be9cb63ff66ce49a6f733c1e00d1889f2c95f (patch) | |
| tree | 898854069101e6616620e2bd732a48e5eca08fd2 /include/libfdt.h | |
| parent | 8aa17b12f29536ea9c8b6ca22c7f153e8d90fa3b (diff) | |
| download | kmi-4c6be9cb63ff66ce49a6f733c1e00d1889f2c95f.tar.gz kmi-4c6be9cb63ff66ce49a6f733c1e00d1889f2c95f.zip | |
add basic ubsan and fix issues reported by it
Diffstat (limited to 'include/libfdt.h')
| -rw-r--r-- | include/libfdt.h | 5 |
1 files changed, 3 insertions, 2 deletions
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 <apos/unaligned.h> #include <apos/types.h> /* 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 |
