From patchwork Wed Mar 5 11:20:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Abramov X-Patchwork-Id: 14003961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3312EC28B25 for ; Thu, 6 Mar 2025 08:07:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A478F10E90E; Thu, 6 Mar 2025 08:07:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=mt-integration.ru header.i=@mt-integration.ru header.b="qGvzD8SY"; dkim-atps=neutral X-Greylist: delayed 531 seconds by postgrey-1.36 at gabe; Wed, 05 Mar 2025 11:29:57 UTC Received: from ksmg01.maxima.ru (ksmg01.maxima.ru [81.200.124.38]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1ECEB10E0B6 for ; Wed, 5 Mar 2025 11:29:57 +0000 (UTC) Received: from ksmg01.maxima.ru (localhost [127.0.0.1]) by ksmg01.maxima.ru (Postfix) with ESMTP id A3D94C001C; Wed, 5 Mar 2025 14:20:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 ksmg01.maxima.ru A3D94C001C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt-integration.ru; s=sl; t=1741173652; bh=n/KI5uq203cxGaXCTBoOYd74pMZghtHUgweaiwsP5CM=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=qGvzD8SYK1o2oZhlbWPxGIX3jPXDzxyVFHTOdtIIKrdYnn1B2VjCnJjJemm7i6BwK YleXo1DnHkWlFt3rC3xOwG6/lPtOXewRVCHYOvw95Nb2/omM+JAcgaxnvGMwWRgC6t MM3VRWK/e0j9S+x/Km5WKtazi/H/XFh6nhqbGOxI6FdPR++bkVBe9Fp5S6LinUEOXO F+OfYIotAj2hH9ymrNG9yW8+b/+cVz6265dRzDwMSdF8KIFre+onEPftpP0Oh2qSC1 5A/r033cWvOmyrnSJmfqmdX1Q+5YaycBeK9e3aSFwpjX4V7CRB1bumctKCIzYBGtMa toJJP97cr/DbA== Received: from ksmg01.maxima.ru (autodiscover.maxima.ru [81.200.124.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.maxima.ru", Issuer "GlobalSign GCC R3 DV TLS CA 2020" (verified OK)) by ksmg01.maxima.ru (Postfix) with ESMTPS; Wed, 5 Mar 2025 14:20:52 +0300 (MSK) Received: from saturerate.maximatelecom.ru (10.0.247.123) by mmail-p-exch01.mt.ru (81.200.124.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.4; Wed, 5 Mar 2025 14:20:50 +0300 From: Ivan Abramov To: Patrik Jakobsson CC: Ivan Abramov , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Bjorn Helgaas , Sinan Kaya , , , Subject: [PATCH] drm/gma500: Add NULL check for pci_gfx_root in mid_get_vbt_data() Date: Wed, 5 Mar 2025 14:20:37 +0300 Message-ID: <20250305112038.43852-1-i.abramov@mt-integration.ru> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 X-Originating-IP: [10.0.247.123] X-ClientProxiedBy: mt-exch-01.mt.ru (91.220.120.210) To mmail-p-exch01.mt.ru (81.200.124.61) X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Auth: dmarc=none header.from=mt-integration.ru; spf=none smtp.mailfrom=mt-integration.ru; dkim=none X-KSMG-AntiSpam-Envelope-From: i.abramov@mt-integration.ru X-KSMG-AntiSpam-Info: LuaCore: 51 0.3.51 68896fb0083a027476849bf400a331a2d5d94398, {rep_avail}, {Tracking_from_domain_doesnt_match_to}, mt-integration.ru:7.1.1; d41d8cd98f00b204e9800998ecf8427e.com:7.1.1; 127.0.0.199:7.1.2; 81.200.124.61:7.1.2; ksmg01.maxima.ru:7.1.1, FromAlignment: s, ApMailHostAddress: 81.200.124.61 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiSpam-Lua-Profiles: 191499 [Mar 05 2025] X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Version: 6.1.1.11 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.1.8310, bases: 2025/03/05 09:56:00 #27614020 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: NotDetected X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 7 X-Mailman-Approved-At: Thu, 06 Mar 2025 08:07:52 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Since pci_get_domain_bus_and_slot() can return NULL, add NULL check for pci_gfx_root in the mid_get_vbt_data(). This change is similar to the checks implemented in mid_get_fuse_settings() and mid_get_pci_revID(), which were introduced by commit 0cecdd818cd7 ("gma500: Final enables for Oaktrail") as "additional minor bulletproofing". Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: ba99d8348864 ("drm/gma500: Deprecate pci_get_bus_and_slot()") Signed-off-by: Ivan Abramov --- drivers/gpu/drm/gma500/mid_bios.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/gma500/mid_bios.c b/drivers/gpu/drm/gma500/mid_bios.c index 7e76790c6a81..cba97d7db131 100644 --- a/drivers/gpu/drm/gma500/mid_bios.c +++ b/drivers/gpu/drm/gma500/mid_bios.c @@ -279,6 +279,11 @@ static void mid_get_vbt_data(struct drm_psb_private *dev_priv) 0, PCI_DEVFN(2, 0)); int ret = -1; + if (pci_gfx_root == NULL) { + WARN_ON(1); + return; + } + /* Get the address of the platform config vbt */ pci_read_config_dword(pci_gfx_root, 0xFC, &addr); pci_dev_put(pci_gfx_root);