* [PATCH v2] video: fbdev: Check for null res pointer
@ 2021-12-20 8:11 Jiasheng Jiang
2021-12-20 8:29 ` Geert Uytterhoeven
0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2021-12-20 8:11 UTC (permalink / raw)
To: s.hauer, kernel, shawnguo, festevam, linux-imx
Cc: linux-fbdev, linux-arm-kernel, dri-devel, linux-kernel, Jiasheng Jiang
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.
Fixes: f7018c213502 ("video: move fbdev to drivers/video/fbdev")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changelog:
v1 -> v2
*Change 1. Correct the commit message.
---
drivers/video/fbdev/imxfb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index ad598257ab38..68288756ffff 100644
--- 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;
imxfb_disable_controller(fbi);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] video: fbdev: Check for null res pointer
2021-12-20 8:11 [PATCH v2] video: fbdev: Check for null res pointer Jiasheng Jiang
@ 2021-12-20 8:29 ` Geert Uytterhoeven
0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2021-12-20 8:29 UTC (permalink / raw)
To: Jiasheng Jiang
Cc: s.hauer, kernel, shawnguo, festevam, linux-imx, linux-fbdev,
linux-arm-kernel, dri-devel, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-20 8:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 8:11 [PATCH v2] video: fbdev: Check for null res pointer Jiasheng Jiang
2021-12-20 8:29 ` Geert Uytterhoeven
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).