From patchwork Fri Jun 19 14:30:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27742C433DF for ; Fri, 19 Jun 2020 16:40:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08C5821527 for ; Fri, 19 Jun 2020 16:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592584813; bh=uCNmxVWLAvd2UD6qMLaucpPVHNdoLiyvb7ceBA1576o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=B34QGa8eH0YT5QK6a8ivLkCUxc3T82rJbJmdH5wC5ZBiX3zzOJRZmxc8lljwxL86K L/W25+KoWWU/7Wk00Juxk2SjONqaIfAUNnESa9r/z7kAGU3+1IY975uH6nn0xT/xEg pxgmaVPmCXNyzC6Mdpgvp4kae3TTFBh3eki6CwpA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389116AbgFSQkI (ORCPT ); Fri, 19 Jun 2020 12:40:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:37660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388782AbgFSOp7 (ORCPT ); Fri, 19 Jun 2020 10:45:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F293C21556; Fri, 19 Jun 2020 14:45:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577959; bh=uCNmxVWLAvd2UD6qMLaucpPVHNdoLiyvb7ceBA1576o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZh5ByAimwXqH4aH1NHl5btRS9h7I5xli4OEOjmv7oGVqGg5Jbkr+E0z1AaggCpJy uZUFte7DNS5g7LyFRmqs7OR59cO3/cExCSIse1b1eZfQshz4vXMVKQh/vG5v/mFPIF 5tY+qv2ws/osMATkx7uNmC+b5bU14l4jVafp3Shg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Linus Torvalds , Stafford Horne , Miles Chen Subject: [PATCH 4.14 005/190] arch/openrisc: Fix issues with access_ok() Date: Fri, 19 Jun 2020 16:30:50 +0200 Message-Id: <20200619141633.736868337@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141633.446429600@linuxfoundation.org> References: <20200619141633.446429600@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Stafford Horne commit 9cb2feb4d21d97386eb25c7b67e2793efcc1e70a upstream. 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 Signed-off-by: Linus Torvalds Signed-off-by: Miles Chen Signed-off-by: Greg Kroah-Hartman --- arch/openrisc/include/asm/uaccess.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- 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(type, addr, size) \ - __range_ok((unsigned long)addr, (unsigned long)size) +#define access_ok(type, 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