From nobody Fri Dec 19 21:47:40 2025 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 BA41C28CE4C; Sun, 24 Mar 2024 23:48:19 +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=1711324100; cv=none; b=TiQVDcV3lyiw4CZJ4x2qKFAvcE69B0h/ZnWNftPr9NmXp2SK3pX6wrwBjARfL165D8OLSkxmLPd4VERX53GfxWzbUl/yugfsfWokzO5KM5Yhp3QbvAVaqwwV2haNSDh1wl1qevGoL4pdLEn1+xQewnX+vcktMMiGjJDIVH8Ww80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324100; c=relaxed/simple; bh=NhapjfnB4Eeq7LvrvruOrdqknPKBH/KR7oS/O09bMzI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WOF2FYbFzF0SkjrjWCuqEYQb4K4D3htI5Ef+tVQpeMu4uYLo9jnt19FT/Dphe5VMOvgwRicdivJP2SAlNZ5nkUTqgGUmdizwcOHyitVuaylM9HBNj1tKb1TCVxhmv/hWVdL/yhTzhUzxuqXlcVOQPkjvcMwgOMeWNUkcH4Mg0P8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iGhb/Dja; 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="iGhb/Dja" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97656C43394; Sun, 24 Mar 2024 23:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324099; bh=NhapjfnB4Eeq7LvrvruOrdqknPKBH/KR7oS/O09bMzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGhb/DjaKHsjc22UIoRppEf1y5FI3Lq88zmWlYSWN39dxv4k4T3S9cXsNIObONB/W 33tjNi2VjUQgmBrUfRospQnol28wdlMvzryclJGOKk9nVfgxx90poHtbwHAXUfyWGG GRu89x0wlUmRdBS3mrnni/K484E8cwGohCI8esF96LRzss27r4O/Ecj1mK+8TMXWj4 AuczcPnfGOzk8I7f+TKy4dTRNRbUr2ex5LLctqNqt+Kvw2e68KDO1s7WwQYbpX6z1n 3MbSLeH+km2u+1bkVAaSx8DX+Vl/knXk2gK0QQFp/ya9/rRyxramfl+AEtTvQeJ2a1 03G27tofgGvgw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivasan Shanmugam , Wyatt Wood , Anthony Koo , Rodrigo Siqueira , Aurabindo Pillai , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 098/183] drm/amd/display: Fix potential NULL pointer dereferences in 'dcn10_set_output_transfer_func()' Date: Sun, 24 Mar 2024 19:45:11 -0400 Message-ID: <20240324234638.1355609-99-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234638.1355609-1-sashal@kernel.org> References: <20240324234638.1355609-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Srinivasan Shanmugam [ Upstream commit 9ccfe80d022df7c595f1925afb31de2232900656 ] The 'stream' pointer is used in dcn10_set_output_transfer_func() before the check if 'stream' is NULL. Fixes the below: drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn10/dcn10_hwseq.c:1892 dcn1= 0_set_output_transfer_func() warn: variable dereferenced before check 'stre= am' (see line 1875) Fixes: ddef02de0d71 ("drm/amd/display: add null checks before logging") Cc: Wyatt Wood Cc: Anthony Koo Cc: Rodrigo Siqueira Cc: Aurabindo Pillai Signed-off-by: Srinivasan Shanmugam Reviewed-by: Anthony Koo Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/dr= ivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c index c4c99bc7f2890..3059739695d8c 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c @@ -1470,6 +1470,9 @@ dcn10_set_output_transfer_func(struct pipe_ctx *pipe_= ctx, { struct dpp *dpp =3D pipe_ctx->plane_res.dpp; =20 + if (!stream) + return false; + if (dpp =3D=3D NULL) return false; =20 @@ -1492,8 +1495,8 @@ dcn10_set_output_transfer_func(struct pipe_ctx *pipe_= ctx, } else dpp->funcs->dpp_program_regamma_pwl(dpp, NULL, OPP_REGAMMA_BYPASS); =20 - if (stream !=3D NULL && stream->ctx !=3D NULL && - stream->out_transfer_func !=3D NULL) { + if (stream->ctx && + stream->out_transfer_func) { log_tf(stream->ctx, stream->out_transfer_func, dpp->regamma_params.hw_points_num); --=20 2.43.0