Skip to contentSkip to conversation

tracing: checking for NULL instead of IS_ERR()

PATCH Applied Dan Carpenter 3 participants 3 messages Apr 23, 2016 – Apr 26, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: checking for NULL instead of IS_ERR()

tracing_map_elt_alloc() returns ERR_PTRs on error, never NULL.

Fixes 08d43a5fa063 ('tracing: Add lock-free tracing_map')
kernel/trace/tracing_map.c +1 -1
index e0f1729..e7dfc5e 100644
@@ -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)
Acked-by on v1 1/1
#1 lore raw

Hi Dan,

Quoted 11 lines · Dan Carpenter

tracing_map_elt_alloc() returns ERR_PTRs on error, never NULL.

Fixes 08d43a5fa063 ('tracing: Add lock-free tracing_map')
kernel/trace/tracing_map.c +0 -0
index e0f1729..e7dfc5e 100644

kernel/trace/tracing_map.c static struct tracing_map_elt *copy_elt(struct tracing_map_elt *elt) · line 820

Quoted 8 lines
kernel/trace/tracing_map.c +1 -1
@@ -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.