Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3644752pxb; Mon, 24 Jan 2022 14:17:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlgAfEuYH/67CW+K44cXNTEpK068h/WhoIJSLyziCsyrNP9QHYyS61+in1IFdRTg48CY8C X-Received: by 2002:a62:3601:0:b0:4c8:c4e:5a8c with SMTP id d1-20020a623601000000b004c80c4e5a8cmr9708909pfa.27.1643062621382; Mon, 24 Jan 2022 14:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062621; cv=none; d=google.com; s=arc-20160816; b=t5ilkrVdjcbm3qN3IcJJtlDZfN7icbaDGoYQx1Jju67LyVLZ8IET621kFj7gm0uqbI ajY4tOsYw5XRAkgVhvIrnLTn8/PzRuLY87mCPJumwgmlJYk7plIld0sy9m653wyE2FtA ag4lKPPj+ZNGu0zDBuY3iHTZxPvXSDbgxy3sON22fYdxk34rwF+j6bLWQDbXEyWui7tF Qd2SgM5OUXcSliBit3nuP9cn4bXeSTqBogLiGJWCz3buxiuieWWtL8OSp/EqFHSOU4oD IMQ/+RNYjye5lYD7foXoEu5qkBvTynQFwVMLdKGAg7WwBnm64ckQpL5DxZLGHHbwCUCz cGfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tpiaqHe89sL6lpFTH9Rf8EDkqdHSesBJgB669HmYEdc=; b=TRFO/ykYaD9gTDjk39o3GiQm5Tqk4i0FYutzALBFX6eOf2J/+JtwCfZ+New4TKp2bK x7PTWfYmMQY8TVi+l/6AdS6lFVdCCX6kqj86lwdwfWn4VHh0ulyiV+8y7JBFxV+y7h+d GCqaz093dAFb3VGmXBGGuOcp+gc0SmSI9imogK/XRoQ/n/CNqpE8dVvyZtP+RYXDj1E7 SlnbttwvEYv5Vj4ie4M2wsK1CNvmPj3PPxrpKwX6PW5DIMzYDYWf9rcmr9ExAnzUo9Je Jy/tiZGzdB04ISb0uBVgkw2Vzb+tvUOYyfBWN4Oc+HG7Znvn8s/yCzXfq9xabnQ5V1fM X6jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hHo8PGzq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l11si14544678pfu.240.2022.01.24.14.16.48; Mon, 24 Jan 2022 14:17:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hHo8PGzq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580222AbiAXWJC (ORCPT + 99 others); Mon, 24 Jan 2022 17:09:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:45782 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1452251AbiAXVY0 (ORCPT ); Mon, 24 Jan 2022 16:24:26 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 99970614D8; Mon, 24 Jan 2022 21:24:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E80DC340E4; Mon, 24 Jan 2022 21:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059465; bh=3v1HE+aP+jyFLtVWiJY2W1IvFFukw8FwMDbrTfFOkGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hHo8PGzq+IU4hyJFlLgS3jDOMSBuqIS8t0bnA8frwVI/UlRdrDHMuPdchflbcCCRy iMn+/KWwe8V27kHkQHLS/xcPGcIBC+omKgk3S4qDvZXDgp/ih/YyJLPdBc+SSoFN9s GyNaaOlTxbOr/0ZOgu8NWyy/k6sfnxicr9GQaoSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abaci Robot , Yang Li , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0582/1039] drm/amd/display: check top_pipe_to_program pointer Date: Mon, 24 Jan 2022 19:39:31 +0100 Message-Id: <20220124184144.909444563@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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