Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4baffc55-510e-96d3-3487-5ea09f993a0c@redhat.com>
Date: Wed, 9 May 2018 09:08:24 -0700
From: Laura Abbott <labbott@...hat.com>
To: Kees Cook <keescook@...omium.org>, Matthew Wilcox <mawilcox@...rosoft.com>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>,
 linux-kernel@...r.kernel.org, linux-mm@...ck.org,
 kernel-hardening@...ts.openwall.com
Subject: Re: [RFC][PATCH 00/13] Provide saturating helpers for allocation

On 05/08/2018 05:42 PM, Kees Cook wrote:
> This is a stab at providing three new helpers for allocation size
> calculation:
> 
> struct_size(), array_size(), and array3_size().
> 
> These are implemented on top of Rasmus's overflow checking functions,
> and the last 8 patches are all treewide conversions of open-coded
> multiplications into the various combinations of the helper functions.
> 
> -Kees
> 
> 
Obvious question (that might indicate this deserves documentation?)

What's the difference between

kmalloc_array(cnt, sizeof(struct blah), GFP_KERNEL);

and

kmalloc(array_size(cnt, struct blah), GFP_KERNEL);


and when would you use one over the other?

Thanks,
Laura

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.