Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fa1f45d authored by Colin Ian King's avatar Colin Ian King Committed by Bartlomiej Zolnierkiewicz
Browse files

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: default avatarColin Ian King <colin.king@canonical.com>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
parent d447ebf9
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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;