Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2002051rdb; Sun, 11 Feb 2024 07:06:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX2nQutSeCxa/KQzFAuWCamVhad0rictwaTm/IqqHoc0y5NxU72x3j1omdORF7D7VHICm+Gpm5+qVrYtujTdw6E2XiDIg52/VY2MQivOA== X-Google-Smtp-Source: AGHT+IHeh5swTpjPv0dnKvN0PURiJDi9Htl8or1ggK/x6SF/WVhjyPZE0lY+nXENDxHpHWLuvfR2 X-Received: by 2002:a17:903:228b:b0:1d9:bbc2:87e7 with SMTP id b11-20020a170903228b00b001d9bbc287e7mr6736249plh.36.1707663995538; Sun, 11 Feb 2024 07:06:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707663995; cv=pass; d=google.com; s=arc-20160816; b=jhEL7b2CN/IU6qdEbFb9QiecUuAERjAip2uNHHBy8/eFy4QKy9AOXURjHqBgnEqbWn madiZuVw0IzH8Sy3iOXglnlWF83phKWRXRA8uWUtNVr+/RmnHAlp07zlwxKxQHIMONuI FUdtn6ivj0dPqKMOgVezKgMGSO9TBUxX+mI2lyA+rqU3IR3Tw9hYdKsQN15qp+LmXYdG B0DB9aXJGmxXG+woqk+r+ss4u/fbcnYwVS4sEuqFktb9lYERi6nq8S0vtsay4+tFmwB1 S4ZPhKzzi6e9UaTAz7psXnaGWcEyH2qQbZJB8d1DBmN3da3D2v/oE+5tT4bPsW95AKoh OmkQ== 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=qLMOuZiA6wsUJGE9Ha+JIRiLfM5QnFVdfVRqrWYfvu4=; b=dn2u0tV4x/7+dQi+l9nnyG6OaZxHaDVQGQhBwxwsUIPUNV5/03berhloybRsSQDaHV Eq3MTR3WjUfzLaApgX2mUvPMKMXgUebQCnYEQgs7IbUkNEknWGAki44zO6u+VliIiPKC ooWLbgFItrtPl5hql1+d1qnoOKfZxQpGGf9ikkc0CbxSrwj+E2Q3wjFYzUBsmnS1DYyL AOcPGmXN/ZJRKvYULweR1EZxrAWQD/Qd65yl2h/KU7KG2E3RH8KvnI8fHeDVYDplZKYy cJ/Qc7Q6ndcvTbRqCex6THf1T1cXzPuFN8KqimnGCInRloyASF/U1hYOC54EmzfSKjaL rXrQ==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCUBGeN3NiVWYYc0JR5xGWStr7yJGjrLfnAD0HWMgdRN2urzwtmgMajeYtVbhtv3HsUKFS3zv96BETuYIeuf/w/ELppsZdh2yBWGHskveQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p11-20020a170902e74b00b001d95ef2a557si5066913plf.170.2024.02.11.07.06.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:06:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60811-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60811-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3CB362823CF for ; Sun, 11 Feb 2024 15:06:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F66A5B5CA; Sun, 11 Feb 2024 15:06:30 +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=20K=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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-2016-04.aladdin.ru (192.168.1.104) To EXCH-2016-01.aladdin.ru (192.168.1.101) 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); -- 2.25.1