Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp905957imm; Wed, 20 Jun 2018 08:27:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLQGnb1A/nkeCyJKt/5d4hevlTtZYLEbz9+5bDiRKBE71JduFiCPC8oB44g9vqW2ZEf2gR7 X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr24262935pls.37.1529508424932; Wed, 20 Jun 2018 08:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529508424; cv=none; d=google.com; s=arc-20160816; b=JibbIr2gb91HQ3a5SHzVRtBaNpRT9yNgtUI+MOZwsUwj3gNzNth+xjtR6PjL79+6/F H//fejagRn0V3Z1edPC8gsnODy0i3DMyXVXhh3fq4gR9nWcC+ajAK6Mv+5h9NuDvLar9 buT36pgHGOdCv93WlgJeOSpMOZpFMSbD8SDxbCaXcASIdq3XLHrh+xsZ1usNwEw57JSH ScMkD4Tz/WGlA9hrzL88lGIhgOPnkX4QtDNG2D1wjGePjpwE1KdxzdrpvROFm0zZSHvO vU8JDkOa+Dm8jiPCiiLVQ1t+bpizvdeHcrn9cA52V4LZmdf85HLFOeeUJeJwOw2kcaYq IA/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Mm1YNP9Ul3FYJxo+KbOILzENXhNHWqhxl+fse8OVffY=; b=byGEbaZLpK9VYHt3Aerx3qmPETPBfPPfz9KurnknVuPhQC3+VNv3gIC/LnXX0LZUNg zcQ9AEecenTi7ISIY6cX9RzpvxwTWNiFArDM18fcIbVrAL6iLcryYNw4wjZ62YT4r6E/ WYRZNbbCgCmJrEFRuJm2srRssSOGAPx0uDrhYJt1452U4XM8Zin4vp0TuSteFSWO9aYk ZsRKnhvjtOcuVDfXOnpquv2wAcMAzVQR5rvD2evrC59YA0+6CaY0vpn+Ueo8MupFcnyz hJH8lfsVssVXY3r92mUH5JI8nE1AT/22mhygj9zvWnN2ZEqcaWGHSdoY+6gCXg0H+gyG r1hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iPbnnnAt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n23-v6si2129110pgc.366.2018.06.20.08.26.50; Wed, 20 Jun 2018 08:27:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iPbnnnAt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932220AbeFTPYi (ORCPT + 99 others); Wed, 20 Jun 2018 11:24:38 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46860 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754088AbeFTPYc (ORCPT ); Wed, 20 Jun 2018 11:24:32 -0400 Received: by mail-wr0-f195.google.com with SMTP id v13-v6so3708091wrp.13 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=CVt1PfOANauKPLHxZV2Xwp0FE7TabXKPsDYZ7l3Aiui1cRvaG0dFrLWEghzOK0bc8f q4AJd+i9Mx08QaHBYTMpUYj03kBA/iAeYNXnGpRS8rPYqvyj1pkGQdMbvdGUXyyjDX4c Dew2Xh4fvBcMixClIp67w75B5XKpU0j59VzV1C7/qi5VwWDFWHW6Nvr45UE5aCRpkeBr CQlsSl3fQ21MhDNcXnerOd+K88Kg7+sCD0HROFcmdnNEx9xQ+wATZpeRgGPvR0U2HLpf o75BR6rz++pPG8FHEokV1iMnsslBm/SBjwcuyZE4wWVRf7k9hu04+X73dDfWJ5STwbR+ ML6g== X-Gm-Message-State: APt69E0q+Gth7rF9vMKYoKVj/zrEABzd0VaERpLerXJVovh11waWCbP4 037+c2MC0tw9r9p/t4YSt39qtw== 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 Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya 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: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.18.0.rc1.244.gcf134e6275-goog