From 9cb63df9b905e735c718d582b1d65cdff383cbd3 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Wed, 30 Aug 2017 15:23:58 +0200 Subject: [PATCH] kmodloader: fix endianess check Use __BYTE_ORDER macro to check system endianess as the macro's __LITTLE_ENDIAN, __BIG_ENDIAN are defined irrespective of the sytem endianess leading to an endianess check failure on big endian systems. Signed-off-by: Hans Dedecker Acked-by: John Crispin --- kmodloader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmodloader.c b/kmodloader.c index a6aa795..a4d492d 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -216,9 +216,9 @@ static int elf_find_section(char *map, const char *section, unsigned int *offset int clazz = map[EI_CLASS]; int endian = map[EI_DATA]; -#if defined(__LITTLE_ENDIAN) +#if __BYTE_ORDER == __LITTLE_ENDIAN if (endian != ELFDATA2LSB) -#elif defined(__BIG_ENDIAN) +#elif __BYTE_ORDER == __BIG_ENDIAN if (endian != ELFDATA2MSB) #else #error "unsupported endian" -- 2.25.1