Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp190253imu; Wed, 21 Nov 2018 17:56:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wb/cEweeGdJbO/pRMssKY7SyWT6hkhxpRqLpPRR0Z+q20Am/LpsM2YPBgtrOVInDmkBHOk X-Received: by 2002:a17:902:1745:: with SMTP id i63mr6666875pli.145.1542851770532; Wed, 21 Nov 2018 17:56:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542851770; cv=none; d=google.com; s=arc-20160816; b=EEl9jYh6V0OxZAKZa60wuDT4u9jPU4E4Oas0Z/5vQ9Utzb9vmXB84sL0iwYduEx9Se 7gJOdnuYgnTcHFZitAUTuSRldswHjWqyigCDt4SzDe+xfSp13kkdLcro+Ri9E8R1KE9M e+QVKimJlGNTfZ21HCY+LiGHn5K1NhHu8CVOmYFWmL7isCOByNhpPIH8Wal0RLvYevzy Zr0NFUg/R3MI4tQIif15VOjpeQQA+RoOY/iwrOEJLbvTJl+IzSkLV+JaVI6gpjeDnNX7 /OhmmFD5YHVotg018SJVg+n8sxGNlIqaFLl+rPBV1hCYo8FZwTENMCiIoRVxpBq2I00K WT6Q== 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=MUEwmlxgbwmlKnHk/DUgRYKmjuOz9NWnikf3tYF6lGE=; b=R10F6nuQJh9VCJQtitPMYdsFU3ItHrzB/kGpzJPd3EFOoeHEqq6ViOVdS1wuTODrXK MTYDUysyyV8PEotjGSPojkAyzS+s7bmZgg5rKq8FlFwPoNHL2k2+8/zu8dCEWhBIV8zy KDFhoFgjSwxTv9a5dDXSWB759t9bLRyxcfZcEkJyKGyRpu73xRQD96bXhvvfKSOt18+4 Md3B4Wckp8g/Z0IjhtivtPS+RgU//5LEVgRKFa3iuSrxnlifdxv9l/5OztjAybYabUmR RA8J9Fa1IQPh0/cQse0zU6GoQiaScwlFj0srnHz2O8/iL7qP8IjBNYSjqT5WoVF6KY3D 1CaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=porwibC3; 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 c3si24798922pgi.370.2018.11.21.17.55.56; Wed, 21 Nov 2018 17:56:10 -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=porwibC3; 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 S2389062AbeKVFrR (ORCPT + 99 others); Thu, 22 Nov 2018 00:47:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:42742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729280AbeKVFrQ (ORCPT ); Thu, 22 Nov 2018 00:47:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 17984214D9; Wed, 21 Nov 2018 19:11:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542827503; bh=fqsuNUL0lks6KynJKOZwaxT4+5MvK8I60Xx4sLlzS7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=porwibC3VX+GDwU29INg13p4t5GUrAqCTw9nQniXko9utsEtrU6jwswGtHxfO2Gjk oyY2nKz1Q7bCdF0u18lH6I10uLFPCprrljRkiwskZpKD9+0OBRcjdo8vPUm20PYeRj QRgBK34L1citdtovMu85CYSaY+7QuttTjoGLPgMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Russell King , "David A. Long" Subject: [PATCH 4.9 57/59] ARM: use __inttype() in get_user() Date: Wed, 21 Nov 2018 20:07:12 +0100 Message-Id: <20181121183510.556421815@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181121183508.262873520@linuxfoundation.org> References: <20181121183508.262873520@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ 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 --- 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 @@ -115,6 +115,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 @@ -183,7 +190,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(); \