From patchwork Tue Mar 27 16:57:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10311125 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 8BBF6600F6 for ; Tue, 27 Mar 2018 16:59:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AFC32979A for ; Tue, 27 Mar 2018 16:59:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F4D629B31; Tue, 27 Mar 2018 16:59:41 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID 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 04BA32979A for ; Tue, 27 Mar 2018 16:59:40 +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=0TEDnkG51bPPnR16R9Q0+rbawO7YnWtk8CwpR1Ndhtw=; b=Xqim+8JYhe7stWDI3wY6kibTPI +x84oaUO2znorlkUVYXDbbfuxAAH9DWvPZMmLa7ILxVvx6j0SegUxRKLuM0UA+wC++0FnicRUvAcc UXkXJKld2sNp8NCv2a3mWScJYEYjTT3e8i6Rez5K7OMVHj2rWU2aysbngfG2x7nj2/Hkgov8fpK92 q9IIOORvDiDV4df7g1p5Mr4Acoo849mjxi87l2ccw7lzw3Mfb3zUh1IZ9G9FZtMxesX6cnJQKx4Bb q/Vg+xJ2mxKCKJk0M5CC/aIhcBKA0kTbkGawDUYGnyqG/S/iN9AQA1WYdmQgNppv5pAWf7tujVZy2 GmieozeQ==; 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 1f0rwa-0000fq-UP; Tue, 27 Mar 2018 16:59:32 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f0rv6-0007zG-5V for linux-arm-kernel@lists.infradead.org; Tue, 27 Mar 2018 16:58:01 +0000 Received: by mail-wr0-x242.google.com with SMTP id f14so23101404wre.8 for ; Tue, 27 Mar 2018 09:57:49 -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 :in-reply-to:references; bh=16zO1fZlfRozQmZA0XwO/F+8TDPyjWmWtXbmZBvVg9M=; b=TC0a80YrPD0yleRLOh0Gf36qFGESWeMXgW+LmnvssTpXCrf0jiBi4KHJQL8xZt6D7L 5cnvVMqn6SzNJrYOnnKnPg2hfZsLUnIT3MrIiFo2AO6vwiMMrS9O31Rfydf2E7xPxCO3 Pl3LnyybAEDCiPh5xuxZjc8V/uh6gUPauqcE93PfW5mETsTeDNcfvvlSNJZ7wOnbwX5c TkRiWvea3qZyuu0gBAK87Mj6Gh+Kbdhnh1+bQtaDnvkoC/TYEitoIF5K42heztt/E5jx FTbW4sLcF5GnHn6Hxaaf+8aDhnJ3IavbJLs+OgwDgQm6tilkq/s/P1xkRHZhrWb1xucB 8/Jw== 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:in-reply-to:references; bh=16zO1fZlfRozQmZA0XwO/F+8TDPyjWmWtXbmZBvVg9M=; b=MnL0llsHGMYTysYb1uKfS48XRt3KNxjOji74It+STMScwG0zsKlf2vTVVKCm44g5ks eRicAiQVAbjdetTEXlk7hbqwG5GmCe5hQl4rBAnc1/iosm7fpfvexXL9prBjeH9o2HJ7 ScSxQth0veWrgoOO7m7TxOQHvsckTwdGPWYYgKRJr3iZtLGF+GfZWgZy6mE+rgP17pLH /ixQmy+O0AncDcAuSwE3FzQ2k20fZZdXWufdtyNhwPYfoIchfEwCKVVNsgJmWTy8/XFc 43SL48h+MPjsKLCgXiIj//GcwCcIf6UzUDdmYahk+4jE7o1xSTwD/hMEyXE5zsTJ20h7 P2sQ== X-Gm-Message-State: AElRT7FXJ1aINBsTs0GiSJlFWkbe+sCUeRUCcj6Dee/85sdGWgJv/KFG SJu0Wy5a4KkQ3Yg/P/kaq9qvYA== X-Google-Smtp-Source: AIpwx4/+PlMoTXyL3X99J/NO1BvfdIk8E5OZI/edo9QrrTbdJ9nLf1NSk4SSfQkVN/3eIvmvXQf2lg== X-Received: by 10.223.199.15 with SMTP id k15mr125735wrg.178.1522169868202; Tue, 27 Mar 2018 09:57:48 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id 93sm1622992wrh.46.2018.03.27.09.57.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 09:57:47 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Jonathan Corbet , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , James Morse , Kees Cook , Bart Van Assche , Kate Stewart , Greg Kroah-Hartman , Thomas Gleixner , Philippe Ombredanne , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Dan Williams , "Aneesh Kumar K . V" , Zi Yan , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 1/6] arm64: add type casts to untagged_addr macro Date: Tue, 27 Mar 2018 18:57:37 +0200 Message-Id: <64234f64bde32a3f58466a74445848bb7f8cda83.1522169685.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180327_095800_247121_E00936C7 X-CRM114-Status: GOOD ( 15.02 ) 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: 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