[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMeQTsYVnBFiirGLKfG+pDt0Aagr0sjanPafKCygUou0s+iB=Q@mail.gmail.com>
Date: Thu, 6 Mar 2025 11:02:14 +0100
From: Patrik Jakobsson <patrik.r.jakobsson@...il.com>
To: Ivan Abramov <i.abramov@...integration.ru>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Bjorn Helgaas <helgaas@...nel.org>, Sinan Kaya <okaya@...eaurora.org>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: Re: [PATCH] drm/gma500: Add NULL check for pci_gfx_root in mid_get_vbt_data()
On Wed, Mar 5, 2025 at 12:20 PM Ivan Abramov
<i.abramov@...integration.ru> wrote:
>
> 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()")
Patch looks good but pci_get_bus_and_slot() also returned a struct
pci_dev so the issue was present before ba99d8348864.
The correct fixes tag should be:
Fixes: f910b411053f ("gma500: Add the glue to the various BIOS and
firmware interfaces")
-Patrik
>
> Signed-off-by: Ivan Abramov <i.abramov@...integration.ru>
> ---
> 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);
> --
> 2.48.1
>
Powered by blists - more mailing lists