lkml.org 
[lkml]   [2014]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v3] mac80211: LLVMLinux: Remove VLAIS usage from mac80211
Date
From: behanw@converseincode.com
> Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
> compliant equivalent. This is the original VLAIS struct.
>
> struct {
> struct aead_request req;
> u8 priv[crypto_aead_reqsize(tfm)];
> } aead_req;
>
> This patch instead allocates the appropriate amount of memory using an char
> array.
>
> The new code can be compiled with both gcc and clang.
>
> Signed-off-by: Jan-Simon Mller <dl9pf@gmx.de>
> Signed-off-by: Behan Webster <behanw@converseincode.com>
> Signed-off-by: Vincius Tinti <viniciustinti@gmail.com>
> Signed-off-by: Mark Charlebois <charlebm@gmail.com>
> ---
> net/mac80211/aes_ccm.c | 40 ++++++++++++++++++++++------------------
> 1 file changed, 22 insertions(+), 18 deletions(-)
>
> diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c
> index 7c7df47..20521f9 100644
> --- a/net/mac80211/aes_ccm.c
> +++ b/net/mac80211/aes_ccm.c
> @@ -23,12 +23,14 @@ void ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
> u8 *data, size_t data_len, u8 *mic)
> {
> struct scatterlist assoc, pt, ct[2];
> - struct {
> - struct aead_request req;
> - u8 priv[crypto_aead_reqsize(tfm)];
> - } aead_req;
>
> - memset(&aead_req, 0, sizeof(aead_req));
> + char aead_req_data[sizeof(struct aead_request) +
> + crypto_aead_reqsize(tfm)]
> + __aligned(__alignof__(struct aead_request));
> +
> + struct aead_request *aead_req = (void *) aead_req_data;
> +
> + memset(aead_req, 0, sizeof(aead_req_data));

It seems to me that the underlying function(s) ought to be changed so that
this isn't needed.
Passing an extra parameter would probably cost very little.

David
\
 
 \ /
  Last update: 2014-03-19 16:01    [W:0.077 / U:0.648 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site