Re: [PATCH] some kmalloc/memset ->kzalloc (tree wide)

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

 



Am 07.07.2007 15:36 schrieb yoann padioleau:
> On 7 juil. 07, at 15:07, Tilman Schmidt wrote:
> 
>> This misses the semantic distinction between the first and second
>> arguments of kcalloc(). The first argument is supposed to be the
>> number of elements to allocate and the second their size. As a
>> consequence, the following hunks in your pathc are wrong:
> 
> Yes you are right. Andrew Morton fixed the problem in a
> subsequent patch.

That's ok then. Andrew is doing an awesome job.

> I should have written a more precise semantic patch such as
> 
> @@
> expression E;
> constant c;
> type T;
> @@
> 
> - kzalloc(sizeof(T) * c, E)
> + kcalloc(c, sizeof(T), E)
> 
> Note that sometimes the code is written as  kzalloc(c * sizeof(T), E)
> as in   kzalloc(2 * sizeof(struct resource), GFP_KERNEL)  but
> our transformation engine can handle the commutativity of '*' and still
> performs the right transformation.

Cool. That transformation engine sure sounds like an interesting
piece of code.

Regards,
Tilman

-- 
Tilman Schmidt                          E-Mail: [email protected]
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)

Attachment: signature.asc
Description: OpenPGP digital signature


[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