sh: 16-bit get_unaligned() sh4a fix
PATCH 1/1 sh: 16-bit get_unaligned() sh4a fix
From: Magnus Damm <[email protected]>
This patch fixes the 16-bit case of the sh4a specific unaligned access implementation. Without this patch the 16-bit version of sh4a get_unaligned() results in a 32-bit read which may read more data than intended and/or cross page boundaries.
Signed-off-by Magnus Damm <[email protected]>
---
Unbreaks mtd NOR write handling on Migo-R.
arch/sh/include/asm/unaligned-sh4a.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/sh/include/asm/unaligned-sh4a.h +2 -2
@@ -41,9 +41,9 @@ struct __una_u64 { u64 x __attribute__((static inline u16 __get_unaligned_cpu16 (const u8 *p) {#ifdef __LITTLE_ENDIAN -return __get_unaligned_cpu32 (p) &0xffff ; +return p[0 ] | (p[1 ] <<8 );#else -return __get_unaligned_cpu32 (p) >>16 ; +return (p[0 ] <<8 ) | p[1 ];#endif }