From patchwork Tue Dec 6 10:47:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 30233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2748487wrr; Tue, 6 Dec 2022 02:50:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Rk+PVCkIpwcqZ5UPszadQc6vI1NIeoVuNvLlblmmVCC9DcODM/Ko3NWsOPDxoLu0S94n3 X-Received: by 2002:a17:906:c458:b0:7c0:e23f:17cd with SMTP id ck24-20020a170906c45800b007c0e23f17cdmr9076611ejb.491.1670323823055; Tue, 06 Dec 2022 02:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670323823; cv=none; d=google.com; s=arc-20160816; b=DOf0Qgt7+eJO1c0DKl3jRIEe2dJzaEWF84Azfrxy2GDaLqPfeqEXOTjIa2mSAeFQ8u qMdd3pwVylju70XGuVHFXRdENXT74FMaEq32XFo/WtTykGNEJeykLwz4eN4q4T+A/F0E 1C3C0DVuZa/R3/8hJW1fqL92NiKaAXFeMKTs5b0hvPGWalCQ2/US3mIIvkrG8JEPT0dc m7aJN6Hz3fhXL2CBK+d53p2xd5BEu8rtx/+r7VaLE0fsSqe3jvGisUMJh0+xpS/rYas9 iqC3S90xomFG9/hlG5Q2PvI4zrmzCNACj45Ms0dCJMQBE0tvLIinfZu67OcCAk6rqfYE Enng== 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 :message-id:date:subject:cc:to:dkim-signature:from; bh=dyDdQ0ouK6C8bS9bKimyo6WyQoc/XZnFKa1MkRVBOUU=; b=q9MUaNI3YhBW2MInNtCmLkJdnPxaLPn2hNx+iRkDXpC29BHgXMvoAbkNikjlP+1orb F1z5HVU0XyHPqJbQue1VcC/ja6ceODUhRzcjrALGkSrX5zqJ2J/feDvsDvv5qgm+1nj9 H4BtcwWt9QkiUrEz8fEu5gzWoL3+mlFeLs6YqnmR3J3CMbx9nBD1z3u38hK+acKKkhOW 2z1KByhedrXXNwKlzmUsQ6Nl+jbkbOo+1ZTIGfJzaeOOPDT8I2BhjL13zYxklXav3onE kMbGhc89WzV/f7IQMLulmk+5dlSXzMMkc8tFaq0UE5Pv9tJgc2b0kiaE3Jg1uHIeSP7S Dp5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=eUZgBGct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j19-20020a05640211d300b0046aaeca7d05si2038374edw.399.2022.12.06.02.50.00; Tue, 06 Dec 2022 02:50:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=eUZgBGct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=swemel.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234169AbiLFKsE (ORCPT + 99 others); Tue, 6 Dec 2022 05:48:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233785AbiLFKsC (ORCPT ); Tue, 6 Dec 2022 05:48:02 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A11225 for ; Tue, 6 Dec 2022 02:48:00 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1670323677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=dyDdQ0ouK6C8bS9bKimyo6WyQoc/XZnFKa1MkRVBOUU=; b=eUZgBGctez7/faDwGHUnXo0cKQutXkFVBBoyVX6M9Qvwybd7AhC7TAbCcDg+bdqNrSYtVs 6Ca9APE+/edoMT9CpKngwaL8dd6GjVYFKBuy35NnW30qm/U1zrLoFJH7KURuQ8xidTAmeE UKmkFX0dnTNI9TPEUU/JCFrrlOgqNhA= To: Harry Wentland Cc: Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Aurabindo Pillai , Roman Li , =?utf-8?q?Michel_D=C3=A4nzer?= , Fangzhi Zuo , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org, trufanov@swemel.ru, vfh@swemel.ru Subject: [PATCH] drm/amd/display: Added pointer check Date: Tue, 6 Dec 2022 13:47:57 +0300 Message-Id: <20221206104757.31512-1-arefev@swemel.ru> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751461472647224281?= X-GMAIL-MSGID: =?utf-8?q?1751461472647224281?= Return value of a function 'dc_create_state' is dereferenced at amdgpu_dm.c:2027 without checking for null Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 0f7749e9424d..529483997154 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1960,7 +1960,9 @@ static int dm_resume(void *handle) dc_release_state(dm_state->context); dm_state->context = dc_create_state(dm->dc); /* TODO: Remove dc_state->dccg, use dc->dccg directly. */ - dc_resource_state_construct(dm->dc, dm_state->context); + if (dm_state->context) { + dc_resource_state_construct(dm->dc, dm_state->context); + } /* Before powering on DC we need to re-initialize DMUB. */ r = dm_dmub_hw_init(adev);