lkml.org 
[lkml]   [2000]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch-2.4.0-test8-pre1] buglet in sk_init().
    On Wed, 30 Aug 2000, Tigran Aivazian wrote:

    > Hi Linus,
    >
    > The sock slab cache is critical so one ought to panic if it can't be
    > created, like we do for all other slab caches.
    >
    > Regards,
    > Tigran
    >
    > --- linux/net/core/sock.c Thu Aug 24 08:08:47 2000
    > +++ work/net/core/sock.c Wed Aug 30 13:13:48 2000
    > @@ -609,7 +609,9 @@
    > {
    > sk_cachep = kmem_cache_create("sock", sizeof(struct sock), 0,
    > SLAB_HWCACHE_ALIGN, 0, 0);
    > -
    > + if (!sk_cachep)
    > + panic("Cannot create sock SLAB cache");
    > +
    > if (num_physpages <= 4096) {
    > sysctl_wmem_max = 32767;
    > sysctl_rmem_max = 32767;

    Just a little suggestion, because lots of patches similar to this have
    been floating around recently.

    Wouldn't it be better if we move the null pointer test and the panic()
    inside kmem_cache_create() similar to this

    ------------
    kmem_cache_t *kmem_cache_create(...)
    {
    ...
    opps:

    if (!cachep) {
    sprintf(panic_msg, "Cannot create %.20s SLAB cache",
    name);
    panic(panic_msg);
    }

    return cachep;
    }

    ------------

    A quick check showed that we have over 50 calls to kmem_cache_create().
    Doing the above would save a reasonable amount of code and text segment
    space.

    Regards,

    Matze

    --
    Matthias Hanisch mailto:matze@camline.com phone: +49 8137 935-219

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 12:38    [W:0.024 / U:0.116 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site