[lkml]   [2008]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Why is the kfree() argument const?
    On Mit, 2008-01-16 at 08:48 -0800, Christoph Lameter wrote:
    > On Wed, 16 Jan 2008, Johannes Weiner wrote:
    > > is there any reason why kfree() takes a const pointer just to degrade it
    > > with the call to slab_free()/__cache_free() again? The promise that the
    > > pointee is not modified is just bogus in this case, anyway, isn't it?
    > The object is modified in various cases f.e. because of poisoning or the
    > need to store the free pointer. So its bogus, yes. Pekka?

    Technically one should be able to pass a "const $type *" (which may
    have been a "non-const $type *" before but at some point in time it
    became "const $type *") to kfree().

    The (formerly) constant contents as such vanishes IMHO (and it is not
    really "modified").
    Poisoning and free memory handling is IMHO internal stuff to the free
    memory management subsystem and basically unrelated to the "life" of the
    pointered contents before it's death with kfree().

    Firmix Software GmbH
    mobil: +43 664 4416156 fax: +43 1 7890849-55
    Embedded Linux Development and Services

     \ /
      Last update: 2008-01-16 18:37    [W:0.023 / U:9.168 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site