Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2386675lqp; Sun, 24 Mar 2024 17:09:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXJLNEh9mZU7uTJ7SA1jgit8B+ZgHedhgOh6Jk+LWZOeoCM5TwbBkA1c8f+bjs+Vmc62g3np1cr7IP0SIr4sVOSUCVhNhltpdo49vA5Q== X-Google-Smtp-Source: AGHT+IGW9A5ea/3sQZdjFT90t0mVWzgqo6frZgKCKtJnV3WcCVNYGdiBAEmSd6iCaow4Aj20gzRs X-Received: by 2002:a50:99c4:0:b0:56b:8cbb:3695 with SMTP id n4-20020a5099c4000000b0056b8cbb3695mr3725438edb.8.1711325342590; Sun, 24 Mar 2024 17:09:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325342; cv=pass; d=google.com; s=arc-20160816; b=Kp8EEoqcf9PWfBsSUQsYFm7m4rHSjalzZeW0r5XzxF5E9YlQo4QV/aOgVxic9be0D9 Uc9N9fQvPy/lU4a+ArhbT6cvs9Q6KWjYo2t6duOl31GS324RpIqL4k+NJclrmH+ExK3O VwjBuSIMEpByeTlctFFjVacVmeCHG3/MmFmQcc++b21vWicoQ7WNj1CxWFaTDVVBlUKz JFfBeOS1QAkVW6gXPxKjzffrUkdeHorQfnuC1Byl2I+tI0hRjRHTkx01yvjj8tES16/N +turpB9Zc3qYKte76wq8gYORVRwPk5qJTz+bJ537pN0yAufENjByaDXFHCthJS2vN1Ce ZiMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=IAiDw4Fx64/FtPSwW90CDyY9XaI0cP7F2muGXwUtwJM=; fh=+llmFCzEqXvLbr+th08q1FWopmuKMo88bzT6hxb8ZrA=; b=yLa9Hf07qDtcGl3Rk1CRcyWQwf3LM8WUJrGYWrSZhkOe1b94E38xoKyBZObxSIRGNi 24Bdeg64wdyjMGs/16BmDeM02QdxpPJ/t43nS2tl/7bNouv0F+bqKBbog/lTnp06zhjy wbGPyi+4/oTrVmat5flhNYFhex7Y6bHzjkk01yiBfSoMu1KKXLOSB1qfRCr7GzfATz0D EQbOTixnpkFV5j6Fh2uXBd6OtT430PCuqIF0ii5A3RqF4kGdDGH8ywVaBZEktMTzwvTr i5kLm4zIzmhUaEBM82/3J1u5Z7MFGN4r4KBcbpPu2NBRRVsWKXdZ+TMtQQyw+8ucGrez R1Wg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sxmp3J1A; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w11-20020a056402128b00b0056ba785da85si2076001edv.595.2024.03.24.17.09.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:09:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sxmp3J1A; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3DFA61F2407D for ; Sun, 24 Mar 2024 23:58:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 008C718B5F7; Sun, 24 Mar 2024 22:41:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sxmp3J1A" 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 17A4167A0D; Sun, 24 Mar 2024 22:41:13 +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=1711320074; cv=none; b=TCMclipQChhY60EoqjNEuq9JztZ4Lt+KcRDygAomUdHMTgNH79V+NShU/b48TCo2eSTbKtxbchqA/zO2ukvbtQz41yqYJ2mO3CFwjs33Zv0jE1+br7Stwhm5AYwM/r28OABmhG02OEctzm4/UWikiqyK3iqWhcsb3YiOS4CXe1I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320074; c=relaxed/simple; bh=gtdV+/+x84K14c1XoNJ7EP3kgl/E7Qw1TacTh0JRCsA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pGc74D9AO/SQdbmdz8hy1qq2cc3w9sNzzDblEcq9gT6lxglG7h31WFLXCraiJw4C+I/8DoVBvzsTMedH6cVwBO5Bk/lSc8FlEh4CAr5AzsY655C7cJSK1V/NFSmZJaLz5agAa7bqR9Xzal4gcaSU4bXuN7j7QeRq6S6EgTWDlUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sxmp3J1A; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 992B0C43390; Sun, 24 Mar 2024 22:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320073; bh=gtdV+/+x84K14c1XoNJ7EP3kgl/E7Qw1TacTh0JRCsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sxmp3J1AJvEzHSfiWimXFH0a9Em4D506vVVQcxrhtLzcU5Rja18KW8ZKFQ2KH3Rjr jnuaR2tnrUa3sNK1ARDTLJaCTQ5szJ2C4n9hNOCgBle1Kwv2ZMeLP++0CU8TnmICWh rQjJj9K8CDBo3tNPVbRIDMxJcSUV05/zOMkpDp6or+ypK4cCrJvioBqAkOjPBhuBxv PS/TQ1QEBdco3AI1Y5eG7nMHzHbMz2kBXKZJ50d+sgxUZtI+sGfSBaEj1ZRLxHpS5Y unMFKmDQ1JuU9rip6QNRosSniCfAX/OVMYA15r+oFrI/C3TgI3SrdJE/3iN2I3BugD z3uqgBzj+AL2A== 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 6.8 382/715] drm/amd/display: Fix potential NULL pointer dereferences in 'dcn10_set_output_transfer_func()' Date: Sun, 24 Mar 2024 18:29:21 -0400 Message-ID: <20240324223455.1342824-383-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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: 8bit 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 dcn10_set_output_transfer_func() warn: variable dereferenced before check 'stream' (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/hwss/dcn10/dcn10_hwseq.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c index 6dd479e8a3485..f614bc2806d86 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c @@ -1840,6 +1840,9 @@ bool dcn10_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx, { struct dpp *dpp = pipe_ctx->plane_res.dpp; + if (!stream) + return false; + if (dpp == NULL) return false; @@ -1862,8 +1865,8 @@ bool dcn10_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx, } else dpp->funcs->dpp_program_regamma_pwl(dpp, NULL, OPP_REGAMMA_BYPASS); - if (stream != NULL && stream->ctx != NULL && - stream->out_transfer_func != NULL) { + if (stream->ctx && + stream->out_transfer_func) { log_tf(stream->ctx, stream->out_transfer_func, dpp->regamma_params.hw_points_num); -- 2.43.0