From patchwork Mon Oct 24 11:32:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp463202wru; Mon, 24 Oct 2022 06:47:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7/5P3pdBqueNiLMw+1g2KFzEzyAC/O2mSJL1z3fEgnAXBPEZer+puUDr4nilNL8bkE/mMC X-Received: by 2002:a17:907:760d:b0:7a9:5281:9eda with SMTP id jx13-20020a170907760d00b007a952819edamr3041396ejc.50.1666619240905; Mon, 24 Oct 2022 06:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666619240; cv=none; d=google.com; s=arc-20160816; b=Dmxs28T0DtO5m9QcFAJ6YwBy4b+ATD7yPE4bt9WDEwNL3JRnjvgO9NL3gSeXUIYex7 ndB9aeROEkkvmdBdp8mof+HoXegLpC4qUSNI5WrbHF9OehnMfQUvb8NWoTnFqOrWK/9E HuhQ67vv/ShFos3vRglR8iJW+d22fVPSwl9DSm2k6YfQpHFLk7KEN3ifhgojgyPigz6w acevNkRtIg6AgUvb+UQQ86LiT8tE5KalF3Oe0hSDKtBDgsiq65BrgR1HoklyEEPGmsUJ +Ffptbs+r360NbcQ9kmoE1LaqNCTZty0mQXVH5duQvQla9c1GXIQJYkSeTOxnOBz0r9b g9AQ== 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=EOHZ/C2sGLzAOqAVEzTfcy1PhIkdX5F4TY+qivuWJig=; b=ag5OGgu6Px13oDMV28emLk0u5Kz6srPX1CbtTzp51ZLIb7TVQv+Vd9ZzexgrmN2Zpk foEV3knmY/XVaZoaz9XMwdKuzA9KWVl3fpxDNhRtBZdwnlP+Wrynse8Uz7ZcpvNpEMdU B7cxtEUHImi1PY4ll2FYyLzcM2b7Yf/bR+ZzYV3r/zD/2gcL89pKDv4XbgpnopYBQ5a8 93djn/wDeSouDUF+HlBVaQzmu46fif/LMJhW1gshDMShW51YwnxOZE0PAVnEF2uYYJP9 eJiNkCaC9Zo0OGqZMj1js9k2qhhi9TKXalbvicqCJAhMJN8Uxz+/GSOgRSmqE12G2/Ad NBUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PSzx6uOn; 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 hp1-20020a1709073e0100b0077b2e822b8fsi25995129ejc.76.2022.10.24.06.46.52; Mon, 24 Oct 2022 06:47:20 -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=PSzx6uOn; 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 S236541AbiJXNoY (ORCPT + 99 others); Mon, 24 Oct 2022 09:44:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236965AbiJXNlr (ORCPT ); Mon, 24 Oct 2022 09:41:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E07ECB40EF; Mon, 24 Oct 2022 05:39:18 -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 5CD3861286; Mon, 24 Oct 2022 12:30:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73394C433C1; Mon, 24 Oct 2022 12:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614615; bh=IqXIc2zb1gPqjZAiZAuDXqBufstMjobSxTTlD79UXjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSzx6uOnXXIiA1oVKdJYAKVwPivdwe7tTaIB3D43UmRE6ZGdHlbZsShjDbIRU3gmQ T1Q+H1sYoDFGYZ34laG45/KF09PqED+V0t6cL2CTky+U/Xfti/XNcbuIyBx/7GIVhv Geh/4jaL5vjjkhrCLrIyORfwtKYfqHs6puh3ossg= 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.10 329/390] drm/amd/display: fix overflow on MIN_I64 definition Date: Mon, 24 Oct 2022 13:32:06 +0200 Message-Id: <20221024113037.018109490@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747576936989752785?= X-GMAIL-MSGID: =?utf-8?q?1747576936989752785?= 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/calcs/bw_fixed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c b/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c index 6ca288fb5fb9..2d46bc527b21 100644 --- a/drivers/gpu/drm/amd/display/dc/calcs/bw_fixed.c +++ b/drivers/gpu/drm/amd/display/dc/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)