lkml.org 
[lkml]   [2009]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 1/7] slab: introduce kzfree()
Hi Hugh.

Hugh Dickins wrote:
> Thanks for that, I remember it now.
>
> Okay, that's some justification for kfree(const void *).
>
> But I fail to see it as a justification for kzfree(const void *):
> if someone has "const char *string = kmalloc(size)" and then
> wants that string zeroed before it is freed, then I think it's
> quite right to cast out the const when calling kzfree().

Quite frankly, I fail to see how kzfree() is fundamentally different
from kfree(). I don't see kzfree() as a memset() + kfree() but rather as
a kfree() "and make sure no one sees my data". So the zeroing happens
_after_ you've invalidated the pointer with kzfree() so there's no
"zeroing of buffer going on". So the way I see it, Linus' argument for
having const for kfree() applies to kzfree().

That said, if you guys think it's a merge blocker, by all means remove
the const. I just want few less open-coded ksize() users, that's all.

Pekka


\
 
 \ /
  Last update: 2009-02-19 20:53    [W:0.104 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site