From patchwork Sat Oct 22 07:28:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7615 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1106791wrr; Sat, 22 Oct 2022 01:39:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LL6VwQldZcCwBEFR8ddqYdD5GZpMtqp5yWCoO5w3ZobLAW/XcVPkvrjuf3Uv7SK28yLFU X-Received: by 2002:a17:907:78a:b0:782:2223:a7cd with SMTP id xd10-20020a170907078a00b007822223a7cdmr18698164ejb.532.1666427942913; Sat, 22 Oct 2022 01:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666427942; cv=none; d=google.com; s=arc-20160816; b=Pu/H7pCqYjFsSa6iNUBXeO8jW1ozLjqB1Aeem9iSdXRblPBT1nQ1J6RGfDqGHyjHts bkBCBdDdxpRIR6TocANgIEXIbLSAyYa7C+WxxjmoO5t/q+Ngpu1L0WY35MoTFp7e1R9u OP19IOaebmRBp35+4Tlp8Tfze1pmrLS6BKtZBU0I9nxVU3s6AQLQR6lG38CHa1LEBBJr GV8jgmxXB47viRPw1J219YPiP2sDQevLUlx3lim915P3JR18mUefpJuvRhENXroXWV90 EpNwKFmo9BGNXj5KC8sBxPgoyK2msUq+M0mVFNNsgXuly1xovMJZhKTZkBj2LCV8iOXX R3FQ== 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=uFK+XL7JiWy14ee6DEMgUdiWWS3CwTkR20pG2iVJVx5qyAni0znJPuchU05l1HjzoF 1f+ahZRUgYCvBlksQeI564C9GsuNRtckgYETogbuk7QaOUNscmy/J8f4qCfydqE/NRsE LOX4BdNdKuWq8AkC/UakNhLZl8KL0j8IaOHdjjW/sAcZKn6Mei7l7S1DfbhXhBo3C8bp AyqcAdmP8OK7Lra6EqO9mn1aoI4vi+gJXJdvC+f87GwxHJHB8OaaHBnQeqZk8ooxHDiU F5j0WjK68YgfHEj/881bgufa52yUvA2R+J0hnHapxPopkGiiRrX9ebvx9URZE6teEz6O h8bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vvYM51Fj; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020aa7cf10000000b00456eaa4fb1fsi10619521edy.223.2022.10.22.01.38.35; Sat, 22 Oct 2022 01:39:02 -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=vvYM51Fj; 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 S234070AbiJVIgQ (ORCPT + 99 others); Sat, 22 Oct 2022 04:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234465AbiJVIa4 (ORCPT ); Sat, 22 Oct 2022 04:30:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E99192E530A; Sat, 22 Oct 2022 01:02:58 -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 ams.source.kernel.org (Postfix) with ESMTPS id EC1C8B82DFC; Sat, 22 Oct 2022 08:02:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D7A9C433D7; Sat, 22 Oct 2022 08:02:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425746; bh=Bl4G7PhvvFyNlas+R2mIUh5HCYKgCqnCPCHdtZQ7cm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vvYM51FjT1pLucHEk7UKNZEeGl6xO36lBkadEVqTVDekK4AtyTqmbUcwCRiDw7nk2 O1TEWW0gZCzD3IKwB8hE6c4dPOFDAvQt9ElPq6THBJnqiAbQlNQdvxxO1Ylja1qoNN 83EYxz6NDBOtJ/obvzCj9WivlKBfTvev+fQgA/TU= 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 5.19 603/717] drm/amd/display: fix overflow on MIN_I64 definition Date: Sat, 22 Oct 2022 09:28:02 +0200 Message-Id: <20221022072525.133450705@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376346347690556?= X-GMAIL-MSGID: =?utf-8?q?1747376346347690556?= 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)