From patchwork Mon Dec 10 12:50:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 10721213 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 5B7F717FE for ; Mon, 10 Dec 2018 12:51:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CD3F2A228 for ; Mon, 10 Dec 2018 12:51:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A3452A299; Mon, 10 Dec 2018 12:51:16 +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=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC2E62A236 for ; Mon, 10 Dec 2018 12:51:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87B068E000A; Mon, 10 Dec 2018 07:51:13 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 801428E0001; Mon, 10 Dec 2018 07:51:13 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A3138E000A; Mon, 10 Dec 2018 07:51:13 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id 17D0F8E0001 for ; Mon, 10 Dec 2018 07:51:13 -0500 (EST) Received: by mail-wr1-f69.google.com with SMTP id 49so3503201wra.14 for ; Mon, 10 Dec 2018 04:51:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=DGAUj6PSqqPDQJ5J6R6pKlBVa6bTvYS48OkmKh4Sulk=; b=mmG0k7EAuwfGHmo6qyFchn1usat0mSfVkAEHYLv1XRNjL+VDo48WQZqq4wDQbIEczb M5q4RhF2TnLsNeXPeT888BZI17fc3CFcPr8bHszORrZJQ0UxNnh3IQQPnjdZDxmbujgq wZQ88N+05uB2rd6fCwO7RODQPbX5RhmqF7uhjWZRAONnpifr6ZZbHGzso8YcBsBUMtjU Tl8dK4ZJ9KX6oKm9nHCY4e+z3O5CG7oTRjQU32XNC/7YpBLSLBsZfBb0pPEFFOEi8ShN RzPhHNbjygSy2QkJNpjWIy3oHlinMq4XvUyG8SgO9GSkpnLF+sAMUdavr3u5z8dz9fWZ 6rYA== X-Gm-Message-State: AA+aEWa8jFnC+ZyMJTcKDfHH31Q8e057XqINVxFcc6PqDz8MYIn6kwLr KqF0YhjeJAK9LqyvAT87gmGKaBuR/80LFQr6NSzf5WSgDhqHQnSiVmObxtmvXLz7XN7bbBs0GA5 NuCpjtVj/5GifpOPLPephPE5DMpWcjXKhckKBpVqRmacVFiqSxCvVWIE69chqwgOhBiyKydoGl3 yw0cwK0ZAOliWInLv7A9YzRd6UYkMyAkTkoqLLvI4a1YeB8WFr4wBDqWFXKA8scoK8q8jSTRLaW 1dng6oZeOrGfA5S8VnIBcF8dL9h1jYcjbeAqscE3YD4GAxMXIZJ5VwgKYoFt4OXbjq3hVRKDFJR JtEi/rUtjqvS9UeHvULFPlAHY514tuV8Z9cvf1nsc/M9bMtFXdCe2yF7FIIZNMNiQZQyEyqV9Sw + X-Received: by 2002:adf:83e7:: with SMTP id 94mr9763463wre.278.1544446272565; Mon, 10 Dec 2018 04:51:12 -0800 (PST) X-Received: by 2002:adf:83e7:: with SMTP id 94mr9763420wre.278.1544446271703; Mon, 10 Dec 2018 04:51:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544446271; cv=none; d=google.com; s=arc-20160816; b=jDM/4ijfZIZUFVStxpbyXW/mn02QrpDNeimrwQvpSMvU4zFlP6sqDFi5+kIkXNiVNb HZK4S8PTVeuYP7BCL+7qmpIHK2IEp9ugqKl5vZeDcmLkNQ01VRw/p1jpzW9ER9r9xSAc aY7/smKtaWlouoyuKV9DVZQb1NjLaF+K4Y7tCMa+vC4xUiwpShEZEhU5anv+KE1AAG/M l3lf/e0bcGVJPFAR5o4IZ8DpRI+mP/6gc2WeKfrXFT61LXDLGMgGnZEFjeBGukPK+kTl km9qejvXRpc8oezXPo3yWbVlqUAwXdma4MrB8P2QWnP5NPXnyRqJ5Ud3hHjZ3yjROgWt HQYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=DGAUj6PSqqPDQJ5J6R6pKlBVa6bTvYS48OkmKh4Sulk=; b=iXG4B+VNn/6v4gL4PsOtcVfPI0m8bhJqNql1UOgAiC5LUvXrL8kgXcIWRp3+vTie48 0nAojS8KVclq5oI3aT90MsYUxEpOdJxA6lEUGpxZgUuqfU7IBQjn4g78YQ802fT7tXoq czbumDGDYBB1jBAEYtU65ZHAZXpJUIMkWH/avFdlRo9WfticXKa21MQZGN8R1CMkmo4n dydNHGlGdS31/lJdRSiz+avECUEyfZp+qT62ARBY8+4kLShpM4etk9LpQvR7yLLM5k2Z JH8bQtSa+ucnRr0iTeLgdVvmM3IiJxjIjVJYaNQ96Epur6I04UnfszXeWNxMQBOGUyTp /o/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gls6f17i; 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 Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f187sor7296713wmg.13.2018.12.10.04.51.11 for (Google Transport Security); Mon, 10 Dec 2018 04:51:11 -0800 (PST) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gls6f17i; 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 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=DGAUj6PSqqPDQJ5J6R6pKlBVa6bTvYS48OkmKh4Sulk=; b=gls6f17iFdY+aaMHKZj2c6iqSD/1QrF4roruo3c5l5rPA1aVvvzHjI2CFqg/lmlOS5 QV5WzVIcjFGeG5EZOAQBUSLUhKGejG5O9B8bsP3m0ZDDbDXlypr860QwpgdjRFT3VtOy XxeDJnbsSvMDNeVg7Zd3WWKgfoYfCaUgEKOfQw5HnKoHFqbh4YmdPnz+wYY39XjVd+O7 nOiFe7/AFJYVdSf7VYpOu//HoHkRLNS028ysC6yapgWia3lzb7Jo2WuChJRuNCDkW4mV cPqpApKuM6RsIoZYmQ0wgoKMKNyLL+EL+mT4Ax0maE+25TL9RSBHw3MXHz8+SN4ZTCt0 F53A== X-Google-Smtp-Source: AFSGD/Wfd26kZrXesEpia2lo9KfLrUJNSZ6LeKcsVzx9h0ZIx3ectSG+FrTDJ+dLbEuGhtbGIsbJVQ== X-Received: by 2002:a7b:cb18:: with SMTP id u24mr10123577wmj.138.1544446271115; Mon, 10 Dec 2018 04:51:11 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:3180:41f8:3010:ff61]) by smtp.gmail.com with ESMTPSA id l197sm36893363wma.44.2018.12.10.04.51.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 04:51:09 -0800 (PST) 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 v9 1/8] arm64: add type casts to untagged_addr macro Date: Mon, 10 Dec 2018 13:50:58 +0100 Message-Id: <07836d7852b5c2d9588e28e4081a6f783689377c.1544445454.git.andreyknvl@google.com> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog In-Reply-To: References: MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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__. Acked-by: Catalin Marinas 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 07c34087bd5e..3c3864ba3cc1 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -101,7 +101,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