[lkml]   [2007]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] some kmalloc/memset ->kzalloc (tree wide)
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.


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

[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2007-07-08 01:05    [W:0.032 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site