Skip to content

Commit 5fa1f45

Browse files
Colin Ian Kingbzolnier
authored andcommitted
video: fbdev: sm501fb: fix potential null pointer dereference on fbi
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> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
1 parent d447ebf commit 5fa1f45

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/video/fbdev/sm501fb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,11 +2100,12 @@ static int sm501fb_suspend_fb(struct sm501fb_info *info,
21002100
enum sm501_controller head)
21012101
{
21022102
struct fb_info *fbi = info->fb[head];
2103-
struct sm501fb_par *par = fbi->par;
2103+
struct sm501fb_par *par;
21042104

21052105
if (!fbi)
21062106
return 0;
21072107

2108+
par = fbi->par;
21082109
if (par->screen.size == 0)
21092110
return 0;
21102111

@@ -2150,11 +2151,12 @@ static void sm501fb_resume_fb(struct sm501fb_info *info,
21502151
enum sm501_controller head)
21512152
{
21522153
struct fb_info *fbi = info->fb[head];
2153-
struct sm501fb_par *par = fbi->par;
2154+
struct sm501fb_par *par;
21542155

21552156
if (!fbi)
21562157
return;
21572158

2159+
par = fbi->par;
21582160
if (par->screen.size == 0)
21592161
return;
21602162

0 commit comments

Comments
 (0)