From patchwork Thu Aug 30 11:41:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10581511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3603139B for ; Thu, 30 Aug 2018 11:41:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A171B2BA60 for ; Thu, 30 Aug 2018 11:41:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92A0C2BA68; Thu, 30 Aug 2018 11:41:28 +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 378552BA60 for ; Thu, 30 Aug 2018 11:41:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B45756B5133; Thu, 30 Aug 2018 07:41:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A2CF06B5134; Thu, 30 Aug 2018 07:41:24 -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 8A6A36B5135; Thu, 30 Aug 2018 07:41:24 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id 2BA9F6B5134 for ; Thu, 30 Aug 2018 07:41:24 -0400 (EDT) Received: by mail-wr1-f69.google.com with SMTP id 40-v6so5604872wrb.23 for ; Thu, 30 Aug 2018 04:41:24 -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:mime-version :content-transfer-encoding; bh=83X0Ly3GNFYkIBH/BFHbUkVhejW7zXmTm47ETsZa+AI=; b=NlC1zSveEaIvjWRuqxW7UidWvFE9SW50De/sH+POlbybmOHSLjhkY+NOW/wHETSCgK GbjQySc7C6bL3w81UOtBBgF51dmpV2inp4oqyWQU7kK0rk3PKTxhh0G1E2s6KIA/ECPm r0zl/XGw29sg1zlPxN9fKTrZVTUF30HH78vwIF7zINuqLZ/Hq2Tdhi+reESzDk65xgiz IwVPO0g0iNlvsP1YdCzBd0byX1JkULUBpXlWrqdSTWSV6QPQPCjTusTpVRfHkRkLwzlq ySyDKECg/wKm3+0eQf9Dkln4o23Xa7Zj2wpTMPBLN05Q5dbrvWyH+NvjPDwWX4udmtDA dptQ== X-Gm-Message-State: APzg51C2TPY00M/42wf+4fCMrxeOPDGTLfYzewviOxwQTMYzrSQGPHnM XOXdp4VYoeoRkOqadD+2oWFvXfC0GdQ4UEWcRqsAEwnRRm4Tw0QpShylS3WvPtqUvwdw6V3RYZR smno8Nep9/XivRWDnIpHMjmJ4DT/1f+u90ica3tgSklsHiNvSFvHIhJqN0HLjbQT1/bC7lPBdkA DXmcwhYc68pJsOh1M4BNh8gZSSoV2bF6m7jWMUUWHcckPW2fkRWW2uyFgub1I1NUG/Dax7SxW6h cNCWkI9+L3SSE37KQlu3bLzR6bFJ0qpnr674cx/slgS0FCrY0vkLe2eWdgjoiOZ8BT/2DBdCzFB /THRT7AHaJosp9rHQdTqgk0C7DyIlVZ+cqjo9jkMeJhHANBwaWYMozOzf6Dq+w8WXz+6nvY/K1B 4 X-Received: by 2002:adf:9464:: with SMTP id 91-v6mr7051346wrq.231.1535629283673; Thu, 30 Aug 2018 04:41:23 -0700 (PDT) X-Received: by 2002:adf:9464:: with SMTP id 91-v6mr7051314wrq.231.1535629282922; Thu, 30 Aug 2018 04:41:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535629282; cv=none; d=google.com; s=arc-20160816; b=fXQYIl3VOBmb0BooP+SZf0ZR+3PFBCfZWgG2rhPf4TkmPUf55MzLUApeJWQtyqRifs PMFn3rDgrWPpeXEQWgLr5vTr6oLLddYIS3dnVCUxnuU+wwoC6b26RphoNo5m9tNZv1BI WLNWtx6P9MiZ66Irz9HXUFJQl/4Ri2W9wtTfKJ0lMNedTyuMJRe6pVUWMaVxk4EWiD0d +gwm82Go7WNuV/g04LAZmirsbi+06irkkCN3TzD6lGiev9lalcI4Q7ap1eiKOnSqR9lR AA41yRgg1Jjk0ZKxq4FyIK6NicBAUUKWbdUf/TIX9G20F33K2Xh+eGjTJN29nmrCwS68 kVfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=83X0Ly3GNFYkIBH/BFHbUkVhejW7zXmTm47ETsZa+AI=; b=XNYXv79vZp1fkj+DmU1lJgiXQScQsEVBB+dD11O/s/oDNb0LOFgckxlqISgDEuBZbj finCJ+YNhyfUyxEaruFQhOZgaoUL2c2Xy9XJWAICMjGPNM0fubCPRt1j+kP48BDczZ/J QuZi/AYF5WJwaPY4ROp6KmaShvQFk4aa+nJAi/TOWEm/BvoLOwx1x3CZaMkwKDtVJUR4 a33+3Wi5rX58byuNySlVXwsq/vYc1JZnHrCDdlo/retSS6YSR5aKwb8v26GbnXql8c9e k2RjCvMv0+rjb+po34cj14M8m8zXWSZE/oQ0uIZHVpiqQtd1XceqWEdp66DkKmTn1djc FGTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=K+wpn7aJ; 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 143-v6sor53688wmb.14.2018.08.30.04.41.22 for (Google Transport Security); Thu, 30 Aug 2018 04:41:22 -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=K+wpn7aJ; 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 :mime-version:content-transfer-encoding; bh=83X0Ly3GNFYkIBH/BFHbUkVhejW7zXmTm47ETsZa+AI=; b=K+wpn7aJOFLmPZBtmJEtbDEIz8wwRyqKm90YcGp+HMvxjAN9pVZ9cCtV/gejD6CHx8 CCRwiS6KNOavKWrpApClDZVkUNnM1PpPI0sPj53nn54bQD/sBRG7JsNHHoX4PU66BtJs sWQPtl9p71g3J5ENln6J0XiGFBCetgKOUOzChKveAkosXimFhJVQQlzelgwZoNQSSMrk bcDUcVPQoIRyS/FnXWMTu46L+C5BZMmJ8YmSSpruskuUgtBE+n6hxzvCGEZKPoQmzw5o IloxmtP6GY49QXdlXgn3aXUqKYfzJKfo4M4OVXaCo+jBOHmqanbdshjSYmo4j7v976ox Mgrg== X-Google-Smtp-Source: ANB0VdblrnnClBYraLmPvStLXRnR3nCTmyxCJTD1zNjyPyVzvdcT/vtJe4+4mlXiStIG6mJaA/B2LQ== X-Received: by 2002:a1c:9e4d:: with SMTP id h74-v6mr1596295wme.70.1535629282357; Thu, 30 Aug 2018 04:41:22 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id z184-v6sm2175218wmz.0.2018.08.30.04.41.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 04:41:21 -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 Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya Subject: [PATCH v6 01/11] arm64: add type casts to untagged_addr macro Date: Thu, 30 Aug 2018 13:41:06 +0200 Message-Id: X-Mailer: git-send-email 2.19.0.rc0.228.g281dcd1b4d0-goog In-Reply-To: References: MIME-Version: 1.0 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