Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Make unaligned accesses endian-safe for powerpc

The generic put_unaligned/get_unaligned macros were made endian-safe by
calling the appropriate endian dependent macros based on the endian type
of the powerpc processor.

Signed-off-by: Rajesh B Prathipati <rprathip@linux.vnet.ibm.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Rajesh B Prathipati and committed by
Benjamin Herrenschmidt
e8a00ad5 90ff5d68

+6 -1
+6 -1
arch/powerpc/include/asm/unaligned.h
··· 4 4 #ifdef __KERNEL__ 5 5 6 6 /* 7 - * The PowerPC can do unaligned accesses itself in big endian mode. 7 + * The PowerPC can do unaligned accesses itself based on its endian mode. 8 8 */ 9 9 #include <linux/unaligned/access_ok.h> 10 10 #include <linux/unaligned/generic.h> 11 11 12 + #ifdef __LITTLE_ENDIAN__ 13 + #define get_unaligned __get_unaligned_le 14 + #define put_unaligned __put_unaligned_le 15 + #else 12 16 #define get_unaligned __get_unaligned_be 13 17 #define put_unaligned __put_unaligned_be 18 + #endif 14 19 15 20 #endif /* __KERNEL__ */ 16 21 #endif /* _ASM_POWERPC_UNALIGNED_H */