From patchwork Thu May 3 14:15:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10378439 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 5424860353 for ; Thu, 3 May 2018 14:15:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 400BF28EC4 for ; Thu, 3 May 2018 14:15:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33F2B2904B; Thu, 3 May 2018 14:15:55 +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 CF6CE28EC4 for ; Thu, 3 May 2018 14:15:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 35CD86B000C; Thu, 3 May 2018 10:15:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2BA126B000E; Thu, 3 May 2018 10:15:52 -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 15D6B6B0010; Thu, 3 May 2018 10:15:52 -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 AE2CD6B000C for ; Thu, 3 May 2018 10:15:51 -0400 (EDT) Received: by mail-wr0-f198.google.com with SMTP id p1-v6so12160663wrm.7 for ; Thu, 03 May 2018 07:15:51 -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:in-reply-to:references; bh=xUzcMaOTF1xTWiYdFgJJTAKZY8fgLS4Wayk3qwMg3og=; b=c+sbEL6S3w0rYkFEsPca2IzBibN2VOkijCqWWG2YXKzkJdFsGzrPjV0z8QGra5Arzh m2bbnnWHwWaDKEkjgFvzeE5wPzKkYbBDRUBlYjBy3uv9COBb3kpfDNyH7M3yvpdUSLrO yBvBOYISpquSSqRvShbdPQnC11PsKJ7KE5m8O7MSKT3eA92/IrU2ApvRnMmdHe2ZtguU V5cAdJ4JxJIK523sDtFXvJJ3SmzoCTEzmKM1r5F3EmntuPSbCsLnanTdMEHCDVFx6+tY GJ/cvgPoFkSds3Z/c+WA9mqkenbw6IIk2m1WtNlmbof3T99aifejLN06B89nGe5YR+EK oMLw== X-Gm-Message-State: ALQs6tCLKxOlaUPRxUR9eKU63Xy1JBj0NZLFkQR3wMQl+XL9TGsjo7OY 4fBHuoqEOwkDPc39CGFJoxbHe63wziS6ksexM4+1kxXCFqZBUuPgO4qiXVagbZXZRoSVwmXaLT2 gEHyAVyEcU9WNz7IUdXyT9FQncRHaMWEU7Y1VQTmuw9YvavU+4Zfr+C5CkNV07pMWchmUmEgw7R O7RV64d8K4yhRH+7upIJtrfLIj+rf4f3f/MbNxUN62WwiuW6kcicTyMDddBTBpIg0mMF+EjKaRy A7Ac1/IhlgBDb/aPPMK5YaGZMw19tywjAOoXP3jM37Z6Qs9c6K2NseKrZVj76AtPDhHZnngFjYm qhj2fr25BnQcoNs17Ntp2hsNT35ro6vDbdCKW/n+RILJs2HAqsBiHP+0Cownh2yMoYuPETDhlj3 Q X-Received: by 10.28.182.70 with SMTP id g67mr16184742wmf.88.1525356951251; Thu, 03 May 2018 07:15:51 -0700 (PDT) X-Received: by 10.28.182.70 with SMTP id g67mr16184705wmf.88.1525356950523; Thu, 03 May 2018 07:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525356950; cv=none; d=google.com; s=arc-20160816; b=IA7Sobz2nfQDqM09UyuRKysQq3hp4+1mcnRoQqpCFOiuKn1IIu3JJ/lg47fiAHcNcx WtaCuI9pAF8dRbLvh9xiTeivHpJ2bv5p1cvgd/C9RAc9FGU6a5bUN9wYhejAu9d/dLhS EsqDnsZWN5RGHmgL+yZOqutmcVI88MHQs7wxv6w91XulVjoeOSlGLITFNKCbx+n/N6zT yrLwmyw8L/vXDXI27DFz2AHwG4tSuBgrJNv98L2Vy8EexLf3eTEZ87yksJpabw1LV3sx eZECSRWbg2b0OXAMKQovSmnEkqdnR1YOxpiBEifs13GqFVGqdbPv2lCHdiag26sYoLSq Rsyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=xUzcMaOTF1xTWiYdFgJJTAKZY8fgLS4Wayk3qwMg3og=; b=rFc6xrq82YM0QQwILsevMmjvKd3l7VFPLNGs4rH/9aYXnO4gNECHpJEHnDCW+B979+ pjvl1xwxIinoFuvdccswiMj2NXtGazS8tf4nhanDZ/z1HdUt2ntRPKhghBZmx+tOPRbK yv+3IO3JElT2kgA2w3/u3Pt3ol4sg3sTsaQdDxZ2lyU5bTwEnu4WaRXmGzVzPPXinnXG X0525M8D6K17as+s1/RHc2TmoataLOUAVVOhWvA4fDsKObxKSfL/fJ/yKbIGhkW9swzi rW50pOn/keaYYNxWZwGY7Q8Nw3n+/QEgOl6waRdXpv/i9chvKuSDgp48HFjnVF7x9smn Kolw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Gaf2Gpyx; 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 j21-v6sor6156266wre.76.2018.05.03.07.15.50 for (Google Transport Security); Thu, 03 May 2018 07:15:50 -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=Gaf2Gpyx; 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 :in-reply-to:references; bh=xUzcMaOTF1xTWiYdFgJJTAKZY8fgLS4Wayk3qwMg3og=; b=Gaf2GpyxAxLLoEg/CKyWWUvIWN4HcJRL4Rimd/ht7vvHJX816/tibX3CWOFjYC+6T3 7HmRrsInR/22Q+MkhZKSHPFRat/wqedQxsYsmJAhTLfKsGz1yG0KQGBx3nNyoid5TzxL kOCRNjalXQfwJMmlhjoD03riy05CxYfO1J5T9nx1K+z64VQ+sdUyxGV5q6ztG+EaJHGx yeOLltdJeRHMPfdz4lJ5/Q3aYev19/+IT/lEWmCAsqzLgzuT00PAGyjRJ0aQnLPvxOT3 rzqWse8l4mkNArFjlU4ArkeOO6+D28wDXRl4FfSx1JfYdf6X2rTIjor/Va0msDCRSNcb uKBA== X-Google-Smtp-Source: AB8JxZrm/imnlmPwzpExlXduL2x4spddcr4ddWYXxEzYjIk+xY0vq8dipS9QYyUmHsWZ+eYk+o2xjA== X-Received: by 2002:adf:e642:: with SMTP id b2-v6mr17276262wrn.172.1525356950011; Thu, 03 May 2018 07:15:50 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id u20-v6sm22090298wru.33.2018.05.03.07.15.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 07:15:49 -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 Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya Subject: [PATCH v2 1/6] arm64: add type casts to untagged_addr macro Date: Thu, 3 May 2018 16:15:39 +0200 Message-Id: <54622375c498b1e0037e26074cd2ba500ca7cbd6.1525356769.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: References: 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