drivers/video/fbdev : dereference without an error test
authorHimangi Saraogi <himangi774@gmail.com>
Sat, 21 Jun 2014 15:57:59 +0000 (21:27 +0530)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 26 Jun 2014 10:48:00 +0000 (13:48 +0300)
commitcb6ec182c13fc87a6562d47f18721dbd702adb52
treeebc9c1794ea2d12153d1153242a458ebc3794cf9
parenta497c3ba1d97fc69c1e78e7b96435ba8c2cb42ee
drivers/video/fbdev : dereference without an error test

After a variable is assigned the result of backlight_device_register, an
error test should be performed before a dereference.

A simplified version of the semantic match that finds this problem is
as follows:

// <smpl>
@def0@
expression x;
position p0;
@@

x@p0 = backlight_device_register(...)

@protected@
expression def0.x,E;
position def0.p0;
position p;
statement S;
@@
x@p0
... when != x = E
if (!IS_ERR(x) && ...) {<... x@p ...>} else S

@unprotected@
expression def0.x,E;
identifier fld;
position def0.p0;
position p != protected.p;
@@
x@p0
... when != x = E
* x@p->fld
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c