Re: [PATCH] vfs:Fix memory leak on error path in get_empty_file

From: Catalin Marinas
Date: Fri Jul 22 2016 - 06:48:04 EST

I can't find the original post (probably it only went to the
linux-fsdevel list), so replying to Nicholas here:

> On Thu, Jul 21, 2016 at 10:53:37PM -0400, Nicholas Krause wrote:
>> This fixes a memory leak on the error path if the call to
>> security_file_alloc fails to run successfully as detected
>> in this trace by kmemleak:
>> [ 321.783718] ath9k 0000:03:00.0 eth0: renamed from wlan0
>> [ 330.960024] atl1c 0000:02:00.0 eth1: renamed from eth126
>> [ 391.831384] WARNING: kmemcheck: Caught 64-bit read from uninitialized memory (ffff8800a8ad8a00)

Can you please understand that kmemleak != kmemcheck, even though the
names are similar? It would save both your and other developers' time.
See the corresponding Kconfig help text:

KMEMCHECK: "kmemcheck: trap use of uninitialized memory"
DEBUG_KMEMLEAK: "Kernel memory leak detector"