Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1650363

Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred allocation form
Date 2017-05-25 12:40 +0200
Message-ID <tKYlr-70D-3@gated-at.bofh.it> (permalink)
References <tK3dw-2wK-13@gated-at.bofh.it> <tK3nb-2zS-5@gated-at.bofh.it> <tK3ZT-34F-9@gated-at.bofh.it> <tKByy-11f-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 2017-05-24 at 13:18 +0300, Alexey Dobriyan wrote:
> Proper fix is to introduce typed allocation macros with the following
> signatures:
> 
> T* lmalloc(T, gfp);
[]
>     struct foo *x;
>     x = lmalloc(struct foo, GFP_KERNEL);

Then code would be written

	x = lmalloc(typeof(*x), GFP_KERNEL);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred  allocation form Alexey Dobriyan <adobriyan@gmail.com> - 2017-05-22 23:40 +0200
  Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred  allocation form Randy Dunlap <rdunlap@infradead.org> - 2017-05-22 23:50 +0200
  Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as  preferred allocation form Joe Perches <joe@perches.com> - 2017-05-22 23:50 +0200
    Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as  preferred allocation form Andrew Morton <akpm@linux-foundation.org> - 2017-05-23 00:30 +0200
      Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as  preferred allocation form Joe Perches <joe@perches.com> - 2017-05-23 00:50 +0200
      Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred  allocation form Alexey Dobriyan <adobriyan@gmail.com> - 2017-05-24 12:20 +0200
        Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as  preferred allocation form Joe Perches <joe@perches.com> - 2017-05-25 12:40 +0200
          Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as  preferred allocation form Bernd Petrovitsch <bernd@petrovitsch.priv.at> - 2017-05-25 13:40 +0200
            Re: [PATCH] CodingStyle: delete "kmalloc(sizeof(*var))" as preferred  allocation form Pavel Machek <pavel@ucw.cz> - 2017-05-28 21:20 +0200
  [PATCH] checkpatch: Remove preference for alloc(sizeof(*p), ...) Joe Perches <joe@perches.com> - 2017-05-23 00:00 +0200

csiph-web