Re: [PATCH] kernel: use kcalloc instead kmalloc/memset

From: Andrew Morton (akpm_at_osdl.org)
Date: 08/05/05

  • Next message: Tanaka Akira: "2.6 select doesn't notify readablity of /proc/loadavg."
    Date:	Thu, 4 Aug 2005 22:38:42 -0700
    To: Pekka Enberg <penberg@cs.helsinki.fi>
    
    

    Pekka Enberg <penberg@cs.helsinki.fi> wrote:
    >
    > This patch converts kernel/ to use kcalloc instead of kmalloc/memset.
    >

    grr.
     
    > - struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL);
    > + struct resource *res = kcalloc(1, sizeof(*res), GFP_KERNEL);

    Notice how every conversion you did passes in `1' in the first argument?

    And that's going to happen again and again and again. Each callsite
    needlessly passing that silly third argument, adding more kernel text.

    If we're going to do this, we should add a two-arg helper function first,
    and use that, no?
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Tanaka Akira: "2.6 select doesn't notify readablity of /proc/loadavg."

    Relevant Pages

    • Re: Fw: Re: 2.6.1: process start times by procps
      ... At first blush, no. ... If it is supposed to be the time of boot then it should be ... This conversion is the problem. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.5-mc2
      ... IIRC -1 is promoted only afterward, yielding ... > better behaved in this instance (language lawyer territory). ... the conversion to unsigned before the conversion to long long, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 1/5] compat_ioctl call seems to miss a security hook
      ... > I suppose there is one case (not introduced by the patch). ... > conversion is needed, ... conversions, call my regular handlers. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: kernel.bkbits.net off the air
      ... In newsgroup: linux.dev.kernel ... > It's not a headache for us to do the conversion, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • driver model: more pci_choose_state()s are needed
      ... During my conversion, I discovered two more places where ... pci_choose_state is needed to preserve type information. ... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl! ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)