From patchwork Fri May 25 17:21:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10428127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 22659602D6 for ; Fri, 25 May 2018 17:36:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 142922975C for ; Fri, 25 May 2018 17:36:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0879D29764; Fri, 25 May 2018 17:36:46 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B03B2975C for ; Fri, 25 May 2018 17:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EAXGiF5lu6PIhH8rvvSeZNdD2KW+jN98ZxFJs3LLhxE=; b=dAS8PB/TbHC20lv+I8utwsW06E 5ydAGdeAKWw9jhMw0PqH+j9g+gp5xio6Ndf/kCeDN//YiczxEDr6j2MalVMvmcAi3J4wihT9IZ9Nr W5qVmTYAqquMiRtsyR7UlhphCdrDvFHlfmMhCYvhYH8GK2owUJc2lG9xxV6mpsnhOFR+kSyxbODNE w1KQ4SPgy8vgYuExdw+JR8/mik4oQzkg/0h9f/gd0nkjZlNqsXg0ef0RKriJZBySvjkqQUmUlSzXs XFiIZSnp41ptS6feO3SuDB2tB/98kh5oKGVdqOE0inur0PTIYenk2OrUe2v6SN1NiUfCzd7pEQuY6 /hV61E8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMGdm-0001Sf-9Q; Fri, 25 May 2018 17:36:34 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMGd0-0000u6-8Z for linux-arm-kernel@bombadil.infradead.org; Fri, 25 May 2018 17:35:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=lILut2XwFIpu+wyBXiRPzyeQQvgUlNIl5NNAqzVkiro=; b=XJmRX59acfvYA+U/lFw0naDPH oE9do1l4ZxWjwNGXmPBlF/RxMLkUCtTTpMzPeCFUCOMpBBPmbcFjcIoK6udIL8CqzJ4AJEREZkJ9E rKbHD5h7v/VdNx5iYTnN6elYjWiqEtyNhdOM/VovBDxm44GSsMiTjk27wiyZgS27oy96BujCJxPh0 MsjAfk4JIh8sAl8F6tPC4Cgc8YUY1fUUNBQeN1vSl14e8jSiyeWlt14EJ6TyCCwOjtuUjR5SYztpr NS9ekyzVduMp1Qft5d3IgZMhN4NrfdefUMH7RPtmIElOm5VktevzSTDTguODA/a952pcngn+F/SSd ruR2Y8w1w==; Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fMGPE-0001H2-Mk for linux-arm-kernel@lists.infradead.org; Fri, 25 May 2018 17:21:35 +0000 Received: by mail-wr0-x241.google.com with SMTP id l41-v6so10462857wre.7 for ; Fri, 25 May 2018 10:21:22 -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=lILut2XwFIpu+wyBXiRPzyeQQvgUlNIl5NNAqzVkiro=; b=bxIlA/zEYViQiJmcuaKWjyYnGbEDIPus0BzLAXbcTO2iRGnPP5+0SkrWIWN1GR7Id5 +/pNn0GbgMsiJ4i6odcVGf+quRhk+K+AO2y0ySnOJqnvfiQF6hydPisF5QjdH0B1FcEK g8DT8AVaHH65HUV8d4x8pYElhLPpoNW22DndvMkCPiixxH7la1WUFI/IIg+suvxbLvLr tiJGMq/RBG1EOdyV2tvFWyptb5GvwMFfHEvINaMIeR171U3SqQXYKqSDvg94n+Ndo/Cn 0FnngwQL7JEp58O7WMjJHI4mQ352yvar0zSZn+mD6DdAahSsaiqR/KEXjV4OCKaPzlJf idGQ== 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=lILut2XwFIpu+wyBXiRPzyeQQvgUlNIl5NNAqzVkiro=; b=aOKwA9ZkMP3JqDYlUi7uiMfQeuJ2fssSBkXkUEnZo47fGp9/KT4JUgAfj2qIGWHZG4 NlZheOm80Y3mbtNfkeexcwml2kfKK2CqjlyPF15crFCZZQT79s7Jp9zWYDiryK8Rgaxc 011lLNoOXPMUlIZkkCZ6wmTHEEwU16WCfRl+uaiGi3zdDvXMUftUjRKAgtmsjJEIs6PM tV4KtYapT2RlVrUBwBRwxlDEgN+yFMwIO5oDyHCGeUcL2V98IQRysL9d3x4cOQA7rGUy xUJxHaeWlli/nQS33XVmztCvflATSwfnOinYQ3OWGF3DXSYPhTXfkV6Ub27h0VOTuvKc X+8A== X-Gm-Message-State: ALKqPwcgPeUN4aOg/qtTonMQ3p7tQAOKN0xHPwwq3En0ESmtgbwoL5Uq iIn02oXK3YCY0DtisJm6d5J5SA== X-Google-Smtp-Source: AB8JxZoNyGldGXQkycJ5mcoEPhF9vnulrogiFTAP4ZCnDO2Pj/NdNxHxwUAovLOaOe9xqtcrTu6nAw== X-Received: by 2002:adf:b201:: with SMTP id u1-v6mr3216472wra.2.1527268880959; Fri, 25 May 2018 10:21: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 s5-v6sm26579964wra.48.2018.05.25.10.21.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 May 2018 10:21:20 -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" , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/6] arm64: add type casts to untagged_addr macro Date: Fri, 25 May 2018 19:21:11 +0200 Message-Id: <3207c33dfa90a225b57121041d425b21ec142f62.1527268727.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180525_182132_754881_9E008FB8 X-CRM114-Status: GOOD ( 15.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chintan Pandya , Jacob Bramley , Ruben Ayrapetyan , Lee Smith , Kostya Serebryany , Dmitry Vyukov , Ramana Radhakrishnan , Evgeniy Stepanov MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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