Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1385625 > unrolled thread

[patch] tracing: checking for NULL instead of IS_ERR()

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-04-23 12:30 +0200
Last post2016-04-26 15:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [patch] tracing: checking for NULL instead of IS_ERR() Dan Carpenter <dan.carpenter@oracle.com> - 2016-04-23 12:30 +0200
    Re: [patch] tracing: checking for NULL instead of IS_ERR() Tom Zanussi <tom.zanussi@linux.intel.com> - 2016-04-25 21:00 +0200
      Re: [patch] tracing: checking for NULL instead of IS_ERR() Steven Rostedt <rostedt@goodmis.org> - 2016-04-26 15:50 +0200

#1385625 — [patch] tracing: checking for NULL instead of IS_ERR()

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-04-23 12:30 +0200
Subject[patch] tracing: checking for NULL instead of IS_ERR()
Message-ID<rr2Z4-1v8-23@gated-at.bofh.it>
tracing_map_elt_alloc() returns ERR_PTRs on error, never NULL.

Fixes: 08d43a5fa063 ('tracing: Add lock-free tracing_map')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c
index e0f1729..e7dfc5e 100644
--- a/kernel/trace/tracing_map.c
+++ b/kernel/trace/tracing_map.c
@@ -814,7 +814,7 @@ static struct tracing_map_elt *copy_elt(struct tracing_map_elt *elt)
 	unsigned int i;
 
 	dup_elt = tracing_map_elt_alloc(elt->map);
-	if (!dup_elt)
+	if (IS_ERR(dup_elt))
 		return NULL;
 
 	if (elt->map->ops && elt->map->ops->elt_copy)

[toc] | [next] | [standalone]


#1386752

FromTom Zanussi <tom.zanussi@linux.intel.com>
Date2016-04-25 21:00 +0200
Message-ID<rrTTI-2ag-31@gated-at.bofh.it>
In reply to#1385625
Hi Dan,

On 04/23/2016 05:23 AM, Dan Carpenter wrote:
> tracing_map_elt_alloc() returns ERR_PTRs on error, never NULL.
>
> Fixes: 08d43a5fa063 ('tracing: Add lock-free tracing_map')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c
> index e0f1729..e7dfc5e 100644
> --- a/kernel/trace/tracing_map.c
> +++ b/kernel/trace/tracing_map.c
> @@ -814,7 +814,7 @@ static struct tracing_map_elt *copy_elt(struct tracing_map_elt *elt)
>   	unsigned int i;
>
>   	dup_elt = tracing_map_elt_alloc(elt->map);
> -	if (!dup_elt)
> +	if (IS_ERR(dup_elt))
>   		return NULL;
>
>   	if (elt->map->ops && elt->map->ops->elt_copy)
>

Thanks for fixing this.  I found another one along the same lines which 
I'll send a patch for shortly.

Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>

[toc] | [prev] | [next] | [standalone]


#1387494

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-04-26 15:50 +0200
Message-ID<rsbxh-eJ-29@gated-at.bofh.it>
In reply to#1386752
On Mon, 25 Apr 2016 13:59:32 -0500
Tom Zanussi <tom.zanussi@linux.intel.com> wrote:

> Hi Dan,
> 
> On 04/23/2016 05:23 AM, Dan Carpenter wrote:
> > tracing_map_elt_alloc() returns ERR_PTRs on error, never NULL.
> >
> > Fixes: 08d43a5fa063 ('tracing: Add lock-free tracing_map')
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >

> 
> Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>

Applied.

Thanks Dan and Tom,

-- Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web