From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3D72C369D3 for ; Wed, 25 Sep 2024 11:48:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A7BD10E951; Wed, 25 Sep 2024 11:48:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="XD4+pg7F"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B3EB10E94F; Wed, 25 Sep 2024 11:48:50 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F01DB5C55BE; Wed, 25 Sep 2024 11:48:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA8ECC4CEC3; Wed, 25 Sep 2024 11:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727264929; bh=55nMLxx/UZJ2uaNMpAgm4Di+rgIcbZp2i9kYD6oDQ3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XD4+pg7Fw3lAke4Jp4uzydrMd/YLGikvynzPOGGNFwiI5lYQ8Dpr41JWoqpPC8ql1 zPOAQ4j/G2tCiXa4Zqx3jKZnaTC40Pd+f1qoyeoVVep6lVP30hxB/9Bo28dWZ6b92d WmfupR/zinjkUPvzvYOrLoGcrzfmqHQoJqQvBksgy+K1DpMQTXaAZCC2bqAxy+Aeow AqqTuasEQgXD2dxdcW/WXnQiRCpANFhNZl2/Vc/hbi5Oz7JQ7mN3eQP1vVkEE0JeO/ ZT9GbmCckA9YmVRI1LJ7Ii2tghAjFC59y+ycPDyyau8e9ITyxSbjN4E9qLjMVk+fJi 7M6TYBtKayQmQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alex Hung , Rodrigo Siqueira , Jerry Zuo , Daniel Wheeler , Alex Deucher , Sasha Levin , harry.wentland@amd.com, sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, wenjing.liu@amd.com, alvin.lee2@amd.com, george.shen@amd.com, dillon.varone@amd.com, aurabindo.pillai@amd.com, gabe.teeger@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.11 182/244] drm/amd/display: Check stream before comparing them Date: Wed, 25 Sep 2024 07:26:43 -0400 Message-ID: <20240925113641.1297102-182-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240925113641.1297102-1-sashal@kernel.org> References: <20240925113641.1297102-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.11 Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: Alex Hung [ Upstream commit 35ff747c86767937ee1e0ca987545b7eed7a0810 ] [WHAT & HOW] amdgpu_dm can pass a null stream to dc_is_stream_unchanged. It is necessary to check for null before dereferencing them. This fixes 1 FORWARD_NULL issue reported by Coverity. Reviewed-by: Rodrigo Siqueira Signed-off-by: Jerry Zuo Signed-off-by: Alex Hung Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index 67794497457d3..913adca531fc4 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -3241,6 +3241,8 @@ static bool are_stream_backends_same( bool dc_is_stream_unchanged( struct dc_stream_state *old_stream, struct dc_stream_state *stream) { + if (!old_stream || !stream) + return false; if (!are_stream_backends_same(old_stream, stream)) return false; -- 2.43.0