From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: 16-bit get_unaligned() sh4a fix
Date: Thu, 04 Jun 2009 09:44:55 +0000 [thread overview]
Message-ID: <20090604094455.6479.7665.sendpatchset@rx1.opensource.se> (raw)
From: Magnus Damm <damm@igel.co.jp>
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 <damm@igel.co.jp>
---
Unbreaks mtd NOR write handling on Migo-R.
arch/sh/include/asm/unaligned-sh4a.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- 0001/arch/sh/include/asm/unaligned-sh4a.h
+++ work/arch/sh/include/asm/unaligned-sh4a.h 2009-06-04 18:36:15.000000000 +0900
@@ -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
}
reply other threads:[~2009-06-04 9:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090604094455.6479.7665.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.