From patchwork Tue Oct 2 13:12:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10623651 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 0312314BD for ; Tue, 2 Oct 2018 13:13:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED16C2846C for ; Tue, 2 Oct 2018 13:13:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E00BA285C7; Tue, 2 Oct 2018 13:13:51 +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=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C0EF2846C for ; Tue, 2 Oct 2018 13:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726689AbeJBT5F (ORCPT ); Tue, 2 Oct 2018 15:57:05 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37462 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727822AbeJBT4G (ORCPT ); Tue, 2 Oct 2018 15:56:06 -0400 Received: by mail-wr1-f65.google.com with SMTP id u12-v6so2172856wrr.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=nTtplLM+BQ8rS7AqkUO0Y+nBRfQfkSfH3cm2z8QBSvjw3tkQgRnQDaZyyTMOLhlAo9 6eKgUsiEG2a6R6ZqUWEhzX+xLcD2jYrcJ97gUX5/Ulk2IN5w79f3ZSMwTizwyzeNK5HK o4rYV/W+q1g8ouXo/H/+Dt38emIrRTvMsD6Tl0KPhOXRcYm3rNoA5evOfay9etjHmEq1 AONjI1tv9WcHADwPZj5apI20UHmSS8t40FLWq4QeaiXql/LUiPVwzNWotYpYTNoAbLxY 2lgEwx/PH05qIW9InHAZjSjQLsxm7JlbUCdcVZrVowgsV6Ir0TA55bSW8Ws2GtYM/4B1 IOpg== X-Gm-Message-State: ABuFfohN8c5lKuzPEXZU8jvRx8RJS2lNOuWEXF/aM/97RYYqiGuz1iDY f8xbdnna3eBbgC8M6pCQxherY4rnSeVqCw== X-Google-Smtp-Source: ACcGV63EvbNvms24ttmp368a2zKSU61XpI0aSwgZcGP8ZkkbdUH3S7LIgrnqug9JC04dDVPW2NeEoQ== 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 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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