From patchwork Wed Jun 20 15:24:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10477735 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 83E5C60532 for ; Wed, 20 Jun 2018 15:25:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73E2A28ECC for ; Wed, 20 Jun 2018 15:25:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 680B328DDB; Wed, 20 Jun 2018 15:25:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F3BBD28EB2 for ; Wed, 20 Jun 2018 15:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=eMvE6/UMjc/i92ZLbh/Y6LfGwxj+KUmmYOej8RReUfo=; b=IAK3Fso5D3TqdqWRxszAGXKkRY MeYXcHj1U5ndaBzOnzlrbIcsNsoKksijZil4MPLmRuByJawlGaQ/E8Ip1CVlUxHtz2f8qDjqr868k J52/O+NwyvJGctPqrtQgFVvEJy8AurpwSiJFvmpwVtMMTa+2sPCVJVug+b7OozIRlJ5lwtkpHaapZ mwcofFCM04Dh+a5SDCu1/wE5XamBKNkCvvOTD6XF1tD5KzE7xE8MfzlhMaWcnpNGz3tkXsC2JtpiI R0sPqz/zQpQOmgsFG1x72419jmmoXSKl2d2ljKixr3YGpDa7gWc1h47Hha/xB7JkFWbcLvmBDA9Rh GducRIhw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVeyZ-0005Eh-3w; Wed, 20 Jun 2018 15:24:51 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVeyT-00058Y-LZ for linux-arm-kernel@lists.infradead.org; Wed, 20 Jun 2018 15:24:47 +0000 Received: by mail-wr0-x243.google.com with SMTP id e18-v6so3736377wrs.5 for ; Wed, 20 Jun 2018 08:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Mm1YNP9Ul3FYJxo+KbOILzENXhNHWqhxl+fse8OVffY=; b=iPbnnnAt3M8bu/Ho4NjyfbSAFKix3zP+XQfYWw4RRZbsdaybrOEFdvT1NBzs/gY0sf bSeAe3PE0G96300Ua7EzTuvBfpsM9rlYd7bANlf65xvDStKUPuwxgKzFLWHnH0L0CQSs jMgUOO6mzAXmEKg1So3ZI8wmRM9exvTYo0I5RE6jjzytNC0C7fdas0QQl2w6Q/wShwbL 6gT0FXgpJOw06XL+ZwsNazJdeux+BlUiQ/+w9saPXRVUZdLI1ZiLysdzff2otLlz/uRZ AqdYLRPdfPFvVZp8II7H3JmqKR8rKvP9ZC9rBvtWsTlZCvGIpCYk7nfLzut4+1ulekRa 2suA== 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:in-reply-to :references; bh=Mm1YNP9Ul3FYJxo+KbOILzENXhNHWqhxl+fse8OVffY=; b=NNJrpYzKdqlwG/h1XNfhXoV/3su/mEs1XdDxWCdYqMp5xh6ijCCQMpLPZ9h0gtlegw mLCoeMOLnTO3Foz2NzYO26W8rDBQDtkT6LKEDIt1cTY33es7n/xNiD0PvfYbDVWJzQTZ lJb8r9cbnvi5lOpCLmA7G4D96ZXjZsWaCg6QN82DwhA71LkIyZJbe3dd3QfBl7cJ06bm qCvwfNkqJhO6TqNziHgFcBW8+xwvAJzzGatWdvwG8VUNcqgAlXBeM2CMIcOjxheU2T2B T2C5AYjx00loEFq84gIKBd++POPGkDBJmHhQAfNNzpZysi8yjNp7wlVVzKYaELi0PRdX rwkg== X-Gm-Message-State: APt69E2FYQChPeuMFGfHOBj95DVxdcoqGjNVKHzSWnFoT90XZUM9iQE8 UZXnfuHZkvZtyniCN2LioGpwNA== X-Google-Smtp-Source: ADUXVKKXRALsqaTpNj7ivIBU4ORwT4h9PJi4fUAXo7LPNLo1V3M0y/Twv51y3Wg70ebG+ok55pQEAA== X-Received: by 2002:adf:bb51:: with SMTP id x17-v6mr1438112wrg.244.1529508271396; Wed, 20 Jun 2018 08:24:31 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id c11-v6sm3959244wrm.65.2018.06.20.08.24.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 08:24:30 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Shuah Khan , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/7] arm64: add type casts to untagged_addr macro Date: Wed, 20 Jun 2018 17:24:20 +0200 Message-Id: <6d0ef0da936f76a215a5bae7784eba67ce1967e5.1529507994.git.andreyknvl@google.com> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180620_082445_722760_5EF49CBD X-CRM114-Status: GOOD ( 14.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chintan Pandya , Jacob Bramley , Ruben Ayrapetyan , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch makes the untagged_addr macro accept all kinds of address types (void *, unsigned long, etc.) and allows not to specify type casts in each place where it is used. This is done by using __typeof__. Signed-off-by: Andrey Konovalov --- arch/arm64/include/asm/uaccess.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index e66b0fca99c2..2d6451cbaa86 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -102,7 +102,8 @@ static inline unsigned long __range_ok(const void __user *addr, unsigned long si * up with a tagged userland pointer. Clear the tag to get a sane pointer to * pass on to access_ok(), for instance. */ -#define untagged_addr(addr) sign_extend64(addr, 55) +#define untagged_addr(addr) \ + ((__typeof__(addr))sign_extend64((__u64)(addr), 55)) #define access_ok(type, addr, size) __range_ok(addr, size) #define user_addr_max get_fs