From patchwork Thu May 3 14:15:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10378461 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 9E6CB603B4 for ; Thu, 3 May 2018 14:16:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88B8F29032 for ; Thu, 3 May 2018 14:16:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CECE29171; Thu, 3 May 2018 14:16:52 +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 DD4DE29032 for ; Thu, 3 May 2018 14:16:51 +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=giSN9hOvSxWCz3Lsnu87lieNDizX+G/GDj86WdlvxTg=; b=Gl8nABkEpLBlQuEGJlmAvvo2Ni hA5E7xV5LF0daAexpaugnR3WvYhkhz1uoJPY0eAib86uAlOOfATGowyRBlAZZehDQbrCcvAvCqZRC L4GUKP5Aa141Lyru45MFNS20yli3sCPOsXwpTwZzvlsNIerLNp03IaUwRZ+BBxJX27Me2cB+Y3GIQ 8LwdLW2n2MCDbE94gQHgZokgvZy1AG375JDvgdZLauvyb9ozAVkJSZnw1evdZiLL99jkFOGVLKJCk pWz2vLT4jxz/Q7H2yjN74c6bW+OwVUp/3jjSpWFcARFaIb1fO1gkfnnQ3WgkGfczGU3lU54Q0n+Qz LDKdBCIw==; 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 1fEF2L-0003s2-P8; Thu, 03 May 2018 14:16:45 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fEF1e-0003Um-5J for linux-arm-kernel@lists.infradead.org; Thu, 03 May 2018 14:16:07 +0000 Received: by mail-wr0-x243.google.com with SMTP id v5-v6so17798407wrf.9 for ; Thu, 03 May 2018 07:15:51 -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=xUzcMaOTF1xTWiYdFgJJTAKZY8fgLS4Wayk3qwMg3og=; b=Gaf2GpyxAxLLoEg/CKyWWUvIWN4HcJRL4Rimd/ht7vvHJX816/tibX3CWOFjYC+6T3 7HmRrsInR/22Q+MkhZKSHPFRat/wqedQxsYsmJAhTLfKsGz1yG0KQGBx3nNyoid5TzxL kOCRNjalXQfwJMmlhjoD03riy05CxYfO1J5T9nx1K+z64VQ+sdUyxGV5q6ztG+EaJHGx yeOLltdJeRHMPfdz4lJ5/Q3aYev19/+IT/lEWmCAsqzLgzuT00PAGyjRJ0aQnLPvxOT3 rzqWse8l4mkNArFjlU4ArkeOO6+D28wDXRl4FfSx1JfYdf6X2rTIjor/Va0msDCRSNcb uKBA== 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=xUzcMaOTF1xTWiYdFgJJTAKZY8fgLS4Wayk3qwMg3og=; b=BXlRmyqq/AdIOec8qf8eG2RBFta3dBzmZA37ikuitIiKAXPmfw2kxNs6sVTXbn6tw1 sZIXgS+vedPEgxo5hdG6o2bRopBvocUSkUvBzYNpL6ZD8IZ3NOtUhA8LDfDwhep2KpeD l9uVbY4cuK6k6MEPOxD3bIFJZO/FRpJM7iLwx+21RulPCCg9trezpMdfldv3doWqWxUx WA+IdjZzHAqs2+FyWmH4exwaZ6CZlkCpwV8frIONHTRcWLilNKN9XW9uftQgyWRN61c0 n4nZhw9SV3BARO0nCkvUoIVw2DF+mxkjWV7MJ0196j0xc+t8zbUgSInPQyZ8PbsAhb1e wpiw== X-Gm-Message-State: ALQs6tBjtC7MgcOYquzGFck5DHzmbQBN1ydCJb1G5O77eQ9W/HXouhXY JSpLffTGP1HlF68a/szIShXsPw== X-Google-Smtp-Source: AB8JxZrm/imnlmPwzpExlXduL2x4spddcr4ddWYXxEzYjIk+xY0vq8dipS9QYyUmHsWZ+eYk+o2xjA== X-Received: by 2002:adf:e642:: with SMTP id b2-v6mr17276262wrn.172.1525356950011; Thu, 03 May 2018 07:15:50 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id u20-v6sm22090298wru.33.2018.05.03.07.15.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 07:15:49 -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 Subject: [PATCH v2 1/6] arm64: add type casts to untagged_addr macro Date: Thu, 3 May 2018 16:15:39 +0200 Message-Id: <54622375c498b1e0037e26074cd2ba500ca7cbd6.1525356769.git.andreyknvl@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180503_071602_230520_FCCE7B2D X-CRM114-Status: GOOD ( 15.50 ) 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