From patchwork Wed Apr 18 18:53:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10348805 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 6A7A2601D7 for ; Wed, 18 Apr 2018 18:54:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59351287F2 for ; Wed, 18 Apr 2018 18:54:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D93C287F4; Wed, 18 Apr 2018 18:54:44 +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 95E42287F2 for ; Wed, 18 Apr 2018 18:54:43 +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=oIaO8yA22cZ2YNAL3xi+AmurOZnn8OU6ftGVOC7IfqU=; b=NGp1aOPKWA0g5PSNRQzNZ/Hm/Q sUC28Dua1gL1NIlBzKSlzX8/2UOCrS6Ttux7DIATaKC7eQwu+veiDncv4MFV72rcY2MlThwqd9Zw5 Ysr0DclPyFvJANLkQmuaXvNbFGMGfnARnlzoXWYILTmqfH8CrcpWQdnXCKpIylEDsOJtDE0++dvvS jkpKSqbeaw3thEsCE9d8iHwp4ZGvyO1GSijwv9A/c/BlWZecxC2SQemDkc2n/OuKaUXvxMZVQT4+h mCrOMyw4+QjiBMYuID81DH7FhpgsZa2veIqP9m+AzXGGjUvkcBiRIdBFNjXzU3rRsQVACAvsLNp1F /VteZKEg==; 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 1f8sDt-0003MW-Hv; Wed, 18 Apr 2018 18:54:29 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8sCy-0002uP-6o for linux-arm-kernel@lists.infradead.org; Wed, 18 Apr 2018 18:53:36 +0000 Received: by mail-wr0-x241.google.com with SMTP id u4-v6so7511731wrg.10 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=Y++xb0bOYP3GABh9ZNFNXi2nAUg6XLOwKO5S7rrkJFpqzJE38OwF1I7+MJAze0G+H9 Mhapzs+V1ULflnTOy8ROGExI3fIdutkvVGvkL+OJu3T8s5kS2iPGy2Fm8hWHQT1OwrY3 Ly2Y4q9iDBzn59VhoJPdodSCjaTyNNtLV+T0Lxq91j6qZNFAcN/k3x2e+Ilzm9NsTC6v CBf+o2VdTfj2MdKlGWA3YwW/bEecd8iN8/iF8klAZcnylHC7MJJARh4Wwmfqax21Xvx2 wTX34fz31mW/AOfFxb4I67337WFGtQPltFvsZPgZOJHVH5eUmGR4RZEPHjP3mRyPLX63 UZNA== X-Gm-Message-State: ALQs6tCXGjmR9303A3kHyvOJ/7pfbRMutm5OxdjFiNgK8Fffvqr6fi1H xotZ1NZQg1DUsdd86SM5Epeq4Q== 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180418_115332_882790_7C10F9FF X-CRM114-Status: GOOD ( 14.63 ) 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: 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