Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp802437rwi; Wed, 19 Oct 2022 03:12:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nxEAJQRsJPSrxnfiDoeXfnWMJenJfCYqNwYuhSLADz2cEbkuDjMyKhqCurtWf4o+6gLSi X-Received: by 2002:a05:6402:f94:b0:459:42d7:ea9a with SMTP id eh20-20020a0564020f9400b0045942d7ea9amr6517894edb.392.1666174336465; Wed, 19 Oct 2022 03:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666174336; cv=none; d=google.com; s=arc-20160816; b=w+lXaJ5WO4jXYbi0EUQ4L4sjCKquVoNlSR4Of4Gr0iM03wlhq2Mn/DJlICeHeLJ3gy Nm9HCa7lMjP+hiXX0OPDBbsxpkPI1YCUcNfOWVeF9CxvKHfm+SWlMy+kKviM3NK4hkml iUw6HxVTyn1HBteay/PxCx9C/hQlMnkidyTmDD33V9mf16r30WFZ5zqga0yYcqE9/lcX 9AhD/MGJ6wZwgvDmJOo4FCWVx0ULPt5jv2chxjQQvnW0WJWTHWZSi1gQP+Kz7hDC5cs4 hqCaoi9UfMHPMOe3PSzXQ7r67HmHRYFEMcmYxwwamEGigqI62NoYOsLDjnCO+aRz83Pr 1oVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YyopP+EbhMsXY87INQd8mfSPbYfh92OsPAQumiSylqY=; b=FfKoWpZlM9NMWeIVa9mBKDs8T8W3e3qDDO/xrB7A1nhIa/wUuwbJguDUqnBB710X/D hY3Kd1gD27j0rr/oCcgWJQBGEdYSWMiHlDLeSALHvoAb4GSvYRw0XfBP3oW0ksD9N+Ea DFGvYuq/K6QOuKx62/jjCZXvDK7J42NR9E88dQBWsMwMiz/uZAH+dbadl2SHMPHLMpQk gjjw0LbPzGToBTtTYWMfIlj4HCFjbbaYOIn3vODrs17hzOZiDuHrxZiwT+39bnTLwph3 28o67IRVZMCCjO0kkZ/1iir9mNejfNiEMoOyihszt9jSvTWOjmx5as4IyPjlboLd5Y9x rr9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VkSHH1Vq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020a170906c20600b0078d27c1c8f4si11299919ejz.696.2022.10.19.03.11.44; Wed, 19 Oct 2022 03:12:16 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VkSHH1Vq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbiJSJbU (ORCPT + 99 others); Wed, 19 Oct 2022 05:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233607AbiJSJ1j (ORCPT ); Wed, 19 Oct 2022 05:27:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FD03E77A0; Wed, 19 Oct 2022 02:12:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF9F56185F; Wed, 19 Oct 2022 09:10:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD6D7C433D6; Wed, 19 Oct 2022 09:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170645; bh=Bl4G7PhvvFyNlas+R2mIUh5HCYKgCqnCPCHdtZQ7cm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkSHH1VqtLGq3plhapVtGV+n3lH1O+zSrWbMFhDlFqQbaqskONM6uPnkrvlv0ixp6 zQpeuVKN2+OLWdI7k0XC3H15MvAb1U7QltXqY66Un8be/4Z/LutE3EJpgd8PxduuOU 1npNXgJ2H6bBxg25dlD31cLIo9t2AvetcCdy/8FI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Gow , Tales Aparecida , Alex Deucher , Sasha Levin Subject: [PATCH 6.0 733/862] drm/amd/display: fix overflow on MIN_I64 definition Date: Wed, 19 Oct 2022 10:33:40 +0200 Message-Id: <20221019083322.330191882@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: David Gow [ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ] 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. This causes the following warning: ../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19: warning: integer overflow in expression ‘-9223372036854775808’ of type ‘long long int’ results in ‘-9223372036854775808’ [-Woverflow] 30 | (int64_t)(-(1LL << 63)) | ^ Writing out (-MAX_I64 - 1) works instead. Signed-off-by: David Gow Signed-off-by: Tales Aparecida Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c index 6ca288fb5fb9..2d46bc527b21 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c +++ b/drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c @@ -26,12 +26,12 @@ #include "bw_fixed.h" -#define MIN_I64 \ - (int64_t)(-(1LL << 63)) - #define MAX_I64 \ (int64_t)((1ULL << 63) - 1) +#define MIN_I64 \ + (-MAX_I64 - 1) + #define FRACTIONAL_PART_MASK \ ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1) -- 2.35.1