lkml.org 
[lkml]   [2012]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH RFC v2] slab: introduce kmalloc_array
From
On Fri, Feb 10, 2012 at 4:55 PM, Xi Wang <xi.wang@gmail.com> wrote:
> On Feb 10, 2012, at 8:11 AM, Alexey Dobriyan wrote:

>> Also, it could be written more "robust" against people who will make
>> sizeof() the first argument with __builtin_constant_p().

No,

If one dimension is constant, limit should be divided by it, so
compiler would have less chance
to screw up compile time evaluation.

Also, gfp_t mask could be made first argument if we ever want to
expand it to >2 dimensional arrays
without adding kaalloc3().

> Do you mean something like this?
>
>  BUILD_BUG_ON(__builtin_constant_p(n));
>
> or
>
>  BUILD_BUG_ON(__builtin_constant_p(n) && !__builtin_constant_p(size));
>
> - xi
--
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/

\
 
 \ /
  Last update: 2012-02-10 15:01    [W:0.105 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site