Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8080118rwi; Tue, 25 Oct 2022 02:07:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7R7p0DUUgSyqbCDTRsXRZvBUsSmM2xMz8tfKBbN8y/HnEqwQfGsjpBKzd5xtJpkocgyZ5/ X-Received: by 2002:a17:907:971e:b0:78d:e7ed:7585 with SMTP id jg30-20020a170907971e00b0078de7ed7585mr30450460ejc.258.1666688833171; Tue, 25 Oct 2022 02:07:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666688833; cv=none; d=google.com; s=arc-20160816; b=Q5J+YVEj8mHeS6WSmE0spzML6OB1HKxTceIH4N88wrtLNufaVCiLLNP7o0XYQSSTZv SJDQ5G5NQ3+hjuI0LaCMpG62pc5HMF4XBUJKAsFIx4iWPFPFvpI5ljcVOeLTSggLrOss zDMs7jBxEd9oMOaLYukyg3EBbyBAkpO8yAWCWgxYRF6CpPivbX+0LC/3zb+KrhD3YMzo gszjRicSNDL/zP2nhFiHzwwFxP2T6kTQZ5hfO2vO7zpsFpWH87erOwXdzHf01moPa4NC wT8jCtFu8ownI931NJB4rGldZF0oWLvjqugA16TwJxtmzbVnDw0RxuyZbL2XNfZMNA5x gfdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=a5HADHuQkYF4q9r3FWLmyeS4KG77WL4Qyv49OuWqiJc=; b=eeGSZ+WHs0v1YuhAAK9+6j+iyBE6we07FRKFLY5XOmFJbcLn1/qlcRCVsocbwqxGVo yZj+WAGkq/kSRKnGGlf5dBZsB63euU7qfjfQ5n3A539tyc9r9tUao8k9mMItAZ4ZH/1p 6gWDoCoFkXOavtHGWpLNZkkXxTK/0uvALielUAj+3xg2kWISPMOsUWaH4UWNPAhtQIFj nw383d+hdUdZmN4PpAYEhyChg48Ut13fgG9FflAaYfVKre1VLUljnd9NVrxWHyVcqHQS vGAwHlDiWuskjisSJGUbPx76AuMAWzZsjM0H+bOwfLEwFT8eViR7L2Ev4714Mxf3NBpZ 9aHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a056402358600b0045b265a1712si2696751edc.595.2022.10.25.02.06.48; Tue, 25 Oct 2022 02:07:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232213AbiJYIWn (ORCPT + 99 others); Tue, 25 Oct 2022 04:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232142AbiJYIWl (ORCPT ); Tue, 25 Oct 2022 04:22:41 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B853CEF5BD; Tue, 25 Oct 2022 01:22:39 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 5DB1E1C0016; Tue, 25 Oct 2022 10:22:38 +0200 (CEST) Date: Tue, 25 Oct 2022 10:22:37 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, David Gow , Tales Aparecida , Alex Deucher , Sasha Levin Subject: Re: [PATCH 4.19 195/229] drm/amd/display: fix overflow on MIN_I64 definition Message-ID: <20221025082237.GB9520@duo.ucw.cz> References: <20221024112959.085534368@linuxfoundation.org> <20221024113005.440623785@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="f2QGlHpHGjS2mn6Y" Content-Disposition: inline In-Reply-To: <20221024113005.440623785@linuxfoundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --f2QGlHpHGjS2mn6Y Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: David Gow >=20 > [ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ] >=20 > The definition of MIN_I64 in bw_fixed.c can cause gcc to whinge about > integer overflow, because it is treated as a positive value, which is > then negated. The temporary positive value is not necessarily > representable. >=20 > This causes the following warning: > ../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19: > warning: integer overflow in expression =E2=80=98-9223372036854775808=E2= =80=99 of type > =E2=80=98long long int=E2=80=99 results in =E2=80=98-9223372036854775808= =E2=80=99 [-Woverflow] > 30 | (int64_t)(-(1LL << 63)) > | ^ >=20 > Writing out (-MAX_I64 - 1) works instead. While this probably fixes the warning, better fix would be to include limits.h which already has equivalent definitions. Thanks and best regards, Pavel > -#define MIN_I64 \ > - (int64_t)(-(1LL << 63)) > - > #define MAX_I64 \ > (int64_t)((1ULL << 63) - 1) > =20 > +#define MIN_I64 \ > + (-MAX_I64 - 1) > + > #define FRACTIONAL_PART_MASK \ > ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1) > =20 > --=20 > 2.35.1 >=20 >=20 --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --f2QGlHpHGjS2mn6Y Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCY1eczQAKCRAw5/Bqldv6 8pVCAJ43iW1FofsAsPLtMMAPmphPLrb+YQCgknCNaLt+z1Rby0N/lPRR3e0r9Tw= =H1iX -----END PGP SIGNATURE----- --f2QGlHpHGjS2mn6Y--