Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2931742ybx; Fri, 8 Nov 2019 11:26:32 -0800 (PST) X-Google-Smtp-Source: APXvYqz4m7KcjawfxoiUlgjad8j7KC/IRSbuG6ZCvkrHpDMJazKkXk7OuBdYrXg+VhMUmgYyAa0Z X-Received: by 2002:a17:906:bd2:: with SMTP id y18mr10339815ejg.315.1573241192624; Fri, 08 Nov 2019 11:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573241192; cv=none; d=google.com; s=arc-20160816; b=sSQyONpXUY/hgB5AyyoaAFuhzGTLFWv5keXTj5BvvPN9flNnET6NECJk/UTQEijTSX 7GJn8xts3zNKx5E8ryqm8RIBwNXM6mSvXiGWtn0Ve2NCa0GyDh+Fsd5xvTLN1HtDjS6H gBZx1aurw0WU9f+NfWrQ8EfU1CUNsJNEKu/HgsYTcrOtH2DinCuIsKNBFDSDtIkliHLp h21deloUPruxmAZFrzyYw5SNuqQiCpgrTlz7egohwbGBU7DbEU8XvuBb/2XukFjgJijJ LKoL9qCJT9Y560cFA3naZP9N+GsOj7vMohR8ZXmKl6ECPMdK8TstsQd5GhH/5YGeu9hJ 2ing== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ne6eunqLIzOO3stLsNcI22tVivxIXW+6tXzIPnOC3wA=; b=p60QgYVycIYUJaqXmCSYxqoHRL2D30JBzaMNMaDTCCwgRwOpY5gYNCC2E4cEmdAmrz 5hjfkWen9CkVHG2W2zQS30APVCMz76epuJINtFUqZ1GbuFRZ6EL5eXzUlBMjsY5Ulim4 3n3vyt3FzHqG5BF2tQQ4f3mMIHQhMPo7OFQNAn2czoGfiroEjV1ZucjhEDSmGkRAuCOx KWEJnWq5jbfE1rA1Z9bbJEIRb2m3EpkKrtxCv1n+iows8yVLWCzofGzit54vpr50DmX8 nBk1s0mHVVU9BSSqzGR5CDVE9slOXqQD6Dn+yrFwFMfZa0fA3yBxB2qK7HN4U6LEdS4n /4CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ynGhRznt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s46si5347597edd.336.2019.11.08.11.26.09; Fri, 08 Nov 2019 11:26:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ynGhRznt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730379AbfKHSy3 (ORCPT + 99 others); Fri, 8 Nov 2019 13:54:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:51466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732894AbfKHSy1 (ORCPT ); Fri, 8 Nov 2019 13:54:27 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2C2842178F; Fri, 8 Nov 2019 18:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573239266; bh=zwYyAJLSObBEsF9dCOOxn6zbulyaGRBnJ+Jk5+Fl4hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ynGhRzntsXVJ/YSyVQszQi1DLQBYEMNzCpRoTiFnlueXgjKRRACoex+N1wcHICTqq VN9P5Xps5KkAjKVihU4LYGFu88GCMg0dHgc4gLnQmjUbDGaAreXH7FJnF0IZOqF9pC KDDny+s0M0NB2eBA5t9R1TpWadW1kcrxknD7o8vY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , "linus.walleij@linaro.org, rmk+kernel@armlinux.org.uk, Ard Biesheuvel" , Mark Rutland , Russell King , "David A. Long" , Ard Biesheuvel Subject: [PATCH 4.4 56/75] ARM: use __inttype() in get_user() Date: Fri, 8 Nov 2019 19:50:13 +0100 Message-Id: <20191108174758.172101214@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191108174708.135680837@linuxfoundation.org> References: <20191108174708.135680837@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Russell King Commit d09fbb327d670737ab40fd8bbb0765ae06b8b739 upstream. Borrow the x86 implementation of __inttype() to use in get_user() to select an integer type suitable to temporarily hold the result value. This is necessary to avoid propagating the volatile nature of the result argument, which can cause the following warning: lib/iov_iter.c:413:5: warning: optimization may eliminate reads and/or writes to register variables [-Wvolatile-register-var] Acked-by: Mark Rutland Signed-off-by: Russell King Signed-off-by: David A. Long Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/arm/include/asm/uaccess.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/arch/arm/include/asm/uaccess.h +++ b/arch/arm/include/asm/uaccess.h @@ -123,6 +123,13 @@ static inline void set_fs(mm_segment_t f flag; }) /* + * This is a type: either unsigned long, if the argument fits into + * that type, or otherwise unsigned long long. + */ +#define __inttype(x) \ + __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL)) + +/* * Single-value transfer routines. They automatically use the right * size if we just have the right pointer type. Note that the functions * which read from user space (*get_*) need to take care not to leak @@ -191,7 +198,7 @@ extern int __get_user_64t_4(void *); ({ \ unsigned long __limit = current_thread_info()->addr_limit - 1; \ register const typeof(*(p)) __user *__p asm("r0") = (p);\ - register typeof(x) __r2 asm("r2"); \ + register __inttype(x) __r2 asm("r2"); \ register unsigned long __l asm("r1") = __limit; \ register int __e asm("r0"); \ unsigned int __ua_flags = uaccess_save_and_enable(); \