From patchwork Fri May 25 17:21:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10428091 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 105AE602D6 for ; Fri, 25 May 2018 17:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9BF22972B for ; Fri, 25 May 2018 17:21:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDF8329730; Fri, 25 May 2018 17:21:25 +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=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F0962972B for ; Fri, 25 May 2018 17:21:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 508CC6B0007; Fri, 25 May 2018 13:21:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 46B2F6B000A; Fri, 25 May 2018 13:21:23 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2988D6B000C; Fri, 25 May 2018 13:21:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f198.google.com (mail-wr0-f198.google.com [209.85.128.198]) by kanga.kvack.org (Postfix) with ESMTP id AF1976B0007 for ; Fri, 25 May 2018 13:21:22 -0400 (EDT) Received: by mail-wr0-f198.google.com with SMTP id 44-v6so4870566wrt.9 for ; Fri, 25 May 2018 10:21:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=lILut2XwFIpu+wyBXiRPzyeQQvgUlNIl5NNAqzVkiro=; b=bgOPQTD+1oH/3Lk/FTxL6Ej2bZrucfxF8qqMSGaEqMQ2Gfx/yc1/xEiaHowsOKZB1K qDTqULgTh2XTTpyW+no7XEo4Co3twX0mIkdSWJs5dYp7ztWwY19nKIGC5reQ+vSb8sC3 1nLjLR05n1HYtD9bliADFlvUn61P8RO5ykbXiSuXBEK8tKS/WuuyycV5JbEsTzlhDjuC SWAl8X4mZK783Ha3jK38zvnETeutHtxg/hxFjQO+50QcGa0TxxjTKFPa2HRQIEdFvGOG Vfo1ao8GTBRSUdlCj8Nge3hFBJAUpWS8XTLbD+QXIyRQccricDhJpOkXwXFJyjDF3Daw Seng== X-Gm-Message-State: ALKqPwe/WrJGlaObwDAnTh5/Y3rjK8ey69iBvEnddEA8iOKnjdACGhWC eyAwGfhnqIpewqmBnkNcmaUmqQO+A7skL7xlKEc5h6TNw6GvQPIaMLFm0t7ac/C/dGIIyhSMVOF XEtNk2OEAiDzBYUmA5SkTRpsNz9i/RGlxZ65huhEnbrot9rUOuPek5G7D1wZR1xWxxSfThM0Q/2 DElrdDsA9sZYVs3eQIQEfUxVwtE5xfI0RabIQidgThhHB2Qj6hXYRp47AIeNIj0o/bJpP0KYN2x 1F83GWb/YqSkhNLxbR36PJxyT6SSL8OjSVDw1OtQ9BZe/+0SA28cIHq8ePqI9qDBJrNb3ZTK8F2 R27E3IXfH5Wb0ZhiLxDozBNtdd+u7PMl/INV8wLhXGwRyEdMgw5MWLbIE4OwoVZmstVW8UuOhml U X-Received: by 2002:adf:abc6:: with SMTP id s64-v6mr2955878wrc.66.1527268882296; Fri, 25 May 2018 10:21:22 -0700 (PDT) X-Received: by 2002:adf:abc6:: with SMTP id s64-v6mr2955846wrc.66.1527268881639; Fri, 25 May 2018 10:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527268881; cv=none; d=google.com; s=arc-20160816; b=Ca+m5FvqEFb8cwB7w+nSnnuJ8OpV9CjBdqEDXJyDCZnUd9OKrCGWFv+Abv981TW+bb 8vppWGH6JD63uxAmjOYSL13qeoBP1Oc4ng5L525GspL6G0yhWSKDADNVZuUf6FWHRY+L SAFcu+5/tdHv5r5HIUYqTtudADn/CRUxg1CS7ir5bmrycCYkNyE4Xx6ByvwFnwnOI2s8 PEocYAGJhqiAl9QLAUOUyOsOgRmPYuZM7x5+pE48x0DJc+U58oIswM+A0D5epYb+SVYp McuYNFQCg1lH7+wAxWioqXtDCRH6H8douy1cjQHWXoalSVEQUFy3djl8eTTeMP3zvEmG 7z6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=lILut2XwFIpu+wyBXiRPzyeQQvgUlNIl5NNAqzVkiro=; b=R9xv2On+88nBCfEaTuHoV/lZKmshSvU5akjPH9uarkIxdHrtGaIX4psRS2OCMIgkDY EGLapL/BTooUVWu0YO5eiMc7JvSp5Thb9YI/nZr1m8Xe8/fzOOWwrxoGJh5ehadH+05Y WH4U2epxuncI4y3joMN5A+CAYH495CQIExt0WrIJrG9Qx6THNSKR5PCMOTpP+GrremrS kAPfgLeoAxG8APnLGnIuhexRFtTVV8sMw7+E4CBEQrJ2emssTKS8GbZbJ53B6M4/R/ta kVlJcNIxtnBsAFhFlRB1loQd9c4HH0jfhuTvaNygBhMTsFxfnynGg0Gfpgw3Vh6iCuG9 VcSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bxIlA/zE; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f5-v6sor9000132wrh.5.2018.05.25.10.21.21 for (Google Transport Security); Fri, 25 May 2018 10:21:21 -0700 (PDT) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bxIlA/zE; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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=lILut2XwFIpu+wyBXiRPzyeQQvgUlNIl5NNAqzVkiro=; b=bxIlA/zEYViQiJmcuaKWjyYnGbEDIPus0BzLAXbcTO2iRGnPP5+0SkrWIWN1GR7Id5 +/pNn0GbgMsiJ4i6odcVGf+quRhk+K+AO2y0ySnOJqnvfiQF6hydPisF5QjdH0B1FcEK g8DT8AVaHH65HUV8d4x8pYElhLPpoNW22DndvMkCPiixxH7la1WUFI/IIg+suvxbLvLr tiJGMq/RBG1EOdyV2tvFWyptb5GvwMFfHEvINaMIeR171U3SqQXYKqSDvg94n+Ndo/Cn 0FnngwQL7JEp58O7WMjJHI4mQ352yvar0zSZn+mD6DdAahSsaiqR/KEXjV4OCKaPzlJf idGQ== X-Google-Smtp-Source: AB8JxZoNyGldGXQkycJ5mcoEPhF9vnulrogiFTAP4ZCnDO2Pj/NdNxHxwUAovLOaOe9xqtcrTu6nAw== X-Received: by 2002:adf:b201:: with SMTP id u1-v6mr3216472wra.2.1527268880959; Fri, 25 May 2018 10:21:20 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id s5-v6sm26579964wra.48.2018.05.25.10.21.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 10:21:20 -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" , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya Subject: [PATCH v3 1/6] arm64: add type casts to untagged_addr macro Date: Fri, 25 May 2018 19:21:11 +0200 Message-Id: <3207c33dfa90a225b57121041d425b21ec142f62.1527268727.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: References: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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