Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2744357ybh; Mon, 5 Aug 2019 06:11:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfxoyd5dGFHNKDkwopPRkLmC4vuh5RO6ehIGS06A6/PZWOBIK+SPB1nVc7Ym1X5GNaNtU4 X-Received: by 2002:a17:90a:246f:: with SMTP id h102mr17899347pje.126.1565010685136; Mon, 05 Aug 2019 06:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565010685; cv=none; d=google.com; s=arc-20160816; b=GI8YxVdOrN4tz17n+gD43tqMUttNVPqcWuTC0sRk9r8uoyDHXJzD1KUlhbra+cyWHI Kocsb+L315xk7KUMNqVM8XQGQeTnVqALVuTBhpD//5B6t/UJNobGnhPx/UGE/AWVfHaV 3Mquom9BMOpB8kjA5lXIjrA9Wtnr0NsaGKbLGpRzThHIg783MPoiuyIkLe4lEk2hEEBy lwVyVJJAAEMnjmy1WLyOYyf/YXOP0tUZoP7Zi17VhbEHeMmBFw1LrRnm2avctj0GKBfP /qFy8INpdp2U0hqYxRdq4mp9kaDX1x1Yg5ytDyfEQImd3XKN5EloYOB8Q7Z7t0JY7Pbp 5hgg== 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=Kt06kuDKkQqD8jqaoa9nESADeJRdrqof0a4woG+RW9BaGtsjwGKzzmAT4J3apgiFYx K8UG4XsPAEa3SkszgFAqaxQoS7IUJWc+BGYMpU5o0LbNbMCYJ7Ce6SYXjwEuCd8JnRti CbrTXbU4gCsGdfFgzjZmLL9hc1naRMpIBemYzaXE6LheaBS/cqBr9ZdPb0v65PgjCbc3 JdDg78/v4a+l5oh590DujOOOtDnYRjK3jZq0wV0M3RkrjznucUCbPgPVB3DkeKeE6Fp2 MlxImj7ZbuGyFbZi21m7LdsXm3xIjUt/e0TOJP4YwX6Z874192sl0TyeVQc4g48hXNDs vJQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GpTSVB3f; 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 32si39513892plb.86.2019.08.05.06.11.09; Mon, 05 Aug 2019 06:11:25 -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=GpTSVB3f; 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 S1730255AbfHENJw (ORCPT + 99 others); Mon, 5 Aug 2019 09:09:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:48352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730229AbfHENJq (ORCPT ); Mon, 5 Aug 2019 09:09:46 -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 8126D216F4; Mon, 5 Aug 2019 13:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565010585; bh=DisYABNDdL5F7NBGRgcPCFQDZVkr4bandtkDWDPTzeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GpTSVB3fjdNtwVbGSFMPyiMFfBOPVtqF+uvF40qSwx82HIc1VuY86oZe2yQuXuJqx JhAcV+Rh64GeGUR2dNO/gTJ4jbD1oYh9P3hq5+eH1TiltOyV6eKDMvonPRS4D0fqEV 7/hb0bVbYbRYfKaO2hErexQkeTGP7RQ+DK316mRw= 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 4.19 27/74] x86: math-emu: Hide clang warnings for 16-bit overflow Date: Mon, 5 Aug 2019 15:02:40 +0200 Message-Id: <20190805124937.947204567@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124935.819068648@linuxfoundation.org> References: <20190805124935.819068648@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