Re: [PATCH] drivers: Conversions from kmalloc+memset to k(z|c)alloc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stefan Richter wrote:
Jeff Garzik wrote:
Pekka Enberg wrote:
On 7/21/06, Rolf Eike Beer <[email protected]> wrote:
-     if (!(handle = kmalloc(sizeof(struct input_handle), GFP_KERNEL)))
+     handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
+     if (!handle)
              return NULL;
sizeof(*handle)?
In general, yes. However, some maintainers don't like that, so I would
recommend to keep them as-is unless you get a clear ack from the
maintainer to change it.

I suggest:
 - check if "sizeof(type)"->"sizeof(*ptr)" is correct
 - if yes, change it
 - do this for all kmalloc + kzalloc in a file you touched, or
   better yet for all kmalloc + kzalloc in a driver or subsystem you
   touched

This breaks the rules of standard Linux patches.

The patch should contain ONE logical change. Any cleanups such as sizeof(type) -> sizeof(*ptr) should be in a SEPARATE PATCH.

	Jeff


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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux