Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1305066imm; Tue, 2 Oct 2018 06:16:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV63HHCzFa2IKKsMYqsQFsdPOOi3AUOj2YU5slzyrQFQWLBjbqMN05j+3QzronwUKLuA6bVHS X-Received: by 2002:a62:57dc:: with SMTP id i89-v6mr16402853pfj.45.1538486167761; Tue, 02 Oct 2018 06:16:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538486167; cv=none; d=google.com; s=arc-20160816; b=IXoBt/1COFadDj1P09jn2pJsxw/5BXUljojHuXRJ4gZf6yoZs/w7cVUAgwNWl3ef/g LBRx62b+lUqUGulgITIXSZ/w00bfxLLU/vFgFsEboaUSSPRX9Kol9aYXcxXJLcX6riXO xEAAy0zysSK9FZ+ZQ0J5McJ0p8CbXrm9d4RzGadlYq7oBjYPwz9DO3RgyBQRj5FLLujf OcgCJ45P4n8Os2e/5SGd3+PHO+qwsXomx5IM2AzGqdK+vZPRQk2TFfMD2o7ZWIj8Ah79 047eDheIqmzylHyWgYIRJ6gF5vPU0XvjGvrDR/dHAs/k9vExZq0F3eDOFK7ajRwYK1Gl Vf7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hg72P0CosgRbWoaFLc14vzZ1X5hDU4dYtp5LLPrtPyY=; b=EeMzi9l2rCG4khSEevAyAfl0IAjRaDI8va+nVk8ITFS96o8euxh2W886EoD+wzhn1Q RF6xzRLABfBKKCdTwyjHDJEHtaLb6vFGqlsZZCJVBviEMBQ9Pz5DmqW2FYVwHcfBa2CL souqZWkytpayXud+SZ1ucNuq+YvT9GYZMn49ohsDMzrxnNQrwvDF8q+l94w1/HrLNcjQ rJOc3chUM8MxhJ+8MxiQ4w3yxN0hSgohSgHeYkeM0cPeNQgwfLhrtg8L1phEv6EE0xE+ IWdFTrWQHvJgxC93o46KuFUSvhwyqbHjNBsKE4xvoYTZGQ8VyFnk6xMmJkt2aIgxMpKK AgmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YxOsXrwe; 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 185-v6si17162942pfa.199.2018.10.02.06.15.52; Tue, 02 Oct 2018 06:16:07 -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=YxOsXrwe; 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 S1727961AbeJBT4H (ORCPT + 99 others); Tue, 2 Oct 2018 15:56:07 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37463 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727829AbeJBT4G (ORCPT ); Tue, 2 Oct 2018 15:56:06 -0400 Received: by mail-wr1-f66.google.com with SMTP id u12-v6so2172858wrr.4 for ; Tue, 02 Oct 2018 06:12:48 -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 :mime-version:content-transfer-encoding; bh=hg72P0CosgRbWoaFLc14vzZ1X5hDU4dYtp5LLPrtPyY=; b=YxOsXrwelAI/lXWqUvyP80W002B/7n6YQbPrxkL3Y/miO7blJJ1EdFiyRBNCCwuumv LVsj+hqhdHZjOY9W8MhdK1bk6eCDfyjz930bJmURnf6BgQMurMXp2LPNMmBOo23+fUZK bFq3knuWoaKlq+KJWir7KTX3naHfXXzSSp8PMJ+wrZA711u4/zKWOTjkyH6Zcnf7lM3X HVyooy564WzO4uvgji0Lb8fngQnuYXBqiLiC2s/b/R+py7YRH8VN5vGKUMcUa2NFUR9x 4we1MwOXrkCACvUvM7bAXHfluyXrVN2H6IKjodbIdeAACkgmslAF0UFZ8S67M8zgYfu6 VjGQ== 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:mime-version:content-transfer-encoding; bh=hg72P0CosgRbWoaFLc14vzZ1X5hDU4dYtp5LLPrtPyY=; b=Uot/fXSmIwA3iOSfsfrfiNrunFMOxKOX5J+tbZXPhkoGW7sA5+sEPvem8k1Q50Nev9 RFa/wVSBmuyYfv9jT/eeuRroZoQbjsIyUr/etE1O/r5JuiyJHZ5Jph/reLDQg/pKOfjX 6EsQXOOiKTsMoDXvE4s/22ZLyzYVcP9QcG2+KDOCeNZwTzQE4sq+X+z4ux92r5MVw3Dg CK6UI6xDg+HXJ7c1SsSJwah+Ghs4z/+G+e5E4vieHF4feRHzUnPIIGZMTt16Pn5BWaDE zA+FOY4uO3XslynkOnj2pgXPF12wjxn3IKSmI552sfHmNe03pt/ORLzExmzM2D/y2SxL ceTA== X-Gm-Message-State: ABuFfoi5HuC6rybx3vNZddUkxgs9yFBDD6BdRwkQSJTKd/moX3I10rHl K+suM3WxM9/AgreyiZEGAiy1rg== X-Received: by 2002:adf:9792:: with SMTP id s18-v6mr11252530wrb.283.1538485967668; Tue, 02 Oct 2018 06:12:47 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id v10-v6sm17458681wrp.0.2018.10.02.06.12.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 06:12:47 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , 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 , Luc Van Oostenryck , Andrey Konovalov Subject: [PATCH v7 1/8] arm64: add type casts to untagged_addr macro Date: Tue, 2 Oct 2018 15:12:36 +0200 Message-Id: <6a951a9d1cd38eac1e49591f70e3cb9410349823.1538485901.git.andreyknvl@google.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.19.0.605.g01d371f741-goog