public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2] asus-wmi: potential NULL dereference in show_call()
@ 2011-03-15  7:07 Dan Carpenter
  2011-03-15  7:26 ` Corentin Chary
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-03-15  7:07 UTC (permalink / raw)
  To: Corentin Chary
  Cc: Matthew Garrett, acpi4asus-user, platform-driver-x86,
	kernel-janitors

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.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Can obj actually be NULL here?  Perhaps a better fix would be to remove
the first check.

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index a038595..efc776c 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -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);
 

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

* Re: [patch 2/2] asus-wmi: potential NULL dereference in show_call()
  2011-03-15  7:07 [patch 2/2] asus-wmi: potential NULL dereference in show_call() Dan Carpenter
@ 2011-03-15  7:26 ` Corentin Chary
  0 siblings, 0 replies; 2+ messages in thread
From: Corentin Chary @ 2011-03-15  7:26 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Matthew Garrett, acpi4asus-user, platform-driver-x86,
	kernel-janitors

On Tue, Mar 15, 2011 at 8:07 AM, Dan Carpenter <error27@gmail.com> wrote:
> 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.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> Can obj actually be NULL here?  Perhaps a better fix would be to remove
> the first check.

Yes I think it can.

> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index a038595..efc776c 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -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.

Acked-by: Corentin Chary <corentin.chary@gmail.com>
-- 
Corentin Chary
http://xf.iksaif.net

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

end of thread, other threads:[~2011-03-15  7:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-15  7:07 [patch 2/2] asus-wmi: potential NULL dereference in show_call() Dan Carpenter
2011-03-15  7:26 ` Corentin Chary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox