Skip to contentSkip to conversation

asus-wmi: potential NULL dereference in show_call()

PATCH In review Dan Carpenter 2 participants 2 messages Mar 15, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 asus-wmi: potential NULL dereference in show_call()

In the earlier check we assumed that "obj" could be NULL. I looked at some of the other places that call evaluate_object() and they check for NULL as well.

---
Can obj actually be NULL here? Perhaps a better fix would be to remove the first check.

drivers/platform/x86/asus-wmi.c +1 -1
index a038595..efc776c 100644
@@ -1343,7 +1343,7 @@ static int show_call(struct seq_file *m, void *data)
 	else
 		seq_printf(m, "%#x(%#x, %#x) = t:%d\n", asus->debug.method_id,
 			   asus->debug.dev_id, asus->debug.ctrl_param,
-			   obj->type);
+			   obj ? obj->type : -1);
 
 	kfree(obj);
 
maintainer Acked-by on v1 2/2
#1 lore raw
Quoted 8 lines · Dan Carpenter

In the earlier check we assumed that "obj" could be NULL.  I looked at some of the other places that call evaluate_object() and they check for NULL as well.

---
Can obj actually be NULL here?  Perhaps a better fix would be to remove the first check.

Yes I think it can.

Quoted 10 lines
drivers/platform/x86/asus-wmi.c +0 -0
index a038595..efc776c 100644
@@ -1343,7 +1343,7 @@ static int show_call(struct seq_file *m, void *data)

       else
               seq_printf(m, "%#x(%#x, %#x) = t:%d\n", asus->debug.method_id, asus->debug.dev_id, asus->debug.ctrl_param,
-                          obj->type);
+                          obj ? obj->type : -1);

Seems ok, I may change that later if we need to support more types.

Signature · 2 lines
Corentin Chary
http://xf.iksaif.net