[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMuHMdWhs-wTcZNq2VrAZXrxeSNa88GR49j2rn5zSryxF4peOw@mail.gmail.com>
Date: Mon, 20 Dec 2021 09:29:56 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Jiasheng Jiang <jiasheng@...as.ac.cn>
Cc: s.hauer@...gutronix.de, kernel@...gutronix.de, shawnguo@...nel.org,
festevam@...il.com, linux-imx@....com, linux-fbdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] video: fbdev: Check for null res pointer
Hi Jiasheng,
On Mon, Dec 20, 2021 at 9:19 AM Jiasheng Jiang <jiasheng@...as.ac.cn> wrote:
> The return value of platform_get_resource() needs to be checked.
> To avoid use of error pointer in case that there is no suitable resource.
Thanks for your patch!
> Fixes: f7018c213502 ("video: move fbdev to drivers/video/fbdev")
That can't be the real introducer of the "bug"...
> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> --- a/drivers/video/fbdev/imxfb.c
> +++ b/drivers/video/fbdev/imxfb.c
> @@ -1083,6 +1083,8 @@ static int imxfb_remove(struct platform_device *pdev)
> struct resource *res;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res)
> + return -EINVAL;
This cannot happen, as imxfb_remove() can only be called if
imxfb_probe() succeeded. imxfb_probe() does check the result of
platform_get_resource(), and fails if the resource was not found.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists