Skip to content

Commit

Permalink
kasan: change allocation and freeing stack traces headers
Browse files Browse the repository at this point in the history
Change stack traces headers from:

  Allocated:
  PID = 42

to:

  Allocated by task 42:

Makes the report one line shorter and look better.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andrey Konovalov <[email protected]>
Acked-by: Dmitry Vyukov <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
xairy authored and torvalds committed May 3, 2017
1 parent 7d418f7 commit b6b72f4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mm/kasan/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ static void kasan_end_report(unsigned long *flags)
kasan_enable_current();
}

static void print_track(struct kasan_track *track)
static void print_track(struct kasan_track *track, const char *prefix)
{
pr_err("PID = %u\n", track->pid);
pr_err("%s by task %u:\n", prefix, track->pid);
if (track->stack) {
struct stack_trace trace;

Expand All @@ -201,10 +201,8 @@ static void kasan_object_err(struct kmem_cache *cache, void *object)
if (!(cache->flags & SLAB_KASAN))
return;

pr_err("Allocated:\n");
print_track(&alloc_info->alloc_track);
pr_err("Freed:\n");
print_track(&alloc_info->free_track);
print_track(&alloc_info->alloc_track, "Allocated");
print_track(&alloc_info->free_track, "Freed");
}

void kasan_report_double_free(struct kmem_cache *cache, void *object,
Expand Down

0 comments on commit b6b72f4

Please sign in to comment.