Skip to content

Commit

Permalink
lib/kasprintf.c: use kmalloc_track_caller() to get accurate traces fo…
Browse files Browse the repository at this point in the history
…r kvasprintf

Previously kvasprintf() allocation was being done through kmalloc(),
thus producing an inaccurate trace report.

This is a common problem: in order to get accurate callsite tracing, a
lib/utils function shouldn't allocate kmalloc but instead use
kmalloc_track_caller.

Signed-off-by: Ezequiel Garcia <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
ezequielgarcia authored and torvalds committed Oct 10, 2012
1 parent 4ed134b commit 3e1aa66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/kasprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
len = vsnprintf(NULL, 0, fmt, aq);
va_end(aq);

p = kmalloc(len+1, gfp);
p = kmalloc_track_caller(len+1, gfp);
if (!p)
return NULL;

Expand Down

0 comments on commit 3e1aa66

Please sign in to comment.