From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: ARC-Seal: i=1; a=rsa-sha256; t=1524077600; cv=none; d=google.com; s=arc-20160816; b=cxt8WqyQAOf+mRSxUbXeVVO7iay6Nt0ppeNYJbzt0Uhw8Ds+aq9nPtGOSlDgVxyGtS 2yhe1cDlVjoaO62Z+8SI388Amb1LHbYGnxy/LfvBDr4sxRmhVLIRqcAWnndBc1d1R33p dkHolwKuNdRZvm9jQ8lEfW23qOdh6A5iiE9tTPJTYzXKn/uvK+0EXRp5fMWTayCXiSI+ qBS+CG+u0tyHXzuvq8uE96ZfVwIutIACzZ0ODYtyX4i0CM+6FP7iOpUjlrJx0IceG7Ci nXkLTw+BUb9kOTTNwi3oJAwGfhDtQfg2khDBiuUpfZfOLJ/YyG6lGoemXrxbOJbMroQS y+0Q== 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=upppdIDGgX4DchLqIIxDa1ACj7PSs1Jc4nEJzkc95m8=; b=osECpnxH+48rvBWuYfPbA6ggNnfN7iRvRfPEvK0l6xIluY7kTKu0uJcxE6Shi9CfNQ 2kOFNKr0w2hlPNesIOXw3zTno0hIAPItZ7jqqMc0Br2J+zdsw/90Lc6hG2lgRYGwY4ex oIckFL4RQvm7ur64diYsGhv2F4tgrmEH00+gMk5MqkA+fDYupGkEa9g+sNVcvA5RM/SV Yh1o9hi/c874RRKySLXmnkWgMy5Vicqqk9kSOmKl0VQXpnEa7xJzclcIOlbryl5GvNyL 4NS1RRIyWWNNLq/yu+PbhVwl+xOYZZzvDktf/H2VsUxObsnbEu/gmqEFLbArzmLfkVyP 05xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YcvbuTuH; 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 Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YcvbuTuH; 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 X-Google-Smtp-Source: AIpwx4+mCNu3FKyFByPV3u1yjEnA8QViNl6fr0SMUnpjf3SaNtOBhM1DMB4b84D7rEhq1vAwSLRQ9Q== 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 Subject: [PATCH 1/6] arm64: add type casts to untagged_addr macro Date: Wed, 18 Apr 2018 20:53:10 +0200 Message-Id: X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog In-Reply-To: References: In-Reply-To: References: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1598111194098442837?= X-GMAIL-MSGID: =?utf-8?q?1598111194098442837?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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.17.0.484.g0c8726318c-goog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.6 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id E3F147DE74 for ; Wed, 18 Apr 2018 18:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752983AbeDRSxY (ORCPT ); Wed, 18 Apr 2018 14:53:24 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:45497 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752939AbeDRSxV (ORCPT ); Wed, 18 Apr 2018 14:53:21 -0400 Received: by mail-wr0-f195.google.com with SMTP id u11-v6so7512100wri.12 for ; Wed, 18 Apr 2018 11:53:21 -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 :in-reply-to:references; bh=upppdIDGgX4DchLqIIxDa1ACj7PSs1Jc4nEJzkc95m8=; b=YcvbuTuHQTQasRgn+75bEOw/WjWlJrm2p9f3ulUY4yhG4ZjrDgwmBO4Ts8t9t4DQ2h CcvbibYeCeKDUi8beUhiZUHHic51ImmzKtq8AI+d/2UzeZUBw/B5c49Np/+jEv9H9Tv2 jNVzhijqmNRY6HRTV6tP0U0hhOtvsC1hTvPx5tR03dwSDvy9i8ZmK1FQ8xRV+SBhpphc Rwdl5zS55ovlppZKFKNnU97uuPjx9+Iy7w9ZRsw8Q0gMEoZ5pZVx8pBXm7JwjBuHvXhf CXpHmDQQ7h265fAf49raQaM3nxI7WeNvICwTGWMWGiFMcuSLhnXYdcYK9qqyg1gvtCRy vFnw== 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:in-reply-to:references; bh=upppdIDGgX4DchLqIIxDa1ACj7PSs1Jc4nEJzkc95m8=; b=UwEphHovKZm4+gyenrES+YwnyAWIGj6SS2+NL7C+2z/whbtQDQrtie7MNREPJ9SEMX y4U3swctyZrLafi2XqSjegvWfrYswKm8Qj3FILf6I2O+8TcMefCcG5orfUU/Ad9vYLLM N97K+lwxMEVQ5SPrZz+5F/B4I7RcilU2C25t9m04UcForiPpgNrWLuTHJvp233qYi0R2 ao24NgTF/V9SurMs9gcIqiri/jIDFmi11hSNNaeKXuh4IB987+9Tg8R6FVKkVRP7pvnw e1MfiP8Es1BxSJ8l+lYpXnbokgK8ZsSZmHFKYqpqrjs3Bvz7EsSy9D97dojJcDgzQEAy Fgvg== X-Gm-Message-State: ALQs6tCVhoQjrdrXmbvXUYalJpvUck0LW3X37n+iXqGE6DLsCM2Pcmez LgDPTdhWXM7vfYT+DAk8C/Pv6Q== X-Google-Smtp-Source: AIpwx4+mCNu3FKyFByPV3u1yjEnA8QViNl6fr0SMUnpjf3SaNtOBhM1DMB4b84D7rEhq1vAwSLRQ9Q== X-Received: by 10.28.177.197 with SMTP id a188mr2390658wmf.121.1524077600112; Wed, 18 Apr 2018 11:53:20 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id k79sm2616735wmg.39.2018.04.18.11.53.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Apr 2018 11:53:19 -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 Subject: [PATCH 1/6] arm64: add type casts to untagged_addr macro Date: Wed, 18 Apr 2018 20:53:10 +0200 Message-Id: X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog In-Reply-To: References: In-Reply-To: References: Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@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.17.0.484.g0c8726318c-goog -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: andreyknvl@google.com (Andrey Konovalov) Date: Wed, 18 Apr 2018 20:53:10 +0200 Subject: [PATCH 1/6] arm64: add type casts to untagged_addr macro In-Reply-To: References: Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.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.17.0.484.g0c8726318c-goog