Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2759334ybh; Mon, 5 Aug 2019 06:24:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqysbVs/NhnC+WhhPKqUanie7kN/ifGgohFddciWh24azcb5Gv16G/CQ0ZZcEsIeUNB9/U45 X-Received: by 2002:a17:90a:9905:: with SMTP id b5mr18742442pjp.70.1565011463571; Mon, 05 Aug 2019 06:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565011463; cv=none; d=google.com; s=arc-20160816; b=kagfecjah5FfK7kNcVbfoFeEkimBG5nP79nQXVyvdbVw53ZiTMPG50DOVv4kBeHDI/ Q4wfSMZfwtdvBFixF4A25AS4nGY+TgUknM7mCy2xA5IjNV0WLnZF6gpKD7AKnFytPaGo A+ih4VNmUCwZfNkZ/Bqd3wzZrlXXTHeBc+0j2oS+bf1asF7asYVaMKvHZT/HRWDcZ0SI qgbdhmB0sgpLEVjN3WTGnPyPuhX69cXoM4excWeX8urDsfnydZQlthOxj1y1622IjIM3 n1GhQ0Zf52+vTTktudzH56ZWE3f9WtfYOFxcNfSXdP1EydupFdq4dxVpRhfh5WzSqQbf wrOg== 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=jI2q7GaF27Iiglm32wgIPsg1OMS7XiFy+jOvkPSkuLM=; b=EMW0aEWUuBAcoYPqBdbiScMc2vmSAUK7xrY1MXPyK0GECjHapCoYMXb3ALmresrm6n Q/AdghpkWz/keu0KtbFmkqbEU+WntKcs1Pb7dQKxLUJ/AdbI5JJvGcGJKbVzrgm8+BXC 5vki4KLYjK4IEdUZcD0LOfng0ITng3sOfCgZVpjXqyjSBSulID1a2Yl4CheUqNw0y1eP RP5y1FCXMfG4oUW5XkLnSqT7NucQVTOWrb5UwsAemjJxWHsvOYqRPMUTVEqMesJ51kJX VQBTI8yz12I1WU6bFPWPwanRYgYZBYmM9/FBBLZKHhcbMghoejsDENw0eGnbCw+mmdSF 7aIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rmce8MMt; 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 69si43839676pge.101.2019.08.05.06.24.08; Mon, 05 Aug 2019 06:24:23 -0700 (PDT) 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=rmce8MMt; 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 S1730262AbfHENWR (ORCPT + 99 others); Mon, 5 Aug 2019 09:22:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:58482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730624AbfHENWK (ORCPT ); Mon, 5 Aug 2019 09:22:10 -0400 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 B9B4320657; Mon, 5 Aug 2019 13:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565011329; bh=DisYABNDdL5F7NBGRgcPCFQDZVkr4bandtkDWDPTzeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rmce8MMt7UghRaHYj3roLoolvHxVoi9tKmP++rWPsWPEiGAzu9wrrnW3a4/tqRHRV 7BgOENuKGO3vDZulQXPfUx+UZxtVsMFIs+p0+yVHtYai9g1fa20qy7h1FRTPMMlQcW EvInc1yWCab0x4Z3A3a3IH8meHmvUGX6nS0hHw8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Thomas Gleixner , Sasha Levin Subject: [PATCH 5.2 052/131] x86: math-emu: Hide clang warnings for 16-bit overflow Date: Mon, 5 Aug 2019 15:02:19 +0200 Message-Id: <20190805124954.915678051@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124951.453337465@linuxfoundation.org> References: <20190805124951.453337465@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 [ Upstream commit 29e7e9664aec17b94a9c8c5a75f8d216a206aa3a ] clang warns about a few parts of the math-emu implementation where a 16-bit integer becomes negative during assignment: arch/x86/math-emu/poly_tan.c:88:35: error: implicit conversion from 'int' to 'short' changes value from 49216 to -16320 [-Werror,-Wconstant-conversion] (0x41 + EXTENDED_Ebias) | SIGN_Negative); ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_emu.h:180:58: note: expanded from macro 'setexponent16' #define setexponent16(x,y) { (*(short *)&((x)->exp)) = (y); } ~ ^ arch/x86/math-emu/reg_constant.c:37:32: error: implicit conversion from 'int' to 'short' changes value from 49085 to -16451 [-Werror,-Wconstant-conversion] FPU_REG const CONST_PI2extra = MAKE_REG(NEG, -66, ^~~~~~~~~~~~~~~~~~ arch/x86/math-emu/reg_constant.c:21:25: note: expanded from macro 'MAKE_REG' ((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) } ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ arch/x86/math-emu/reg_constant.c:48:28: error: implicit conversion from 'int' to 'short' changes value from 65535 to -1 [-Werror,-Wconstant-conversion] FPU_REG const CONST_QNaN = MAKE_REG(NEG, EXP_OVER, 0x00000000, 0xC0000000); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/x86/math-emu/reg_constant.c:21:25: note: expanded from macro 'MAKE_REG' ((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) } ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ The code is correct as is, so add a typecast to shut up the warnings. Signed-off-by: Arnd Bergmann Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20190712090816.350668-1-arnd@arndb.de Signed-off-by: Sasha Levin --- arch/x86/math-emu/fpu_emu.h | 2 +- arch/x86/math-emu/reg_constant.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/math-emu/fpu_emu.h b/arch/x86/math-emu/fpu_emu.h index a5a41ec580721..0c122226ca56f 100644 --- a/arch/x86/math-emu/fpu_emu.h +++ b/arch/x86/math-emu/fpu_emu.h @@ -177,7 +177,7 @@ static inline void reg_copy(FPU_REG const *x, FPU_REG *y) #define setexponentpos(x,y) { (*(short *)&((x)->exp)) = \ ((y) + EXTENDED_Ebias) & 0x7fff; } #define exponent16(x) (*(short *)&((x)->exp)) -#define setexponent16(x,y) { (*(short *)&((x)->exp)) = (y); } +#define setexponent16(x,y) { (*(short *)&((x)->exp)) = (u16)(y); } #define addexponent(x,y) { (*(short *)&((x)->exp)) += (y); } #define stdexp(x) { (*(short *)&((x)->exp)) += EXTENDED_Ebias; } diff --git a/arch/x86/math-emu/reg_constant.c b/arch/x86/math-emu/reg_constant.c index 8dc9095bab224..742619e94bdf2 100644 --- a/arch/x86/math-emu/reg_constant.c +++ b/arch/x86/math-emu/reg_constant.c @@ -18,7 +18,7 @@ #include "control_w.h" #define MAKE_REG(s, e, l, h) { l, h, \ - ((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) } + (u16)((EXTENDED_Ebias+(e)) | ((SIGN_##s != 0)*0x8000)) } FPU_REG const CONST_1 = MAKE_REG(POS, 0, 0x00000000, 0x80000000); #if 0 -- 2.20.1