Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4721880imu; Tue, 8 Jan 2019 05:16:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ijSc2jtHELkF/ECgdRvSJKvNZUo4qjq/TOgvTmvhMI/nhop+G33vmbWWngsv6qfgcfEiL X-Received: by 2002:aa7:8354:: with SMTP id z20mr1681233pfm.81.1546953419520; Tue, 08 Jan 2019 05:16:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546953419; cv=none; d=google.com; s=arc-20160816; b=dC2hmOOkrm8I54K7NJdbRhpiIdHOsyIgdUgPOWtwyXBeuij6Sp4ZQxFDqDKZEIE38y g1qLtceXjYzCXvKR5i5wH7hb4NHjsN6EnEi2/D/mtax6/d3hzhAhQf5JU9F/s5rhSnir 4jRuxntL9KXLuYZ5pmKQiBNIWY4URXvBlOi4POmvuTmghKNw1OMro95j+Rzky1nMdRHG KhZwJ1Dw+mIEheOIo1zvPh5JWcTsk7p8SIzvnWMI5yON9eP3DEnwhX2tqXsO26VhvMqv CNLTtg7IphXG47OOyHFbyNb7SeR8whxJ/udF3KeoEceMD5Y+KGTwI0di7q54KaF2ehmp p1+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ekuhxggFWt9tfhBqsa6b8OQpmTzdH0pSdOcMdL9c37o=; b=yN/MsDtb7DK3sb+LBVYv1KgBE2oXZzNHrqrD4ipSzyqUFJ+efJ+x/IU9hQ2J4lJWBi BjTvYo4+f/PzLwY6m0Y9MBUlzVKjF6Kpog7HG/62XleC4rK7iTQSP05nW2685olnmLXW SaTJu9kp80+3tpU/Mri/mQ0M65uvEDyPq3m7V5nYb4XykDraE3tjcfq26jm54mORoALn 3qXy4AmZVmt8zV7wcSp8pBWUELwgHcx9zU872HcIAVRiekUnpZz6+3n/owGeekTTrC+h m5mczK+STJnW3s/0tTybCziKfUfm/Ql6Rrsgi7r6faVA2Sd/Vjl4cHAW/uANRdaydt8m WkDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yi6YCFrK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si62913210plp.85.2019.01.08.05.16.43; Tue, 08 Jan 2019 05:16:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Yi6YCFrK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728448AbfAHNP2 (ORCPT + 99 others); Tue, 8 Jan 2019 08:15:28 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35422 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727473AbfAHNP1 (ORCPT ); Tue, 8 Jan 2019 08:15:27 -0500 Received: by mail-pf1-f194.google.com with SMTP id z9so1938185pfi.2 for ; Tue, 08 Jan 2019 05:15:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ekuhxggFWt9tfhBqsa6b8OQpmTzdH0pSdOcMdL9c37o=; b=Yi6YCFrKJqCiE71ZOS0yHMXtqdajGwq9WMUV+PhS+th/QTan3PeD2mYuP0I/CEdDdC hzC+MgSvgpcO4d2g4+9XY6KvloHilpa2g1whZ+92su2olV9dYJp5CO53lXsdlQP3DvU7 M4vgiPb7dXCdxU54qcWszB4fEQ0C4lEtSNCiTVyOoLGQMJwxO3swyvPYR7/Tf0ONJKrP gzpPW8VN9GBXnAIsb1w8r21X8sdDMSLW5gavM7VGxNV28KZckuifbH0X8UfjDn2suKaS eTuiQVVh3HocaA0nJM8Ml0ZBX9fjMBOU68udxC2rOtVleQOOABGd/82sQlznEgbU42lu /IrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ekuhxggFWt9tfhBqsa6b8OQpmTzdH0pSdOcMdL9c37o=; b=dJVaNriFLr/F0WA9q1OJXbcx0fNO6aErgzM1hxB+yvkSbH/1sjB1/fyaHGNvoBW7g9 1TYOaAg1f57Aix+XI6Gekg62YIik71rSFAgj4fgWJu0SSZnSqZSBWUGWzN+/szDW6RmR eCP4sj6jA1VXGVCIJoQ0Nz2+G6sGeL6KXoDvyficQ5MDdt6BJicCINM3Cd+/t3rzs1jR /cnypR3l4nBgRn2QrNm2njb7UGsNaRPveFSi7aLB4fAJhdCq71tjeoKR/hnh7Aj0t/og eOFOPhT04f7izvMIA3cs2lK6x7HUaq/rYuaUkvGTakIE3Nyy7D29zxtsZid3E7GaKOWT aqGg== X-Gm-Message-State: AJcUukexQdyGFaQcMDGxQDsMkJ+PRpPr+3KAAPn1WIKNJk2+JIVd4HY+ u9SIMJz9NffOfI4AqAA2up94Ty10 X-Received: by 2002:a63:658:: with SMTP id 85mr1465556pgg.373.1546953326182; Tue, 08 Jan 2019 05:15:26 -0800 (PST) Received: from localhost (g206.124-44-15.ppp.wakwak.ne.jp. [124.44.15.206]) by smtp.gmail.com with ESMTPSA id l22sm119860345pfj.179.2019.01.08.05.15.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Jan 2019 05:15:25 -0800 (PST) From: Stafford Horne To: LKML Cc: Stafford Horne , Guenter Roeck , Linus Torvalds , Jonas Bonn , Stefan Kristiansson , openrisc@lists.librecores.org Subject: [PATCH] arch/openrisc: Fix issues with access_ok() Date: Tue, 8 Jan 2019 22:15:15 +0900 Message-Id: <20190108131516.27903-1-shorne@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The commit 594cc251fdd0 ("make 'user_access_begin()' do 'access_ok()'") exposed incorrect implementations of access_ok() macro in several architectures. This change fixes 2 issues found in OpenRISC. OpenRISC was not properly using parenthesis for arguments and also using arguments twice. This patch fixes those 2 issues. I test booted this patch with v5.0-rc1 on qemu and it's working fine. Cc: Guenter Roeck Cc: Linus Torvalds Reported-by: Linus Torvalds Signed-off-by: Stafford Horne --- arch/openrisc/include/asm/uaccess.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h index bc8191a34db7..a44682c8adc3 100644 --- a/arch/openrisc/include/asm/uaccess.h +++ b/arch/openrisc/include/asm/uaccess.h @@ -58,8 +58,12 @@ /* Ensure that addr is below task's addr_limit */ #define __addr_ok(addr) ((unsigned long) addr < get_fs()) -#define access_ok(addr, size) \ - __range_ok((unsigned long)addr, (unsigned long)size) +#define access_ok(addr, size) \ +({ \ + unsigned long __ao_addr = (unsigned long)(addr); \ + unsigned long __ao_size = (unsigned long)(size); \ + __range_ok(__ao_addr, __ao_size); \ +}) /* * These are the main single-value transfer routines. They automatically -- 2.19.1