From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Cc: s.hauer@pengutronix.de, kernel@pengutronix.de,
shawnguo@kernel.org, festevam@gmail.com, linux-imx@nxp.com,
linux-fbdev@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] video: fbdev: Check for null res pointer
Date: Mon, 20 Dec 2021 09:29:56 +0100 [thread overview]
Message-ID: <CAMuHMdWhs-wTcZNq2VrAZXrxeSNa88GR49j2rn5zSryxF4peOw@mail.gmail.com> (raw)
In-Reply-To: <20211220081132.883709-1-jiasheng@iscas.ac.cn>
Hi Jiasheng,
On Mon, Dec 20, 2021 at 9:19 AM Jiasheng Jiang <jiasheng@iscas.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@iscas.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@linux-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
prev parent reply other threads:[~2021-12-20 8:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-20 8:11 [PATCH v2] video: fbdev: Check for null res pointer Jiasheng Jiang
2021-12-20 8:29 ` Geert Uytterhoeven [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMuHMdWhs-wTcZNq2VrAZXrxeSNa88GR49j2rn5zSryxF4peOw@mail.gmail.com \
--to=geert@linux-m68k.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=festevam@gmail.com \
--cc=jiasheng@iscas.ac.cn \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).