From patchwork Mon Oct 24 11:33:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp638416wru; Mon, 24 Oct 2022 13:26:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4FOz+iz/kUHSYwb+i5YRj7p2XdX1cggPN7zo9/Mvqof6j29AatGCKOJ1r11ClybPjFXooQ X-Received: by 2002:a17:907:3f27:b0:78d:ad42:f733 with SMTP id hq39-20020a1709073f2700b0078dad42f733mr29952441ejc.320.1666643213110; Mon, 24 Oct 2022 13:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643213; cv=none; d=google.com; s=arc-20160816; b=bLPrjTjdBD3tlUXwNKIG1OzZuykfYzeA4dFDyqcsPsIQwHwuzkbWFtcu3wl8rmttts H8K/2Kl/VW7exLQookqej5hBr8FlxcZuhEMKlSfYk++1nIuj2t9OrvnmdD4OQJhbiYEm UkDYAkh8/W3Qa4p5nw1/hvHj4KunS+U52NkbTt5kNkBZtlheMsyUvX35Jh3YNtacqVt7 LxMMwVq+BQ8hQy4AYtilMWBrQ5X5UvCNx6x+5/DIGKlTu6mfC80qYDxTsSdh2oxKHHKb 4f/RZSEIpTD4hQ94Nb8nv6S4XPhWZz9lXI6gkPllwMQcBIkCMPWiXHzXZyuKkUQ6BGKe 2sLA== 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=Nw8smBc/kJ9I38yu9mBVynPNq+VHaVHQ03RO46iuQ3Ud/fwPewtzGaWUw0VDMQ3Ez8 +itQ+E3tlR83OFMcvnrm+CSRhj1ePgfVY31KmAatDkVNEwazATUG/5/+YTzv6QDfu5tK ju94g3q8rYmdHqDyqDm/gRcP+Pc1p8xzSRdRtEojDOB388B4iGIKw3zt9S7FDM7frF5+ 0QAEfOrnL4KtvXrw2Gj5pHvQnJDVpro6Z0jaEahWFxjDWeCQ1YjregzIJAGVefBtOhDR q22MS5nVJK/A/o9zy2bI4nmHuUWhfCrIHQPqIpUsLvBjo7KwQTq+B9JFkoiE1EaJIkEA oqLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NpU+n8hj; 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 h19-20020a056402281300b0045945eed10asi938123ede.5.2022.10.24.13.26.29; Mon, 24 Oct 2022 13:26:53 -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=NpU+n8hj; 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 S234009AbiJXUOo (ORCPT + 99 others); Mon, 24 Oct 2022 16:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbiJXUNv (ORCPT ); Mon, 24 Oct 2022 16:13:51 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56717E837; Mon, 24 Oct 2022 11:32:09 -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 sin.source.kernel.org (Postfix) with ESMTPS id 3178BCE16F2; Mon, 24 Oct 2022 12:52:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 450CAC433D6; Mon, 24 Oct 2022 12:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615960; bh=IqXIc2zb1gPqjZAiZAuDXqBufstMjobSxTTlD79UXjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NpU+n8hjn35o3HcueK+tgedoU5AolUBBS2802GKIyIncPE+l7P+kkBLfcVYXgC0Oe x/d9sgNugL0AL/2php1JhK0UcyOLZzG9t7TaHi/BImLVl56Q7i34gCDM0vgfzrNsfb rFSoZz84zqdrvxIkzYwWUvN0FxH1M59F6+gIZ+4s= 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.15 448/530] drm/amd/display: fix overflow on MIN_I64 definition Date: Mon, 24 Oct 2022 13:33:12 +0200 Message-Id: <20221024113105.320201108@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747602073751589866?= X-GMAIL-MSGID: =?utf-8?q?1747602073751589866?= 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)