From patchwork Mon Oct 24 11:32:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp438024wru; Mon, 24 Oct 2022 06:00:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LZhHnnqmqli6gvQqgqkAiynbNLmkjS5hd2NwtrUlCdyLWkPqo4/0RAafJu2rww9Q9CUkK X-Received: by 2002:a17:90b:4b88:b0:20a:cbb0:3c86 with SMTP id lr8-20020a17090b4b8800b0020acbb03c86mr71577066pjb.207.1666616449872; Mon, 24 Oct 2022 06:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666616449; cv=none; d=google.com; s=arc-20160816; b=0v+SA4Wk1lPEOAsrSi7cTwlUX804WI3RaW+5ned4UwjwDREz3/YfgRgZuqv/w7jlOI TpnK691gHeZTnErMyx/z3mc96fZh/4OMs9DWkJQUO27H1kurRAJqfcYA0GsRYWL0tf00 tOQHtEDMGVRibKgcwNE61khvwlEdJgWCpol6IymSaLbR5Wzbx0fWjqDVqJGjWekWxJe+ qk1y3xeMHAM9wwsJn5ly4guYwLdnSOJYuGnJv2P/Obv46weF5dFheW2uVp8VOua7HMBn vVyOhoYDGfVO+sQ4SjZ58++HAjmri4+9HPlAgR2KJoI+EodQ2Oylv4eWdvosyN+IZ5dJ KaEg== 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=1Dr3mI9FUHYiQbjEBiAoH87bSdytNkYhVrNPrU371sVwflTJbElMItB418en+LcZmD PxIKYrObQq6OsyfC2neU29Ia+FYhvv6xAJoKIhsctLGDCf+gz3Vxx35ifDDrQgfOFQLG 2/+eXICTmpDjDbiY3krQr8bW57qQNG/gEoaYirBRcfEyi06Ejhc7k8SL+8haeCVHdBPC 1idCGqPqqp9cpPRuPCvfEm53+oDg7Hfx5kDPwForuS7Eweg4JGogc+EB396OWPGFYr/2 uBQzXYZITGax5VUF7iYc1ZdurjXm9JJfn9wHRTvP4o9kK4ns9c8Rh6Xz90RUjEjzQ6Yf xIlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d8D+PbmR; 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 t24-20020a635358000000b0043634245eb1si34709482pgl.311.2022.10.24.06.00.33; Mon, 24 Oct 2022 06:00:49 -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=d8D+PbmR; 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 S234849AbiJXM6n (ORCPT + 99 others); Mon, 24 Oct 2022 08:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234876AbiJXM5p (ORCPT ); Mon, 24 Oct 2022 08:57:45 -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 2F9B297ECE; Mon, 24 Oct 2022 05:17:06 -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 ECC19612D6; Mon, 24 Oct 2022 12:14:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0767EC433C1; Mon, 24 Oct 2022 12:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613640; bh=IqXIc2zb1gPqjZAiZAuDXqBufstMjobSxTTlD79UXjo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8D+PbmRT7sRrmqpiqMAuHDvxfKDP74NiL9hVjpEEzQVgqEnPsyjHDDf8xaKZzhHP IMoO8UgnQzcgJa0xEZ7NNJH4mDjvkACdu4226HSUbV8ZTubf3PbUQ8NhyPpB1I/UaI /pseuRJibGlGPKpQNLpDDABqcJvuVgegWd+GqRHU= 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.4 213/255] drm/amd/display: fix overflow on MIN_I64 definition Date: Mon, 24 Oct 2022 13:32:03 +0200 Message-Id: <20221024113010.134102885@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747574010193961148?= X-GMAIL-MSGID: =?utf-8?q?1747574010193961148?= 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)