From patchwork Mon Apr 21 18:10:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rabin Vincent X-Patchwork-Id: 4025871 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2109D9F1F4 for ; Mon, 21 Apr 2014 18:13:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 541F32021B for ; Mon, 21 Apr 2014 18:13:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7BA3C20219 for ; Mon, 21 Apr 2014 18:13:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WcIg1-0007l9-JH; Mon, 21 Apr 2014 18:10:45 +0000 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WcIfx-0007ZG-O6 for linux-arm-kernel@lists.infradead.org; Mon, 21 Apr 2014 18:10:42 +0000 Received: by mail-lb0-f175.google.com with SMTP id w7so3407077lbi.20 for ; Mon, 21 Apr 2014 11:10:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=TFC17f9Aru812NWBTVt0QrVQ1lPsNMkMM8Yz8dWnCZc=; b=A3ymYrsagPjvO+6hLJb2Yghc86fffzOV4KQBS3ydGcsuqhyZZzAsJ5zJG21Mx/UtI6 W7cXlrUF70wIm16FdguMRrp+msBq+tae5EKWRz8oBkRWYzovFH3Jca4mxbIIC4njLTyj dBIRBt1eAbayFCfqldXzoScUpPf5NIYp7m43T3p5BQJ06Xgcak721dbBbyqmhm010iFj 6FqqpSC/yn2m3WWwYNspr/M58kRIv1nEldFjcDMJlgGzNU7a2EsuEyha01qApp7srIfl 1coddedXKEsT0lMOQTkQkUZ/awn7SPUI1OGN6Qz++937GywGzRMl8pBLmJE1wg6HSsQK Nf1g== X-Received: by 10.112.28.82 with SMTP id z18mr24234798lbg.18.1398103819249; Mon, 21 Apr 2014 11:10:19 -0700 (PDT) Received: from localhost.localdomain (217-211-190-200-no39.tbcn.telia.com. [217.211.190.200]) by mx.google.com with ESMTPSA id oy7sm38093323lbb.16.2014.04.21.11.10.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Apr 2014 11:10:18 -0700 (PDT) From: Rabin Vincent To: Will Deacon Subject: [PATCH] ARM: fix string functions on !MMU Date: Mon, 21 Apr 2014 20:10:08 +0200 Message-Id: <1398103808-24380-1-git-send-email-rabin@rab.in> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140421_111041_967212_598E9212 X-CRM114-Status: GOOD ( 11.90 ) X-Spam-Score: 0.0 (/) Cc: Rabin Vincent , linux-arm-kernel@lists.infradead.org, u.kleine-koenig@pengutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 8c56cc8be5b38e ("ARM: 7449/1: use generic strnlen_user and strncpy_from_user functions") apparently broken those string operations for !MMU. USER_DS == KERNEL_DS on !MMU, so user_addr_max() always restricts the addresses to TASK_SIZE. TASK_SIZE has anyway no meaning on !MMU, so make user_addr_max() not restrict anything. Signed-off-by: Rabin Vincent --- arch/arm/include/asm/uaccess.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h index 12c3a5d..c3a65f1 100644 --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -199,6 +199,9 @@ extern int __put_user_8(void *, unsigned long long); __put_user_check(x,p); \ }) +#define user_addr_max() \ + (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) + #else /* CONFIG_MMU */ /* @@ -210,6 +213,7 @@ extern int __put_user_8(void *, unsigned long long); #define __addr_ok(addr) ((void)(addr),1) #define __range_ok(addr,size) ((void)(addr),0) #define get_fs() (KERNEL_DS) +#define user_addr_max() (~0UL) static inline void set_fs(mm_segment_t fs) { @@ -222,9 +226,6 @@ static inline void set_fs(mm_segment_t fs) #define access_ok(type,addr,size) (__range_ok(addr,size) == 0) -#define user_addr_max() \ - (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) - /* * The "__xxx" versions of the user access functions do not verify the * address space - it must have been done previously with a separate