LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drivers/video: Bad error test before a dereference
@ 2008-09-26 13:53 Julien Brunel
  2008-11-06 15:33 ` Nicolas Ferre
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Brunel @ 2008-09-26 13:53 UTC (permalink / raw)
  To: nicolas.ferre, adaplas, linux-fbdev-devel, linux-kernel, kernel-janitors

The error test that follows the call to backlight_device_register
semms not to concern the right variable.

A simplified version of the semantic match that finds this problem is
as follows: 
(http://www.emn.fr/x-info/coccinelle/)
// <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;
identifier fld;
position def0.p0;
position p != protected.p;
@@
x@p0
... when != x = E
* x@p->fld
// </smpl>

Signed-off-by: Julien Brunel <brunel@diku.dk>
Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/video/atmel_lcdfb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -132,7 +132,7 @@ static void init_backlight(struct atmel_
 
 	bl = backlight_device_register("backlight", &sinfo->pdev->dev,
 			sinfo, &atmel_lcdc_bl_ops);
-	if (IS_ERR(sinfo->backlight)) {
+	if (IS_ERR(bl)) {
 		dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n",
 				PTR_ERR(bl));
 		return;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-13  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-26 13:53 [PATCH] drivers/video: Bad error test before a dereference Julien Brunel
2008-11-06 15:33 ` Nicolas Ferre
2008-11-13  8:26   ` [Linux-fbdev-devel] " Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).