Skip to content

Commit

Permalink
kmemleak: Check for NULL pointer returned by create_object()
Browse files Browse the repository at this point in the history
This patch adds NULL pointer checking in the early_alloc() function.

Reported-by: Paul E. McKenney <[email protected]>
Signed-off-by: Catalin Marinas <[email protected]>
Acked-by: Pekka Enberg <[email protected]>
Acked-by: Paul E. McKenney <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
ctmarinas authored and torvalds committed Oct 9, 2009
1 parent c1bcd6b commit 0d5d1aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/kmemleak.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,11 +834,14 @@ static void early_alloc(struct early_log *log)
rcu_read_lock();
object = create_object((unsigned long)log->ptr, log->size,
log->min_count, GFP_ATOMIC);
if (!object)
goto out;
spin_lock_irqsave(&object->lock, flags);
for (i = 0; i < log->trace_len; i++)
object->trace[i] = log->trace[i];
object->trace_len = log->trace_len;
spin_unlock_irqrestore(&object->lock, flags);
out:
rcu_read_unlock();
}

Expand Down

0 comments on commit 0d5d1aa

Please sign in to comment.