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 54AE92C9D for ; Tue, 18 Jan 2022 02:23:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3607FC36AE3; Tue, 18 Jan 2022 02:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472581; bh=3v1HE+aP+jyFLtVWiJY2W1IvFFukw8FwMDbrTfFOkGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BeOObVa6mr4qLnISWQ0hVKvz90fCerEvWJV2EpXaKIZbmMKxwHZNcDxI9uvllqBvv M9jtsscOzHiAP6Te/O8inOXIDFdkXb55kIfoRHD9oT65KualauZ9/wpSER3uoG2noE AZNKICeXzZm9N4f7YSinHGvcwbcWnyJAyhYESjJwzVjxA8IkJRf+U2Ptuz9O7D4aFJ xVx14xbt1SKyajDBEqI1vDp7ebFePlQ5togsIpCp8YCmcbuEzYsv65R0vu+KCaGQ6U Hm97lP+Iw3pSGKSDTDBHlWwCvHT4lvsnuM2Q17oL/bVRxqWZ+AAhCDVAaHPzaj7naK TNgwnImlTOt1g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yang Li , Abaci Robot , 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@linux.ie, daniel@ffwll.ch, nathan@kernel.org, ndesaulniers@google.com, nicholas.kazlauskas@amd.com, Anson.Jacob@amd.com, aric.cyr@amd.com, Wayne.Lin@amd.com, meenakshikumar.somasundaram@amd.com, michael.strauss@amd.com, haonan.wang2@amd.com, Martin.Leung@amd.com, Jimmy.Kizito@amd.com, Eric.Yang2@amd.com, lee.jones@linaro.org, Lewis.Huang@amd.com, roy.chan@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, llvm@lists.linux.dev Subject: [PATCH AUTOSEL 5.16 060/217] drm/amd/display: check top_pipe_to_program pointer Date: Mon, 17 Jan 2022 21:17:03 -0500 Message-Id: <20220118021940.1942199-60-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Yang Li [ Upstream commit a689e8d1f80012f90384ebac9dcfac4201f9f77e ] Clang static analysis reports this error drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:2870:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { ^ top_pipe_to_program being NULL is caught as an error But then it is used to report the error. So add a check before using it. Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 0ded4decee05f..f0fbd8ad56229 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2870,7 +2870,8 @@ static void commit_planes_for_stream(struct dc *dc, #endif if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed) - if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { + if (top_pipe_to_program && + top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { if (should_use_dmub_lock(stream->link)) { union dmub_hw_lock_flags hw_locks = { 0 }; struct dmub_hw_lock_inst_flags inst_flags = { 0 }; -- 2.34.1 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 3BAC6C433EF for ; Tue, 18 Jan 2022 02:23:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE2EB1128BE; Tue, 18 Jan 2022 02:23:05 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFFAF1128BA; Tue, 18 Jan 2022 02:23:03 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id 58B81B81233; Tue, 18 Jan 2022 02:23:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3607FC36AE3; Tue, 18 Jan 2022 02:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472581; bh=3v1HE+aP+jyFLtVWiJY2W1IvFFukw8FwMDbrTfFOkGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BeOObVa6mr4qLnISWQ0hVKvz90fCerEvWJV2EpXaKIZbmMKxwHZNcDxI9uvllqBvv M9jtsscOzHiAP6Te/O8inOXIDFdkXb55kIfoRHD9oT65KualauZ9/wpSER3uoG2noE AZNKICeXzZm9N4f7YSinHGvcwbcWnyJAyhYESjJwzVjxA8IkJRf+U2Ptuz9O7D4aFJ xVx14xbt1SKyajDBEqI1vDp7ebFePlQ5togsIpCp8YCmcbuEzYsv65R0vu+KCaGQ6U Hm97lP+Iw3pSGKSDTDBHlWwCvHT4lvsnuM2Q17oL/bVRxqWZ+AAhCDVAaHPzaj7naK TNgwnImlTOt1g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 060/217] drm/amd/display: check top_pipe_to_program pointer Date: Mon, 17 Jan 2022 21:17:03 -0500 Message-Id: <20220118021940.1942199-60-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lewis.Huang@amd.com, haonan.wang2@amd.com, airlied@linux.ie, llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, meenakshikumar.somasundaram@amd.com, lee.jones@linaro.org, Jimmy.Kizito@amd.com, Sasha Levin , Rodrigo.Siqueira@amd.com, amd-gfx@lists.freedesktop.org, sunpeng.li@amd.com, michael.strauss@amd.com, Anson.Jacob@amd.com, Abaci Robot , nathan@kernel.org, Martin.Leung@amd.com, Eric.Yang2@amd.com, Xinhui.Pan@amd.com, ndesaulniers@google.com, christian.koenig@amd.com, Yang Li , Wayne.Lin@amd.com, Alex Deucher , roy.chan@amd.com, nicholas.kazlauskas@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Yang Li [ Upstream commit a689e8d1f80012f90384ebac9dcfac4201f9f77e ] Clang static analysis reports this error drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:2870:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { ^ top_pipe_to_program being NULL is caught as an error But then it is used to report the error. So add a check before using it. Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 0ded4decee05f..f0fbd8ad56229 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2870,7 +2870,8 @@ static void commit_planes_for_stream(struct dc *dc, #endif if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed) - if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { + if (top_pipe_to_program && + top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { if (should_use_dmub_lock(stream->link)) { union dmub_hw_lock_flags hw_locks = { 0 }; struct dmub_hw_lock_inst_flags inst_flags = { 0 }; -- 2.34.1 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 63354C4332F for ; Tue, 18 Jan 2022 02:23:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E0B1A1128BA; Tue, 18 Jan 2022 02:23:04 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFFAF1128BA; Tue, 18 Jan 2022 02:23:03 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id 58B81B81233; Tue, 18 Jan 2022 02:23:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3607FC36AE3; Tue, 18 Jan 2022 02:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472581; bh=3v1HE+aP+jyFLtVWiJY2W1IvFFukw8FwMDbrTfFOkGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BeOObVa6mr4qLnISWQ0hVKvz90fCerEvWJV2EpXaKIZbmMKxwHZNcDxI9uvllqBvv M9jtsscOzHiAP6Te/O8inOXIDFdkXb55kIfoRHD9oT65KualauZ9/wpSER3uoG2noE AZNKICeXzZm9N4f7YSinHGvcwbcWnyJAyhYESjJwzVjxA8IkJRf+U2Ptuz9O7D4aFJ xVx14xbt1SKyajDBEqI1vDp7ebFePlQ5togsIpCp8YCmcbuEzYsv65R0vu+KCaGQ6U Hm97lP+Iw3pSGKSDTDBHlWwCvHT4lvsnuM2Q17oL/bVRxqWZ+AAhCDVAaHPzaj7naK TNgwnImlTOt1g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 060/217] drm/amd/display: check top_pipe_to_program pointer Date: Mon, 17 Jan 2022 21:17:03 -0500 Message-Id: <20220118021940.1942199-60-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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: , Cc: Lewis.Huang@amd.com, aric.cyr@amd.com, haonan.wang2@amd.com, airlied@linux.ie, llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, meenakshikumar.somasundaram@amd.com, lee.jones@linaro.org, Jimmy.Kizito@amd.com, Sasha Levin , Rodrigo.Siqueira@amd.com, amd-gfx@lists.freedesktop.org, sunpeng.li@amd.com, michael.strauss@amd.com, harry.wentland@amd.com, Anson.Jacob@amd.com, Abaci Robot , nathan@kernel.org, Martin.Leung@amd.com, Eric.Yang2@amd.com, Xinhui.Pan@amd.com, ndesaulniers@google.com, christian.koenig@amd.com, Yang Li , daniel@ffwll.ch, Wayne.Lin@amd.com, Alex Deucher , roy.chan@amd.com, nicholas.kazlauskas@amd.com Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: Yang Li [ Upstream commit a689e8d1f80012f90384ebac9dcfac4201f9f77e ] Clang static analysis reports this error drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:2870:7: warning: Dereference of null pointer [clang-analyzer-core.NullDereference] if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { ^ top_pipe_to_program being NULL is caught as an error But then it is used to report the error. So add a check before using it. Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 0ded4decee05f..f0fbd8ad56229 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2870,7 +2870,8 @@ static void commit_planes_for_stream(struct dc *dc, #endif if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed) - if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { + if (top_pipe_to_program && + top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { if (should_use_dmub_lock(stream->link)) { union dmub_hw_lock_flags hw_locks = { 0 }; struct dmub_hw_lock_inst_flags inst_flags = { 0 }; -- 2.34.1