video: fbdev: sm501fb: fix potential null pointer dereference on fbi
authorColin Ian King <colin.king@canonical.com>
Fri, 17 Nov 2017 16:21:48 +0000 (17:21 +0100)
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Fri, 17 Nov 2017 16:21:48 +0000 (17:21 +0100)
commit5fa1f45de8fd697d9f23050e20dd65c0998e6107
tree1228e9336961695239c00e577e6492afad26b353
parentd447ebf9c77b16effd8aca114d7d281639e3f77f
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>
drivers/video/fbdev/sm501fb.c