Message ID | 20221110122848.20207-1-arefev@swemel.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp121918wru; Thu, 10 Nov 2022 04:41:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf6TYmGZOw/sTX+9fhu8JKrGNRcIRf7V7MXHnHX2u/IRjGvjN53UMiQb+TlKBZXW0uHbvgCd X-Received: by 2002:a17:906:110e:b0:7ae:664a:a7d2 with SMTP id h14-20020a170906110e00b007ae664aa7d2mr2202844eja.676.1668084087670; Thu, 10 Nov 2022 04:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668084087; cv=none; d=google.com; s=arc-20160816; b=EOjJyBdKPQfKkQjSVvO1QbFgsCmiPHof3Sq/8jZJj28XvRK3tydyV9bzEP3K0oURGK MW7iC5yQns5+2wtZPDEF4oqzGdBW7y2Lz7fBQ+sMi6FOcDPa/0JFsQKR0uhMzfnGIMl7 b3DVGTzWtvJi4OjciMVVhjTjFtb9XGe8f7D7m+Wi64uPoU7f1QXhca6PZcRIHUl5sJtT HYTGhXdDiIAgGg4gy3L8m5gq66ENZUzwUZFWxspyErU0QXlclbhd7BhiDk+0rHM5aH/q bzAbMRYWFSPZMX2bTANOgjoVnAdkLHhCI4w6o1tohF3IpbmWwYJHeRioC5e9dkz2TC4Q MUKg== 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=7WlUdsfMOy5TO2uhf3qJwEQ6rzC5Fr2IfSHr+eIJE1A=; b=Zl+RS0YB5Ozj9wddChvIhWiRKeWFcwjByyRyp79d2KeuiIarNaxK9LfIRCJUKZ9wnr dnCVmdpcOK4WmrbN8UuDlGhrYV/AyaxtZDj+zGcTAq/iOhu3qQHNGRpAn8mI+XAJzS2A PqG6mNGgzcAZtgmV9Y5DnlR8Je0XGESLQcP1u3KrC6xFVyWgVAW/Y9+261rXMTQdJtiO PYVzrOuoqvnVIkI/TbQ/zEfkDWfRyU2qAn7BNONWXnVKQ/2JnZkiO4E1Z40lqIYkRXrx l9LfM9sXi0WVRBNSGotzPWa3SVP5a/drY0SoTMkt5gONvLrmRsibrKjfLB7Qub1k3gxi lkMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b=XW0fzSXE; 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 he41-20020a1709073da900b0078d3a35e181si21293188ejc.871.2022.11.10.04.41.01; Thu, 10 Nov 2022 04:41:27 -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=XW0fzSXE; 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 S229567AbiKJMe2 (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Thu, 10 Nov 2022 07:34:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiKJMe0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 10 Nov 2022 07:34:26 -0500 X-Greylist: delayed 333 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 10 Nov 2022 04:34:24 PST Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A06C36BDE5 for <linux-kernel@vger.kernel.org>; Thu, 10 Nov 2022 04:34:24 -0800 (PST) From: Denis Arefev <arefev@swemel.ru> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1668083328; 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=7WlUdsfMOy5TO2uhf3qJwEQ6rzC5Fr2IfSHr+eIJE1A=; b=XW0fzSXEtVRSDSKDt6r/e4TCXRpIkBqcivXI9rVePzOz228606LrraZRIriS6qVh1+qA+3 jDIaRoaiKGafjLsICoah3glMUiU4WDqc60REDnuCPmYlDfWZmRvvtMMTf3YQxvyKnO0uBW D2yxzSuuDD7DOYbQpvoB/HRLDOJSxZI= To: Alex Deucher <alexander.deucher@amd.com> Cc: =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, avid Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] nbio_v7_4: Add pointer check Date: Thu, 10 Nov 2022 15:28:48 +0300 Message-Id: <20221110122848.20207-1-arefev@swemel.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749112939940075089?= X-GMAIL-MSGID: =?utf-8?q?1749112939940075089?= |
Series |
nbio_v7_4: Add pointer check
|
|
Commit Message
Denis Arefev
Nov. 10, 2022, 12:28 p.m. UTC
Return value of a function 'amdgpu_ras_find_obj' is dereferenced at nbio_v7_4.c:325 without checking for null
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On 11/10/2022 06:28, Denis Arefev wrote: > Return value of a function 'amdgpu_ras_find_obj' is dereferenced at nbio_v7_4.c:325 without checking for null This line is too long, you should be wrapping lines at 75 characters. Could you run your patch through checkpatch? > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Signed-off-by: Denis Arefev <arefev@swemel.ru> Probably should include this tag: Fixes: 28f87950d935e ("drm/amdgpu: clear ras controller status registers when interrupt occurs") > --- > drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c > index eadc9526d33f..0f2ac99de864 100644 > --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c > +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c > @@ -304,6 +304,9 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device > struct ras_err_data err_data = {0, 0, 0, NULL}; > struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); > > + if (!obj) > + return; > Whitespace seems inconsistent here. > bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL); > if (REG_GET_FIELD(bif_doorbell_intr_cntl, > BIF_DOORBELL_INT_CNTL, RAS_CNTLR_INTERRUPT_STATUS)) {
diff --git a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c index eadc9526d33f..0f2ac99de864 100644 --- a/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c @@ -304,6 +304,9 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device struct ras_err_data err_data = {0, 0, 0, NULL}; struct amdgpu_ras *ras = amdgpu_ras_get_context(adev); + if (!obj) + return; bif_doorbell_intr_cntl = RREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL); if (REG_GET_FIELD(bif_doorbell_intr_cntl, BIF_DOORBELL_INT_CNTL, RAS_CNTLR_INTERRUPT_STATUS)) {