public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 4/4] sony-laptop: potential null dereference
@ 2011-02-26 12:56 Dan Carpenter
  2011-02-27 12:20 ` Mattia Dongili
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-02-26 12:56 UTC (permalink / raw)
  To: Mattia Dongili; +Cc: Matthew Garrett, platform-driver-x86, kernel-janitors

In the original code, if "device_enum" was NULL then it would
dereference it when it printed the error message.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 0db9049..c24aa4a 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1311,7 +1311,11 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
 	}
 
 	device_enum = (union acpi_object *) buffer.pointer;
-	if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
+	if (!device_enum) {
+		pr_err(DRV_PFX "Invalid SN06 return object.");
+		goto out_no_enum;
+	}
+	if (device_enum->type != ACPI_TYPE_BUFFER) {
 		pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n",
 				device_enum->type);
 		goto out_no_enum;

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

* Re: [patch 4/4] sony-laptop: potential null dereference
  2011-02-26 12:56 [patch 4/4] sony-laptop: potential null dereference Dan Carpenter
@ 2011-02-27 12:20 ` Mattia Dongili
  2011-02-27 14:13   ` [patch 4/4 v2] " Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Mattia Dongili @ 2011-02-27 12:20 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Matthew Garrett, platform-driver-x86, kernel-janitors

On Sat, Feb 26, 2011 at 03:56:11PM +0300, Dan Carpenter wrote:
> In the original code, if "device_enum" was NULL then it would
> dereference it when it printed the error message.

Yup, this and the others are actual bugs, thanks for reviewing the code.

> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index 0db9049..c24aa4a 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -1311,7 +1311,11 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
>  	}
>  
>  	device_enum = (union acpi_object *) buffer.pointer;
> -	if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
> +	if (!device_enum) {
> +		pr_err(DRV_PFX "Invalid SN06 return object.");

Just a nitpick but I'd say there was no return object at all. ;)

-- 
mattia
:wq!

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

* [patch 4/4 v2] sony-laptop: potential null dereference
  2011-02-27 12:20 ` Mattia Dongili
@ 2011-02-27 14:13   ` Dan Carpenter
  2011-02-27 21:06     ` Mattia Dongili
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-02-27 14:13 UTC (permalink / raw)
  To: Mattia Dongili; +Cc: Matthew Garrett, platform-driver-x86, kernel-janitors

In the original code, if "device_enum" was NULL then it would
dereference it when it printed the error message.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
v2:  Fixed the error message.

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 0db9049..c24aa4a 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1311,7 +1311,11 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
 	}
 
 	device_enum = (union acpi_object *) buffer.pointer;
-	if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
+	if (!device_enum) {
+		pr_err(DRV_PFX "No SN06 return object.");
+		goto out_no_enum;
+	}
+	if (device_enum->type != ACPI_TYPE_BUFFER) {
 		pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n",
 				device_enum->type);
 		goto out_no_enum;


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

* Re: [patch 4/4 v2] sony-laptop: potential null dereference
  2011-02-27 14:13   ` [patch 4/4 v2] " Dan Carpenter
@ 2011-02-27 21:06     ` Mattia Dongili
  0 siblings, 0 replies; 4+ messages in thread
From: Mattia Dongili @ 2011-02-27 21:06 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Matthew Garrett, platform-driver-x86, kernel-janitors

Hi Matthew,

could you pick this and the other 3 up for next?

Thanks!

On Sun, Feb 27, 2011 at 05:13:25PM +0300, Dan Carpenter wrote:
> In the original code, if "device_enum" was NULL then it would
> dereference it when it printed the error message.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Acked-by: Mattia Dongili <malattia@linux.it>

> ---
> v2:  Fixed the error message.
> 
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index 0db9049..c24aa4a 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -1311,7 +1311,11 @@ static void sony_nc_rfkill_setup(struct acpi_device *device)
>  	}
>  
>  	device_enum = (union acpi_object *) buffer.pointer;
> -	if (!device_enum || device_enum->type != ACPI_TYPE_BUFFER) {
> +	if (!device_enum) {
> +		pr_err(DRV_PFX "No SN06 return object.");
> +		goto out_no_enum;
> +	}
> +	if (device_enum->type != ACPI_TYPE_BUFFER) {
>  		pr_err(DRV_PFX "Invalid SN06 return object 0x%.2x\n",
>  				device_enum->type);
>  		goto out_no_enum;
> 
-- 
mattia
:wq!

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

end of thread, other threads:[~2011-02-27 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-26 12:56 [patch 4/4] sony-laptop: potential null dereference Dan Carpenter
2011-02-27 12:20 ` Mattia Dongili
2011-02-27 14:13   ` [patch 4/4 v2] " Dan Carpenter
2011-02-27 21:06     ` Mattia Dongili

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