* [PATCH] video: fbdev: sm501fb: fix potential null pointer dereference on fbi
@ 2017-11-10 17:32 ` Colin King
2017-11-17 16:03 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-11-10 17:32 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz, Sudip Mukherjee, dri-devel, linux-fbdev
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The pointer fbi is dereferenced with par = fbi->par before there is a
null check on fbi, hence there is a potential null pointer dereference
on a null par. Fix this by moving the dereference after the null
pointer check.
Detected by CoverityScan, CID#1461301 ("Dereference before null check")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/video/fbdev/sm501fb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c
index 8d4fdb373299..6f0a19501c6a 100644
--- a/drivers/video/fbdev/sm501fb.c
+++ b/drivers/video/fbdev/sm501fb.c
@@ -2100,11 +2100,12 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
enum sm501_controller head)
{
struct fb_info *fbi = info->fb[head];
- struct sm501fb_par *par = fbi->par;
+ struct sm501fb_par *par;
if (!fbi)
return 0;
+ par = fbi->par;
if (par->screen.size == 0)
return 0;
@@ -2150,11 +2151,12 @@ static void sm501fb_resume_fb(struct sm501fb_info *info,
enum sm501_controller head)
{
struct fb_info *fbi = info->fb[head];
- struct sm501fb_par *par = fbi->par;
+ struct sm501fb_par *par;
if (!fbi)
return;
+ par = fbi->par;
if (par->screen.size == 0)
return;
--
2.14.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] video: fbdev: sm501fb: fix potential null pointer dereference on fbi
2017-11-10 17:32 ` [PATCH] video: fbdev: sm501fb: fix potential null pointer dereference on fbi Colin King
@ 2017-11-17 16:03 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2017-11-17 16:03 UTC (permalink / raw)
To: Colin King
Cc: linux-fbdev, kernel-janitors, Sudip Mukherjee, dri-devel, linux-kernel
On Friday, November 10, 2017 05:32:31 PM Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The pointer fbi is dereferenced with par = fbi->par before there is a
> null check on fbi, hence there is a potential null pointer dereference
> on a null par. Fix this by moving the dereference after the null
> pointer check.
>
> Detected by CoverityScan, CID#1461301 ("Dereference before null check")
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Patch queued for 4.15, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-17 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20171110173236epcas4p2e31777c5a06270f2aed64110fedf0524@epcas4p2.samsung.com>
2017-11-10 17:32 ` [PATCH] video: fbdev: sm501fb: fix potential null pointer dereference on fbi Colin King
2017-11-17 16:03 ` Bartlomiej Zolnierkiewicz
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).