[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D0F6E11D1@AcuExch.aculab.com>
Date: Wed, 19 Mar 2014 14:09:57 +0000
From: David Laight <David.Laight@...LAB.COM>
To: "'behanw@...verseincode.com'" <behanw@...verseincode.com>,
"linville@...driver.com" <linville@...driver.com>,
"johannes@...solutions.net" <johannes@...solutions.net>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
"dwmw2@...radead.org" <dwmw2@...radead.org>,
"pageexec@...email.hu" <pageexec@...email.hu>,
Jan-Simon Möller <dl9pf@....de>,
Vinícius Tinti <viniciustinti@...il.com>,
Mark Charlebois <charlebm@...il.com>
Subject: RE: [PATCH v3] mac80211: LLVMLinux: Remove VLAIS usage from mac80211
From: behanw@...verseincode.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@....de>
> Signed-off-by: Behan Webster <behanw@...verseincode.com>
> Signed-off-by: Vincius Tinti <viniciustinti@...il.com>
> Signed-off-by: Mark Charlebois <charlebm@...il.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
Powered by blists - more mailing lists