On Fri, Apr 19, 2019 at 9:37 PM Steven Rostedt <rost...@goodmis.org> wrote: > > On Fri, 19 Apr 2019 21:22:59 -0500 > Wenwen Wang <wang6...@umn.edu> wrote: > > > In trace_pid_write(), the buffer for trace parser is allocated through > > kmalloc() in trace_parser_get_init(). Later on, after the buffer is used, > > it is then freed through kfree() in trace_parser_put(). However, it is > > possible that trace_pid_write() is terminated due to unexpected errors, > > e.g., ENOMEM. In that case, the allocated buffer will not be freed, which > > is a memory leak bug. > > > > To fix this issue, free the allocated buffer when an error is encountered. > > Thanks for the patch. Did you find this through manual inspection, > running KASAN or via one of the static analyzers?
Thanks for your question, Steve. It was based on a prototype of a research project, which aims to statically detect memory leak bugs in operating system kernels. Wenwen