On 08/30/2017 06:23 AM, Hans Dedecker wrote:
> 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.

Good catch, can you add a Fixes: tag for this?

> 
> Signed-off-by: Hans Dedecker <dedec...@gmail.com>
> ---
>  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"
> 


-- 
Florian

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to