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 <[email protected]>
Cc: Sudip Mukherjee <[email protected]>
Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
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;
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;