Skip to contentSkip to conversation

drivers/acpi/video.c: fix a NULL pointer dereference

PATCH New Brown, Len 2 participants 2 messages Mar 11, 2006 ACPI

lore
Share & tools
lore

Brown, Len

author
#0 lore raw
Quoted 13 lines

The Coverity checker spotted this obvious bug in
acpi_video_device_lcd_query_levels().

--- 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

Review acpi_video_device_lcd_query_levels(struc · line 327

Quoted 8 lines
(quoted diff) +1 -1
@@ -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)) {

Quoted 6 lines
(quoted diff) +0 -0
 		ACPI_ERROR((AE_INFO, "Invalid _BCL data"));
 		status = -EFAULT;
 		goto err;
 	}
#1 lore raw

PATCH 1/1 drivers/acpi/video.c: fix a NULL pointer dereference

Quoted 23 lines · Len
Quoted 13 lines

The Coverity checker spotted this obvious bug in
acpi_video_device_lcd_query_levels().

--- 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

Review acpi_video_device_lcd_query_levels(struc · line 327

Quoted 8 lines
(quoted diff) +1 -1
@@ -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

Review

Quoted 2 lines
(quoted diff) +1 -0
+	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().

drivers/acpi/video.c renamed from drivers/acpi/video.c.old +1 -1
@@ -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;
 	}