From patchwork Thu Jun 4 09:44:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 27853 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n549mHeP029026 for ; Thu, 4 Jun 2009 09:48:18 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750885AbZFDJsO (ORCPT ); Thu, 4 Jun 2009 05:48:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751107AbZFDJsO (ORCPT ); Thu, 4 Jun 2009 05:48:14 -0400 Received: from rv-out-0506.google.com ([209.85.198.229]:12736 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750885AbZFDJsN (ORCPT ); Thu, 4 Jun 2009 05:48:13 -0400 Received: by rv-out-0506.google.com with SMTP id k40so290516rvb.39 for ; Thu, 04 Jun 2009 02:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=AvrqN8ZVwrLBfdsX1RF0t5W0wIHvrPOxlQsCHUFnYRs=; b=tBHoLYmO20o1r3d9Yghlrhh+8AzMcRcNhbnFnn4maCpxKdTykLWN+Oa2MNWtEdsX8+ JYwn6KdFhaROafMZFwazMcdp39tl4zRjJVphXtLQJw+PtKnUJzx+mBeGW3bzInY8pnki E2AADBYEop4mOPHcdYYVhsz1gBQvkO1X11PQQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=YB72P/H+DKJwZYIRjSp18SQgVgc5nkbkdgyZ8enOXY3zvgBAzFezoHxAFJJOghSjV7 FxPeN6kJCZ3ZMV34C7Z7oK9kqKe9S85pb1J2D8Oi6TdbXhuA6CjfwTzeZ8zuLjYQA8MB KJPWWN9BxM+BcmRAqePx7RkYqVlC6JDqeeMj0= Received: by 10.140.144.6 with SMTP id r6mr1776790rvd.185.1244108891006; Thu, 04 Jun 2009 02:48:11 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id c20sm27218602rvf.30.2009.06.04.02.48.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 04 Jun 2009 02:48:10 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Thu, 04 Jun 2009 18:44:55 +0900 Message-Id: <20090604094455.6479.7665.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh: 16-bit get_unaligned() sh4a fix Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm 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 --- Unbreaks mtd NOR write handling on Migo-R. arch/sh/include/asm/unaligned-sh4a.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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 }