Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3702060pxb; Mon, 24 Jan 2022 15:47:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCQw3e8/S9YSZk+HGZQbscbQFlf7WieFm/x/CS+rhSkN2XgBdHHdN0dSp+qU60I3fajP+k X-Received: by 2002:a63:ea51:: with SMTP id l17mr6842292pgk.450.1643067967372; Mon, 24 Jan 2022 15:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643067967; cv=none; d=google.com; s=arc-20160816; b=ytDK6aBNqVvRKQw/5g+lyWq4ZP5i61w+7NaNxbworOPuG1uqEp4R29RtHLk57PxHlI mVFXveJ1A94s3G+6CFsGTYsZ51PSGLAxySG1sPmInjwiCRjF/pzZ98GCpv0PvosjKmTT 5vzTNWIsXe1S/u/NVQ/OHaBn3dWJ8GmY6l1nWRAg/cQ03ufWjHmj8VtUKX9c85c2L60C 3Sz2EghBPPyt7iQ3sNWMH72AEUe+hjLVPAXeuYNqJ+xEYPM3R9fSYLVHZCwK6QVpOl/9 e2r+wKIO9xpF/uknsYhsLqU5W1ajnTcuDx40pngy/nhGd+IpEyinv8BQWwbtLQvQqqA9 6KNw== 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=AxGLiBwVuNY4y/CwtGgU+CebZjTf8l8CesFp08fTTsE=; b=L6w9g37xt/b9SzYkrLzeF568GkhRSV3ttXaBPOfI1HFABwkdaEhWubgFAeG0meCPIM FKZM0QXBM/7GZXJH/R2+GdLLOTmVTUg5oRLlExYqOCR9v6jOR1Zj8Rcg5pFvirSEdz+O ByUcHO+Afe6fT1D0+DxVDVsN7WZwlS21bXtZCdUxCGuA0S+JrowyyuODRUwD8L7GzRRa F4G+s9xiqIe6ydXJZnjpL5wIQccwfDfB4AkEKaahDw1/0238U/He84+MyUyxiTmFZkym OejdgFJO8T2bira5Z5RPOJzg96VRDUeZ0b2yPVWVRR3sLWnmwG5dFjhnfbZtljAnHbPl W09g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Msj8iebw; 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 nv2si758488pjb.20.2022.01.24.15.45.55; Mon, 24 Jan 2022 15:46:07 -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=Msj8iebw; 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 S2360583AbiAXXhD (ORCPT + 99 others); Mon, 24 Jan 2022 18:37:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382661AbiAXW4E (ORCPT ); Mon, 24 Jan 2022 17:56:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44224C055AA9; Mon, 24 Jan 2022 13:11:13 -0800 (PST) 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 0AC59B8123A; Mon, 24 Jan 2022 21:11:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EE66C340E5; Mon, 24 Jan 2022 21:11:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058670; bh=Wjq8KJMxSK1M36zLBibg6MlMLF1ZI3aYOkSq2/bc0Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Msj8iebwpRksyHWuDo3gNlIS4uHSMK0Z6e4RBWjLLu17+NE16jxMKzeVyh78ClQNJ 55dsENO4COZD3ZxAcL/wVlt2IaI2jc/mlngn/iZwUqKZCcpsvRfUjyqUTmflWgK77v HmJ0cT5W/V3v2ceUh7SEL3Y24wuTiM2dmGOjv+EY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Harry Wentland , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 0363/1039] drm/amd/display: fix dereference before NULL check Date: Mon, 24 Jan 2022 19:35:52 +0100 Message-Id: <20220124184137.484891008@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: José Expósito [ Upstream commit f28cad86ada1a7345d7bbd379bef5a8babfa791b ] The "plane_state" pointer was access before checking if it was NULL. Avoid a possible NULL pointer dereference by accessing the plane address after the check. Addresses-Coverity-ID: 1493892 ("Dereference before null check") Fixes: 3f68c01be9a22 ("drm/amd/display: add cyan_skillfish display support") Signed-off-by: José Expósito Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c index cfd09b3f705e9..fe22530242d2e 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn201/dcn201_hwseq.c @@ -134,11 +134,12 @@ void dcn201_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) PHYSICAL_ADDRESS_LOC addr; struct dc_plane_state *plane_state = pipe_ctx->plane_state; struct dce_hwseq *hws = dc->hwseq; - struct dc_plane_address uma = plane_state->address; + struct dc_plane_address uma; if (plane_state == NULL) return; + uma = plane_state->address; addr_patched = patch_address_for_sbs_tb_stereo(pipe_ctx, &addr); plane_address_in_gpu_space_to_uma(hws, &uma); -- 2.34.1