linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] video: omapdss: Fix potential null pointer dereference
@ 2014-05-30 10:38 Sachin Kamat
  2014-06-20  9:21 ` Sachin Kamat
  2014-06-23 11:43 ` Tomi Valkeinen
  0 siblings, 2 replies; 3+ messages in thread
From: Sachin Kamat @ 2014-05-30 10:38 UTC (permalink / raw)
  To: linux-fbdev

kmalloc can return null. Add a check to avoid potential null
pointer dereference error when the pointer is accessed later.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/video/fbdev/omap2/dss/omapdss-boot-init.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
index 99af9e88b2d8..2f0822ee3ff9 100644
--- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
@@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root)
 {
 	struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
 		GFP_KERNEL);
-	n->node = node;
-	n->root = root;
-	list_add(&n->list, &dss_conv_list);
+	if (n) {
+		n->node = node;
+		n->root = root;
+		list_add(&n->list, &dss_conv_list);
+	}
 }
 
 static bool __init omapdss_list_contains(const struct device_node *node)
-- 
1.7.9.5


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

* Re: [PATCH 1/1] video: omapdss: Fix potential null pointer dereference
  2014-05-30 10:38 [PATCH 1/1] video: omapdss: Fix potential null pointer dereference Sachin Kamat
@ 2014-06-20  9:21 ` Sachin Kamat
  2014-06-23 11:43 ` Tomi Valkeinen
  1 sibling, 0 replies; 3+ messages in thread
From: Sachin Kamat @ 2014-06-20  9:21 UTC (permalink / raw)
  To: linux-fbdev

On Fri, May 30, 2014 at 3:56 PM, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> kmalloc can return null. Add a check to avoid potential null
> pointer dereference error when the pointer is accessed later.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/video/fbdev/omap2/dss/omapdss-boot-init.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
> index 99af9e88b2d8..2f0822ee3ff9 100644
> --- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
> +++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
> @@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root)
>  {
>         struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
>                 GFP_KERNEL);
> -       n->node = node;
> -       n->root = root;
> -       list_add(&n->list, &dss_conv_list);
> +       if (n) {
> +               n->node = node;
> +               n->root = root;
> +               list_add(&n->list, &dss_conv_list);
> +       }
>  }
>
>  static bool __init omapdss_list_contains(const struct device_node *node)
> --
> 1.7.9.5
>
>

Gentle ping..

-- 
Regards,
Sachin.

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

* Re: [PATCH 1/1] video: omapdss: Fix potential null pointer dereference
  2014-05-30 10:38 [PATCH 1/1] video: omapdss: Fix potential null pointer dereference Sachin Kamat
  2014-06-20  9:21 ` Sachin Kamat
@ 2014-06-23 11:43 ` Tomi Valkeinen
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2014-06-23 11:43 UTC (permalink / raw)
  To: linux-fbdev

[-- Attachment #1: Type: text/plain, Size: 1155 bytes --]

On 30/05/14 13:26, Sachin Kamat wrote:
> kmalloc can return null. Add a check to avoid potential null
> pointer dereference error when the pointer is accessed later.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/video/fbdev/omap2/dss/omapdss-boot-init.c |    8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
> index 99af9e88b2d8..2f0822ee3ff9 100644
> --- a/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
> +++ b/drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
> @@ -121,9 +121,11 @@ static void __init omapdss_add_to_list(struct device_node *node, bool root)
>  {
>  	struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
>  		GFP_KERNEL);
> -	n->node = node;
> -	n->root = root;
> -	list_add(&n->list, &dss_conv_list);
> +	if (n) {
> +		n->node = node;
> +		n->root = root;
> +		list_add(&n->list, &dss_conv_list);
> +	}
>  }
>  
>  static bool __init omapdss_list_contains(const struct device_node *node)

Thanks, queued for 3.17.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-06-23 11:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-30 10:38 [PATCH 1/1] video: omapdss: Fix potential null pointer dereference Sachin Kamat
2014-06-20  9:21 ` Sachin Kamat
2014-06-23 11:43 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).