+ byteorder-sanity-check-toolchain-vs-kernel-endianess.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: byteorder: sanity check toolchain vs kernel endianess
has been added to the -mm tree.  Its filename is
     byteorder-sanity-check-toolchain-vs-kernel-endianess.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/byteorder-sanity-check-toolchain-vs-kernel-endianess.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/byteorder-sanity-check-toolchain-vs-kernel-endianess.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Christoph Hellwig <hch@xxxxxx>
Subject: byteorder: sanity check toolchain vs kernel endianess

When removing some dead big endian checks in the RISC-V code Nick
suggested that we should have some generic sanity checks.  I don't think
we should have thos inside the RISC-V code, but maybe it might make sense
to have these in the generic byteorder headers.  Note that these are UAPI
headers and some compilers might not actually define __BYTE_ORDER__, so we
first check that it actually exists.

Link: http://lkml.kernel.org/r/20190412143538.11780-1-hch@xxxxxx
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Suggested-by: Nick Kossifidis <mick@xxxxxxxxxxxx>
Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/uapi/linux/byteorder/big_endian.h    |    4 ++++
 include/uapi/linux/byteorder/little_endian.h |    4 ++++
 2 files changed, 8 insertions(+)

--- a/include/uapi/linux/byteorder/big_endian.h~byteorder-sanity-check-toolchain-vs-kernel-endianess
+++ a/include/uapi/linux/byteorder/big_endian.h
@@ -2,6 +2,10 @@
 #ifndef _UAPI_LINUX_BYTEORDER_BIG_ENDIAN_H
 #define _UAPI_LINUX_BYTEORDER_BIG_ENDIAN_H
 
+#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
+#error "Unsupported endianess, check your toolchain"
+#endif
+
 #ifndef __BIG_ENDIAN
 #define __BIG_ENDIAN 4321
 #endif
--- a/include/uapi/linux/byteorder/little_endian.h~byteorder-sanity-check-toolchain-vs-kernel-endianess
+++ a/include/uapi/linux/byteorder/little_endian.h
@@ -2,6 +2,10 @@
 #ifndef _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H
 #define _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H
 
+#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ !=  __ORDER_LITTLE_ENDIAN__
+#error "Unsupported endianess, check your toolchain"
+#endif
+
 #ifndef __LITTLE_ENDIAN
 #define __LITTLE_ENDIAN 1234
 #endif
_

Patches currently in -mm which might be from hch@xxxxxx are

initramfs-free-initrd-memory-if-opening-initrdimage-fails.patch
initramfs-cleanup-initrd-freeing.patch
initramfs-factor-out-a-helper-to-populate-the-initrd-image.patch
initramfs-cleanup-populate_rootfs.patch
initramfs-move-the-legacy-keepinitrd-parameter-to-core-code.patch
initramfs-proide-a-generic-free_initrd_mem-implementation.patch
initramfs-poison-freed-initrd-memory.patch
byteorder-sanity-check-toolchain-vs-kernel-endianess.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux