linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib: Use kmalloc_track_caller to get accurate traces for kvasprintf
@ 2012-10-04 12:36 Ezequiel Garcia
  0 siblings, 0 replies; only message in thread
From: Ezequiel Garcia @ 2012-10-04 12:36 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Tim Bird, Ezequiel Garcia, Sam Ravnborg, Andrew Morton

Previously kvasprintf allocation was being done through kmalloc,
thus producing an unaccurate 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.

Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
---
 lib/kasprintf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/kasprintf.c b/lib/kasprintf.c
index ae0de80..32f1215 100644
--- a/lib/kasprintf.c
+++ b/lib/kasprintf.c
@@ -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;
 
-- 
1.7.8.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-04 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-04 12:36 [PATCH] lib: Use kmalloc_track_caller to get accurate traces for kvasprintf Ezequiel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).