From patchwork Fri Nov 18 11:53:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Arefev X-Patchwork-Id: 22287 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp150426wrr; Fri, 18 Nov 2022 04:01:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4r62AtSlOydg8dxaty6Jv7sVGEUEwTCywE/gySO2OzwNVRsdw2J81BuqfFBMG88ZdVoOWC X-Received: by 2002:a05:6402:4011:b0:461:96ba:b9c with SMTP id d17-20020a056402401100b0046196ba0b9cmr5906759eda.353.1668772863167; Fri, 18 Nov 2022 04:01:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668772863; cv=none; d=google.com; s=arc-20160816; b=ed1k4nrOnzNYyZ6q0V3Qn8Ads1/ywKf3U0rFic4twWy03ZeKOx0dSYeENhIiflKNao Ce3kzvvAq+/PMBiSKkBRU7uyEF8GUb0LZ9AadaWdVTo0Jx/e+DNb+5uhndu+LepLOl2X IionZuD20r5gnYwK01l9kXtMG299R3WBkPysh+RKq+210c3uwvqtC9PhKw+bKv2kwTJM AI/H0njvVZ2hdz+uLfNkomT0eY2tt1txID145mYxShr+oMgOYXOxLgobH53Pr5uxOTup HuFctVdr3lzvSRiRm9l/hDhy0yQOiUjiSU+aOnCWtu6UajtnMaD3bAoyLlweExCIcsI9 7CFw== 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=S0tk9zvEh9i3RpeDgKq2csbzg/78Ce7ScjSDjvtVy4w=; b=JgHq4tkGc+zuXsSKUBbVSuhBozHKKooX7a5SZ4ZBXKDaEOQs/0g8R5Dg09gx3QsbIc bAinlDOK5xora4sOEE5K/om7OnqmeYMC/rUPYX1t0Lw7CklqmRh7x4qqgwxEhP8vw2J9 EZeEFoC3JFnLrL+NeTTrGEOXZGwP3In8uAjAs4YADqeEYsfffZAk/50gSmxBMniC4R5W EcMdZVAqZtscNLkcgiSTIu1yYWGi6B4DIwpXd3mgetBrvq21HCJyAQMFkyzwSg3C1EsO s+1LMHWkrptDATh05W+CGj7ZaFWcWjUw+Pxn5NdCIfRUM4PwxdyZmrSDjRPYHzYAwmDc pVlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@swemel.ru header.s=mail header.b="ZmV/V7mf"; 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 z10-20020a056402274a00b004639a46d725si4011330edd.31.2022.11.18.04.00.34; Fri, 18 Nov 2022 04:01:03 -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="ZmV/V7mf"; 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 S241237AbiKRLxM (ORCPT + 99 others); Fri, 18 Nov 2022 06:53:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235170AbiKRLxK (ORCPT ); Fri, 18 Nov 2022 06:53:10 -0500 Received: from mx.swemel.ru (mx.swemel.ru [95.143.211.150]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919E8942D0 for ; Fri, 18 Nov 2022 03:53:09 -0800 (PST) From: Denis Arefev DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1668772387; 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=S0tk9zvEh9i3RpeDgKq2csbzg/78Ce7ScjSDjvtVy4w=; b=ZmV/V7mfYlM5CynFgGpfPcqhwVGjI/BtMQIRjv3GIh+F/3m0fq84tB+XkvGbSJzsObh98i UsbmerxlTGiIh+AvkKKpNI1fmlswJ15luLfdx7O0iYzCIwlm2RNKNYqFTr3/8+XPmcU5ow aR/p0WC2AbLQOYuuoGYKfT1tHFzXBoQ= To: Alex Deucher Cc: =?utf-8?q?Christian_K=C3=B6nig?= , avid Airlie , Daniel Vetter , 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 v2] amdgpu: nbio_v7_4: Add pointer check Date: Fri, 18 Nov 2022 14:53:06 +0300 Message-Id: <20221118115306.128293-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?1749835173935668505?= X-GMAIL-MSGID: =?utf-8?q?1749835173935668505?= 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 --- 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; 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)) {