Re: krealloc in kernel/params.c

2014-10-16 Thread Rusty Russell
Rasmus Villemoes writes: > On Wed, Oct 15 2014, Rusty Russell wrote: > >> Rasmus Villemoes writes: >> The kzalloc-then-always-krealloc pattern is perhaps overly simplistic, >> but this code has clearly confused people. It worked on me... >> > > I think kzalloc immediately followed by kreallocin

Re: krealloc in kernel/params.c

2014-10-16 Thread Rasmus Villemoes
On Wed, Oct 15 2014, Rusty Russell wrote: > Rasmus Villemoes writes: >> It is likely that I'm just missing something trivial, but I have >> a hard time understanding 63662139e ("params: Fix potential >> memory leak in add_sysfs_param()"). > > Yes, it was a bad commit, and we've been discussing i

Re: krealloc in kernel/params.c

2014-10-14 Thread Rusty Russell
Rasmus Villemoes writes: > It is likely that I'm just missing something trivial, but I have > a hard time understanding 63662139e ("params: Fix potential > memory leak in add_sysfs_param()"). Yes, it was a bad commit, and we've been discussing it, see: [PATCH] params: fix potential memory leak i

krealloc in kernel/params.c

2014-10-14 Thread Rasmus Villemoes
It is likely that I'm just missing something trivial, but I have a hard time understanding 63662139e ("params: Fix potential memory leak in add_sysfs_param()"). [I take it for granted that krealloc() does not free its first argument when it fails, as reading mm/slab_common.c seems to confirm.] Some