From patchwork Sun Feb 11 15:06:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniil Dulov X-Patchwork-Id: 199463 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1966865dyd; Sun, 11 Feb 2024 07:06:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWVdqiDXzk2xQjx8P1GD5/rh3eSPHanvLWvIHZRSTWMZJqUzU47jDO0Fi2/3N9IKSG+RKlhB7ViuBeLjgVSzBjgh1RYeA== X-Google-Smtp-Source: AGHT+IG5J4g5ACgNFFZ8p2/suo5hOsEuL6zABJY1jd/eQLTDsoW0XKTafLBYnvlojukHxlOYaQ/4 X-Received: by 2002:a05:6870:e8f:b0:21a:2e98:7739 with SMTP id mm15-20020a0568700e8f00b0021a2e987739mr4683581oab.18.1707664004308; Sun, 11 Feb 2024 07:06:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707664004; cv=pass; d=google.com; s=arc-20160816; b=B79d+34wXZrteB1wolO7y6f2Thl00TyQzHTTRfJb97lvtSZDnJ5qnvQqPnogq4v17R f0asHQdz39wERmFepoAjFj0WMRfBWNLF3iw1Q1/Pt0qAV9y2Y3on+RpWpsUIsQe/YG56 TckmV+MmSO/WfDpK2bmVyBzdUnsMjwFwEbAfPPXj/QFx/9+0rO9YevLeZF67eUVMKrSP 6vmjmgOokl6uUBmQIHZx9nUNeRjk9eEeHWPtsHbcMbd7d+yYfrvJWXQGnjatFsJR5xZg femqaLLW1JGsjBVNh+G0N/hGafBAuSaQssoEaVXf7GYy2PdJy3B7bwHOcbOeo2jf6IVn s6LA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=OLWBxKbkPdzZfIu1rRHrYJuNLpBrevklgdhbn6gJOHM=; fh=A7cLf1WCkdN0CWV1GTZqAoQ572p9soqq26Juwd/Xe6c=; b=hnBnsnYW3RJmlUHL3oDOSTXXX3SQF7A66ZL5fVJ8zGKt6LSo953Z9l2O95gmD6F7UC 2PVRF73cHpdiQqQqyWpBLbTRvX+ayLQTY1Lg78HjpJ9ODD9BW7bbDvvLTsNki9LBHu/o Ef7TMbRgzJuusb68X+XOoLL26XONV7m8rd196LfZmTN+NwZnPCznFyluQAvwevYVhPl1 N8U94apNY77tR4sC5blQWE2kqARsO0E8yx7jih6ZY5kkw1SnqeP3U4I+jID10AyTX61r 5UWp3W3Fd61UJC3UH4Ks9lq+Iee2ygUkffQzSpygOW27BJj4eeigjBI8fAzn/K2X4G5x Zrug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60811-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60811-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCWYCThu6xefhFgpJp+LihEUUlsv4KXBKV6qN+65WmOwrzzuKM/vTgKVyXl1u1Z67mO39LJI7N3Nl0iOSeHq1NZgSK6yLA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u19-20020ae9c013000000b007859ff2a646si3826835qkk.115.2024.02.11.07.06.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:06:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60811-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60811-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60811-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1E4BC1C20D7D for ; Sun, 11 Feb 2024 15:06:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A295A5B676; Sun, 11 Feb 2024 15:06:31 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C02C38DCC for ; Sun, 11 Feb 2024 15:06:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707663990; cv=none; b=uBduq8UBcn2Ra7m87Nl7U/X5DNUGOAVpqRS0Tolj3bjrG1r2kkuiheLbIsHX7Gdcm8Jd6nodW175ISm4Spr6ZXbM5d9IUwYLzFDsFspNmJWzmFqr62a7Hkx9HbOZbvFEXC7HrzetisaOMWjylfoQ3ZzoXnTXxjR2Kjr2OrQwQXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707663990; c=relaxed/simple; bh=Ir5CIoqwF8eijYYjiBBP67sbxpfEg7mSHXBnmcSdXBA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=GkoCtk4cIaonP7q0H+GUktt6pnWuKvdA2fD3nZkt/pIASZidvkeHBkoZS2awKAIj48dyYQNv1lBOmVdsRBFRZBj/TKgsLawmgWLs++wccgLEQGRJHfnr7rpWI8jkPpeJp8kIWlM+ZC/puOCeBvMI3WTvSAt4uZldxS3LwwwCYUM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: David Airlie CC: Daniil Dulov , =?utf-8?q?Christian_K=C3=B6nig?= , Alex Deucher , Daniel Vetter , Evan Quan , , , , Subject: [PATCH] drm/amdgpu/swsmu: Fix if statement in smu_baco_get_state() Date: Sun, 11 Feb 2024 07:06:13 -0800 Message-ID: <20240211150613.3583-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EXCH-2016-04.aladdin.ru (192.168.1.104) To EXCH-2016-01.aladdin.ru (192.168.1.101) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790615490855016753 X-GMAIL-MSGID: 1790615490855016753 In smu_baco_get_state() smu->ppt_funcs->baco_get_state is checked for NULL. If it is NULL then the pointer is dereferenced. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 6c45e480fe23 ("drm/amd/powerplay: clear the swSMU code layer") Signed-off-by: Daniil Dulov --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index ee27970cfff9..0fadb6aacd4b 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -2497,7 +2497,7 @@ bool smu_baco_is_support(struct smu_context *smu) int smu_baco_get_state(struct smu_context *smu, enum smu_baco_state *state) { - if (smu->ppt_funcs->baco_get_state) + if (!smu->ppt_funcs->baco_get_state) return -EINVAL; mutex_lock(&smu->mutex);