All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 19/23] arm: Fix possible null pointer read access
@ 2011-01-30 19:29 ` Stefan Weil
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2011-01-30 19:29 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Stefan Weil, Russell King, linux-omap, linux-arm-kernel, linux-kernel

These errors were found by cppcheck:
arch/arm/mach-omap2/smartreflex.c:784: error: Possible null pointer dereference: sr_info
arch/arm/mach-omap2/smartreflex.c:799: error: Possible null pointer dereference: sr_info

Both conditional statements are executed when sr_info == NULL,
so accessing sr_info->voltdm would fail.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 arch/arm/mach-omap2/smartreflex.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 77ecebf..af39d17 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -780,8 +780,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val)
 	struct omap_sr *sr_info = (struct omap_sr *) data;

 	if (!sr_info) {
-		pr_warning("%s: omap_sr struct for sr_%s not found\n",
-			__func__, sr_info->voltdm->name);
+		pr_warning("%s: omap_sr struct not found\n", __func__);
 		return -EINVAL;
 	}

@@ -795,8 +794,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
 	struct omap_sr *sr_info = (struct omap_sr *) data;

 	if (!sr_info) {
-		pr_warning("%s: omap_sr struct for sr_%s not found\n",
-			__func__, sr_info->voltdm->name);
+		pr_warning("%s: omap_sr struct not found\n", __func__);
 		return -EINVAL;
 	}

--
1.7.2.3


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

* [PATCH 19/23] arm: Fix possible null pointer read access
@ 2011-01-30 19:29 ` Stefan Weil
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2011-01-30 19:29 UTC (permalink / raw)
  To: linux-arm-kernel

These errors were found by cppcheck:
arch/arm/mach-omap2/smartreflex.c:784: error: Possible null pointer dereference: sr_info
arch/arm/mach-omap2/smartreflex.c:799: error: Possible null pointer dereference: sr_info

Both conditional statements are executed when sr_info == NULL,
so accessing sr_info->voltdm would fail.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-omap at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 arch/arm/mach-omap2/smartreflex.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 77ecebf..af39d17 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -780,8 +780,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val)
 	struct omap_sr *sr_info = (struct omap_sr *) data;

 	if (!sr_info) {
-		pr_warning("%s: omap_sr struct for sr_%s not found\n",
-			__func__, sr_info->voltdm->name);
+		pr_warning("%s: omap_sr struct not found\n", __func__);
 		return -EINVAL;
 	}

@@ -795,8 +794,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
 	struct omap_sr *sr_info = (struct omap_sr *) data;

 	if (!sr_info) {
-		pr_warning("%s: omap_sr struct for sr_%s not found\n",
-			__func__, sr_info->voltdm->name);
+		pr_warning("%s: omap_sr struct not found\n", __func__);
 		return -EINVAL;
 	}

--
1.7.2.3

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

* Re: [PATCH 19/23] arm: Fix possible null pointer read access
  2011-01-30 19:29 ` Stefan Weil
@ 2011-01-31 16:26   ` Kevin Hilman
  -1 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2011-01-31 16:26 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Tony Lindgren, Russell King, linux-omap, linux-arm-kernel, linux-kernel

Stefan Weil <weil@mail.berlios.de> writes:

> These errors were found by cppcheck:
> arch/arm/mach-omap2/smartreflex.c:784: error: Possible null pointer dereference: sr_info
> arch/arm/mach-omap2/smartreflex.c:799: error: Possible null pointer dereference: sr_info
>
> Both conditional statements are executed when sr_info == NULL,
> so accessing sr_info->voltdm would fail.
>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: linux-omap@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Thanks, queuing for 2.6.38-rc in my pm-fixes branch.

Kevin

> ---
>  arch/arm/mach-omap2/smartreflex.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 77ecebf..af39d17 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -780,8 +780,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val)
>  	struct omap_sr *sr_info = (struct omap_sr *) data;
>
>  	if (!sr_info) {
> -		pr_warning("%s: omap_sr struct for sr_%s not found\n",
> -			__func__, sr_info->voltdm->name);
> +		pr_warning("%s: omap_sr struct not found\n", __func__);
>  		return -EINVAL;
>  	}
>
> @@ -795,8 +794,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
>  	struct omap_sr *sr_info = (struct omap_sr *) data;
>
>  	if (!sr_info) {
> -		pr_warning("%s: omap_sr struct for sr_%s not found\n",
> -			__func__, sr_info->voltdm->name);
> +		pr_warning("%s: omap_sr struct not found\n", __func__);
>  		return -EINVAL;
>  	}
>
> --
> 1.7.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* [PATCH 19/23] arm: Fix possible null pointer read access
@ 2011-01-31 16:26   ` Kevin Hilman
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2011-01-31 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

Stefan Weil <weil@mail.berlios.de> writes:

> These errors were found by cppcheck:
> arch/arm/mach-omap2/smartreflex.c:784: error: Possible null pointer dereference: sr_info
> arch/arm/mach-omap2/smartreflex.c:799: error: Possible null pointer dereference: sr_info
>
> Both conditional statements are executed when sr_info == NULL,
> so accessing sr_info->voltdm would fail.
>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: linux-omap at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Thanks, queuing for 2.6.38-rc in my pm-fixes branch.

Kevin

> ---
>  arch/arm/mach-omap2/smartreflex.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 77ecebf..af39d17 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -780,8 +780,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val)
>  	struct omap_sr *sr_info = (struct omap_sr *) data;
>
>  	if (!sr_info) {
> -		pr_warning("%s: omap_sr struct for sr_%s not found\n",
> -			__func__, sr_info->voltdm->name);
> +		pr_warning("%s: omap_sr struct not found\n", __func__);
>  		return -EINVAL;
>  	}
>
> @@ -795,8 +794,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
>  	struct omap_sr *sr_info = (struct omap_sr *) data;
>
>  	if (!sr_info) {
> -		pr_warning("%s: omap_sr struct for sr_%s not found\n",
> -			__func__, sr_info->voltdm->name);
> +		pr_warning("%s: omap_sr struct not found\n", __func__);
>  		return -EINVAL;
>  	}
>
> --
> 1.7.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

end of thread, other threads:[~2011-01-31 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-30 19:29 [PATCH 19/23] arm: Fix possible null pointer read access Stefan Weil
2011-01-30 19:29 ` Stefan Weil
2011-01-31 16:26 ` Kevin Hilman
2011-01-31 16:26   ` Kevin Hilman

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.