From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6F3C192D86; Wed, 25 Sep 2024 11:48:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727264915; cv=none; b=CSdpa7qWfsu1czOs4t4W/MmyiUQkEXSa7+UagaXwilsN40lmWSOtKdFPHmbH5+AOdktK+/b6zCLErSa+LCR/1YYlhAF6s57M8LqCHGYwK08jJijUaMI3p5FnO5ecee1NRpLrjVMYpIgWedmm7TJXDW3OU1ReEXR/m1LAdP2h3ck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727264915; c=relaxed/simple; bh=Eufapj7oGkauJLGfxR2Nn/1U62Otj893rjf06mxC+2M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N00GZAlU6/2kGTLXVShREOjBeM9u4Te/VNLEdk/UpIdiBteKVJcdrF+D04v/8V2zmR/h+A9826QKekh7MuoaJzcdDrTMqWd8yccPVlXXGjhaHEl421LgopQIf5PBqD49XZbomUDuTFG27w8Ok1E4ia1S3FAls08vwRZG7ZdBS3o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d8AdK2BL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d8AdK2BL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDA80C4CEC3; Wed, 25 Sep 2024 11:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727264914; bh=Eufapj7oGkauJLGfxR2Nn/1U62Otj893rjf06mxC+2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8AdK2BLUM2QBskibDhw7wY0x9Kn24Uvw8aTGHeUiB0uI4sg77FzhJRbq5sATBesd odsSXRFI9geWygdr4jJwEBUJFUGjKgQYal6R/WagJP0AGYye3pmRbIFvlOknhDlOMn WCUgVSZqugW2ZuI7wa/EA/Mt8RsWTvC8YaUwCp6ENs5xqZst6ON8eDA+OJpApBrRqg IJ6lBvvavTtKpTaFi8esdeBegkDyVmMrxPtC3FnUdUccUydnIkjzwLyUBoBhqLWOkB /sNwVVZPPxyYl13isWJVOpTcL7ObbJuajRhmTQhTuoNzk/3KDETYuRhE88Sk5rLQdg +YNRJ5FWLWEGg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alex Hung , Nevenko Stupar , 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, alvin.lee2@amd.com, chaitanya.dhere@amd.com, hamza.mahfooz@amd.com, wenjing.liu@amd.com, sohaib.nadeem@amd.com, samson.tam@amd.com, Qingqing.Zhuo@amd.com, dillon.varone@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.11 180/244] drm/amd/display: Check null-initialized variables Date: Wed, 25 Sep 2024 07:26:41 -0400 Message-ID: <20240925113641.1297102-180-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> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.11 Content-Transfer-Encoding: 8bit From: Alex Hung [ Upstream commit 367cd9ceba1933b63bc1d87d967baf6d9fd241d2 ] [WHAT & HOW] drr_timing and subvp_pipe are initialized to null and they are not always assigned new values. It is necessary to check for null before dereferencing. This fixes 2 FORWARD_NULL issues reported by Coverity. Reviewed-by: Nevenko Stupar 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/dml/dcn32/dcn32_fpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c index 9d399c4ce957d..4cb0227bdd270 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c @@ -871,8 +871,9 @@ static bool subvp_drr_schedulable(struct dc *dc, struct dc_state *context) * for VBLANK: (VACTIVE region of the SubVP pipe can fit the MALL prefetch, VBLANK frame time, * and the max of (VBLANK blanking time, MALL region)). */ - if (stretched_drr_us < (1 / (double)drr_timing->min_refresh_in_uhz) * 1000000 * 1000000 && - subvp_active_us - prefetch_us - stretched_drr_us - max_vblank_mallregion > 0) + if (drr_timing && + stretched_drr_us < (1 / (double)drr_timing->min_refresh_in_uhz) * 1000000 * 1000000 && + subvp_active_us - prefetch_us - stretched_drr_us - max_vblank_mallregion > 0) schedulable = true; return schedulable; @@ -937,7 +938,7 @@ static bool subvp_vblank_schedulable(struct dc *dc, struct dc_state *context) if (!subvp_pipe && pipe_mall_type == SUBVP_MAIN) subvp_pipe = pipe; } - if (found) { + if (found && subvp_pipe) { phantom_stream = dc_state_get_paired_subvp_stream(context, subvp_pipe->stream); main_timing = &subvp_pipe->stream->timing; phantom_timing = &phantom_stream->timing; -- 2.43.0