Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7139290rwi; Mon, 24 Oct 2022 10:16:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4flkCzZtvIqSHkmb4JtHtyPs/5tRLHbLzJYx5b3KBvBU32Btm/dGvUehmVJzD3PwlNlgWH X-Received: by 2002:a63:d202:0:b0:46f:930:ea56 with SMTP id a2-20020a63d202000000b0046f0930ea56mr5581413pgg.275.1666631796120; Mon, 24 Oct 2022 10:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666631796; cv=none; d=google.com; s=arc-20160816; b=xGXuKw/rRIEE3Q3kIEy8KvZdyZ7d+iRje1danFww8dZGBrrBmpcZCI7NGTGepG05lt T/G57bZGqfk0XQSCjnbROfpq9bGgmHbpEljSDat5HMh7gnLl9lv7KEgoa1zC9doQwe0f 66YZRaEXt6EHVKW6P5X8HYLAJ2qOR8ghgbk/PuZjSGhGbJb6WBkr2WBY2iuOonAypMuZ aPpEkB2foxb5zHb8V0Uc+Hu7DIj8dvRrqDahuvf96ntxu9Ma/a14epi9v+xM625JBNvg Yny4u/mY7656I4xnoDXf9ps/V06qo+Vjk2rcgvPbEYm9KVlpPv9zTdMULujH5phW4qra bj0A== 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=KHvQ8q1pkVHeCbyKIhhjWMf8IHV6ut5rjIl86RcQISe96P6+NPQZTr8q+NCusOhC8e 7Ex6FPqFNYRKEiSaQ/QHwGvyXFr2z/0otncKAW4cY9bBOK3ATBoidDXH8NC9iHXNTs6c 41RECE/xA4xOdPf5ABZ2dd8EUw2SlI6Yv2zrqTYk0nAVYtah+koX0jAmT8PP4GeViEqE 7oNB0+pq47eW/we0XD4xD1dPjO4CH1yc/UtNVYW9cuxIVxH2QsCyI5TC0EeR6asXUxEQ ba2TuEtoeQZyUWSWjwRaDS0o8+VTJ6lSgyR4YaUGX3HjsWK1XykWShZAFPnYlihw87kF xt0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cGWUC15k; 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 d16-20020a17090ad99000b002034e5450f0si8616338pjv.131.2022.10.24.10.16.23; Mon, 24 Oct 2022 10:16:36 -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=cGWUC15k; 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 S234862AbiJXQx7 (ORCPT + 99 others); Mon, 24 Oct 2022 12:53:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235406AbiJXQtb (ORCPT ); Mon, 24 Oct 2022 12:49:31 -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 E39C717FD4A; Mon, 24 Oct 2022 08:32:47 -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 E537AB811EC; Mon, 24 Oct 2022 12:03:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 469E9C433C1; Mon, 24 Oct 2022 12:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612985; bh=IqXIc2zb1gPqjZAiZAuDXqBufstMjobSxTTlD79UXjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cGWUC15kFAwA7wcupt1PX4XhVR2VVQha1VQlYrYg0JhO7ZrDTCXM/iyRiRXbfjfqv WFJ4x/F1Tqd70b5DtS3ajEZJCvUDSpB8xazf/O8K3USWg/CYKGcm0KapzLiR6rRFpD JrZrGll04YsThrRoC48hCvh/EmaCxzkG0hhkItY4= 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 4.19 195/229] drm/amd/display: fix overflow on MIN_I64 definition Date: Mon, 24 Oct 2022 13:31:54 +0200 Message-Id: <20221024113005.440623785@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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.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 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) -- 2.35.1