All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@stusta.de>
To: "Brown, Len" <len.brown@intel.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [2.6 patch] drivers/acpi/video.c: fix a NULL pointer dereference
Date: Sat, 11 Mar 2006 16:11:54 +0100	[thread overview]
Message-ID: <20060311151154.GR21864@stusta.de> (raw)
In-Reply-To: <F7DC2337C7631D4386A2DF6E8FB22B3006596EE5@hdsmsx401.amr.corp.intel.com>

On Fri, Mar 10, 2006 at 11:00:45PM -0500, Brown, Len wrote:
> 
> >The Coverity checker spotted this obvious bug in 
> >acpi_video_device_lcd_query_levels().
> >
> >
> >
> >Signed-off-by: Adrian Bunk <bunk@stusta.de>
> >
> >--- linux-2.6.16-rc5-mm3-full/drivers/acpi/video.c.old	
> >2006-03-10 18:04:18.000000000 +0100
> >+++ linux-2.6.16-rc5-mm3-full/drivers/acpi/video.c	
> >2006-03-10 18:04:33.000000000 +0100
> >@@ -321,11 +321,11 @@ acpi_video_device_lcd_query_levels(struc
> > 
> > 	status = acpi_evaluate_object(device->handle, "_BCL", 
> >NULL, &buffer);
> > 	if (!ACPI_SUCCESS(status))
> > 		return_VALUE(status);
> > 	obj = (union acpi_object *)buffer.pointer;
> >-	if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) {
> >+	if (obj && (obj->type != ACPI_TYPE_PACKAGE)) {
> 
> how about
> +	if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
>...

Yes, thanks for the correction.

cu
Adrian


<--  snip  -->


The Coverity checker spotted this bug in
acpi_video_device_lcd_query_levels().


Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.16-rc5-mm3-full/drivers/acpi/video.c.old	2006-03-10 18:04:18.000000000 +0100
+++ linux-2.6.16-rc5-mm3-full/drivers/acpi/video.c	2006-03-10 18:04:33.000000000 +0100
@@ -321,11 +321,11 @@ acpi_video_device_lcd_query_levels(struc
 
 	status = acpi_evaluate_object(device->handle, "_BCL", NULL, &buffer);
 	if (!ACPI_SUCCESS(status))
 		return_VALUE(status);
 	obj = (union acpi_object *)buffer.pointer;
-	if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) {
+	if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) {
 		ACPI_ERROR((AE_INFO, "Invalid _BCL data"));
 		status = -EFAULT;
 		goto err;
 	}
 

  reply	other threads:[~2006-03-11 15:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-11  4:00 [2.6 patch] drivers/acpi/video.c: fix a NULL pointer dereference Brown, Len
2006-03-11  4:00 ` Brown, Len
2006-03-11 15:11 ` Adrian Bunk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-03-13  3:33 Brown, Len
2006-03-13  3:33 ` Brown, Len
2006-03-10 17:09 Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060311151154.GR21864@stusta.de \
    --to=bunk@stusta.de \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.