lib/kasprintf.c: use kmalloc_track_caller() to get accurate traces for kvasprintf
authorEzequiel Garcia <elezegarcia@gmail.com>
Wed, 10 Oct 2012 22:54:04 +0000 (15:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 10 Oct 2012 23:50:15 +0000 (08:50 +0900)
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 <elezegarcia@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/kasprintf.c

index ae0de80c1c8878f34d27a7677d37cc7c64eca256..32f12150fc4f4a82aace1ff42afc17969f8692a3 100644 (file)
@@ -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;