kmodloader: fix endianess check
authorHans Dedecker <dedeckeh@gmail.com>
Wed, 30 Aug 2017 13:23:58 +0000 (15:23 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Wed, 30 Aug 2017 17:12:51 +0000 (19:12 +0200)
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 <dedeckeh@gmail.com>
Acked-by: John Crispin <john@phrozen.org>
kmodloader.c

index a6aa795a81d495d37911ea16d41c7c211dc231af..a4d492d42348c2fe3c08e3ed02df0e297ba61c93 100644 (file)
@@ -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"