From patchwork Wed Nov 23 12:06:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 24931 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2752040wrr; Wed, 23 Nov 2022 04:19:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf70SWNI9HYVoFIIcc1OYNlTbNBx6+gMT30FSjyh8bc/LrexyyNUtI6ZyL7/07xYqzOCiIZP X-Received: by 2002:a17:906:c35a:b0:78d:2af:a818 with SMTP id ci26-20020a170906c35a00b0078d02afa818mr13070038ejb.675.1669205981379; Wed, 23 Nov 2022 04:19:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669205981; cv=none; d=google.com; s=arc-20160816; b=W07iywOqWLPexVJfWV/IiKP4zpTC59MmQgxSopYywmsz7jBfszzaRqUs0zC5DprK5G Eay1YPAF1F+ApCIk6RuQjgSY8fludiXViX9TgYNxQww5YBSKkLgY+2niGuC3r4P34RUO bGCwc8iFYab9Zd9urFQyGD38tTM+CzbGWprbwmSe5EDr11NqUhP7ztnASwQl2xnLbC3a 7btNx6HCKt4obyREm72oytoejXPRujoc4Tzphv/e6a4Z4s/XEnbY5MPzEtQzmj7ot/iU dv6dmoBlTu/ZVQoQx6qamHO0BpLNBScHyL9P1KjLgRyAZ9NWUjBFFB283slBvzhw5qZS 0Ctw== 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=G2Z5OZw5rUxXdNqRcS7hWfzmHqEmX+r80KyED25XZyTJUaT+w98O+VadjZg+PgWEi1 abrbOZfZfpoL8SG231xA2OOSBadzp9vMbjpmHFFvQktxDN/sRkt3SpSQcd+W/wLemr1+ myJGgQPHsloQ6jUf8af2eCgRE4Al2VxT2ltoYe2Rjewo8Qd4kOBck/RtG8IQ94lFvuSr GdR27E8d5S1QpcK7NTyZzl0DognCefF5vIWh0SLs2L6DDWsoCgwllVgeGyKywPR1J1m1 0BrwRxK9MyLZHzknoxOjYsyb8BsmY4NFxypG5hYQCmZ9OAnTWw/gOHTeMQpNdmyJBu+A ZGfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=StRJTY6t; 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 t2-20020a056402524200b0045be16903d0si17118724edd.310.2022.11.23.04.19.16; Wed, 23 Nov 2022 04:19:41 -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=StRJTY6t; 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 S237145AbiKWMGO (ORCPT + 99 others); Wed, 23 Nov 2022 07:06:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237136AbiKWMGM (ORCPT ); Wed, 23 Nov 2022 07:06:12 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB1D24F16 for ; Wed, 23 Nov 2022 04:06:09 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1669205166; 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=StRJTY6tCzqUr8ujdrLKIZnx9EuyTdxSVBJ4mSdRS38m/cOi2Ok76V9AAVwuup48EALRur 4/YK8INrJHDGX9lNXUzwnugggA6JGddpSWA3vX7bnh4w25pNFs6ZjaBATEIFvnodqrBmHN ziqzBPGwPXwb1OZTBY1FcA3ucZq8qgA= To: Harry Wentland Cc: Leo Li , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, trufanov@swemel.ru Subject: [PATCH] drm/amdgpu/display: Add pointer check Date: Wed, 23 Nov 2022 15:06:05 +0300 Message-Id: <20221123120605.37265-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?1750289331311086477?= X-GMAIL-MSGID: =?utf-8?q?1750289331311086477?= 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);