From patchwork Tue Sep 23 04:42:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 37716 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A4D2F21177 for ; Tue, 23 Sep 2014 04:43:35 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id n3sf2095318wiv.9 for ; Mon, 22 Sep 2014 21:43:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=KZbTROhfny84hA0sBjL1iP3Xi1no6Lfoezl+pxIK/8I=; b=TyqwY5rPEg94AptMRDid43nK52qXbT74V4DfZskE2yY1E95ZI0hcS1vIouu9kmHp9U sabQK+yFr5qEhsbJ5K285V/D7oYIJkc3ksKnIa4NTeKHPiEfRcI5h4BRxBw5T7emOP0U UVcNVESMVCagCWeOnO+lwAUyLHGMbabY4Qp2yoqZtkM4FfseZUJR72ohzW215pcR8yQy FI4TPGkATTYFCHji4qpJq4UBggFBn5o2RPEu7d97jXET1b6qk6dLemIUhAycwl18RFM2 43/V+PB4YADllj2o3sN7mfAu4S+ZSO4JRhKQLzFOxtQUrXZJM3xINceRYyuXj4GUPcDE G7aQ== X-Gm-Message-State: ALoCoQlif3OMAEI0+i3amIgiwmogFSoK7T4yxMeTkSgFjuf+CglIrtw0/bpNh8T126VFiqHuUvL+ X-Received: by 10.112.190.102 with SMTP id gp6mr98733lbc.10.1411447414756; Mon, 22 Sep 2014 21:43:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.104 with SMTP id lf8ls2109lac.87.gmail; Mon, 22 Sep 2014 21:43:34 -0700 (PDT) X-Received: by 10.112.142.104 with SMTP id rv8mr27392433lbb.59.1411447414480; Mon, 22 Sep 2014 21:43:34 -0700 (PDT) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com [2a00:1450:4010:c03::22d]) by mx.google.com with ESMTPS id be20si16979379lab.17.2014.09.22.21.43.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Sep 2014 21:43:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) client-ip=2a00:1450:4010:c03::22d; Received: by mail-la0-f45.google.com with SMTP id el20so1544022lab.18 for ; Mon, 22 Sep 2014 21:43:34 -0700 (PDT) X-Received: by 10.152.7.8 with SMTP id f8mr29561314laa.27.1411447414421; Mon, 22 Sep 2014 21:43:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp352058lbb; Mon, 22 Sep 2014 21:43:33 -0700 (PDT) X-Received: by 10.66.155.105 with SMTP id vv9mr31100850pab.61.1411447411037; Mon, 22 Sep 2014 21:43:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xh10si7803583pab.42.2014.09.22.21.43.30 for ; Mon, 22 Sep 2014 21:43:31 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753964AbaIWEn0 (ORCPT + 27 others); Tue, 23 Sep 2014 00:43:26 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:40002 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753605AbaIWEnS (ORCPT ); Tue, 23 Sep 2014 00:43:18 -0400 Received: by mail-pa0-f54.google.com with SMTP id fb1so5899598pad.27 for ; Mon, 22 Sep 2014 21:43:17 -0700 (PDT) X-Received: by 10.67.24.8 with SMTP id ie8mr31237910pad.21.1411447397692; Mon, 22 Sep 2014 21:43:17 -0700 (PDT) Received: from galdor.websterwood.com (S0106dc9fdb80cffd.gv.shawcable.net. [96.50.97.138]) by mx.google.com with ESMTPSA id j13sm10774808pbq.42.2014.09.22.21.43.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Sep 2014 21:43:16 -0700 (PDT) From: behanw@converseincode.com To: agk@redhat.com, clm@fb.com, davem@davemloft.net, dm-devel@redhat.com, fabf@skynet.be, herbert@gondor.apana.org.au, jbacik@fb.com, snitzer@redhat.com, tadeusz.struk@intel.com Cc: akpm@linux-foundation.org, bruce.w.allan@intel.com, d.kasatkin@samsung.com, james.l.morris@oracle.com, john.griffin@intel.com, linux-btrfs@vger.kernel.org, linux-crypto@vger.kernel.org, linux-ima-devel@lists.sourceforge.net, linux-ima-user@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org, linux-security-module@vger.kernel.org, neilb@suse.de, qat-linux@intel.com, serge@hallyn.com, thomas.lendacky@amd.com, zohar@linux.vnet.ibm.com, torvalds@linux-foundation.org, =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= , Behan Webster , pageexec@freemail.hu Subject: [PATCH v4 12/12] crypto: LLVMLinux: Remove VLAIS usage from crypto/testmgr.c Date: Mon, 22 Sep 2014 21:42:17 -0700 Message-Id: <1411447337-22362-13-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411447337-22362-1-git-send-email-behanw@converseincode.com> References: <1411447337-22362-1-git-send-email-behanw@converseincode.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: behanw@converseincode.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Jan-Simon Möller Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99 compliant equivalent. This patch allocates the appropriate amount of memory using a char array using the SHASH_DESC_ON_STACK macro. The new code can be compiled with both gcc and clang. Signed-off-by: Jan-Simon Möller Signed-off-by: Behan Webster Reviewed-by: Mark Charlebois Acked-by: Herbert Xu Cc: pageexec@freemail.hu --- crypto/testmgr.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index ac2b631..b959c0c 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1714,16 +1714,14 @@ static int alg_test_crc32c(const struct alg_test_desc *desc, } do { - struct { - struct shash_desc shash; - char ctx[crypto_shash_descsize(tfm)]; - } sdesc; + SHASH_DESC_ON_STACK(shash, tfm); + u32 *ctx = (u32 *)shash_desc_ctx(shash); - sdesc.shash.tfm = tfm; - sdesc.shash.flags = 0; + shash->tfm = tfm; + shash->flags = 0; - *(u32 *)sdesc.ctx = le32_to_cpu(420553207); - err = crypto_shash_final(&sdesc.shash, (u8 *)&val); + *ctx = le32_to_cpu(420553207); + err = crypto_shash_final(shash, (u8 *)&val); if (err) { printk(KERN_ERR "alg: crc32c: Operation failed for " "%s: %d\n", driver, err);