From patchwork Mon Sep 15 07:30:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 37411 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0CD24206A5 for ; Mon, 15 Sep 2014 07:40:24 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf1917423lbg.5 for ; Mon, 15 Sep 2014 00:40:22 -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=pq4rYugRtDML0NNcNBa/7YLFxjae5NiqHy8ZMbpLFA4=; b=SHthBE5DcDO+1HEy8AeLWv2nDbPc9uCmIKpdHspRK8MpzRi7JMWSyJZlVn7iLONk0j XJe2CkGShUAnxVQecblqtfKddrwSuhwaEB/iCPHzcSWX9uKpBVWR2+lemMzLYL6cVzHB iSRWlgoUzd3+Jx9SOINCfVwZRbjiIiHIMBF26cdVQZZrrIJ27lTIlh2oKaTmNh6I6+uD Ev3I5jTsVFRUymM6Ve9yK5dBGJi4Dp6q5eKSWpDwh0Mlv2ZVRXYuLVBczPQob5TW1v4U cvZ8TovZ2wrK0ZM0RJXB8kWdgselFNI0F817/zqx/ClDV3wdqCgetQ15Dy7CbvcKB+Qp 26Ag== X-Gm-Message-State: ALoCoQnEa9MIEXg6Pyyoi+SdoUiOmKYa87QTqK3cdW2erLTU2hANaOyObxXxd2L26HKsdKObcte7 X-Received: by 10.112.149.67 with SMTP id ty3mr6812184lbb.1.1410766353688; Mon, 15 Sep 2014 00:32:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.194 with SMTP id 2ls330418law.108.gmail; Mon, 15 Sep 2014 00:32:33 -0700 (PDT) X-Received: by 10.112.140.200 with SMTP id ri8mr1122426lbb.84.1410766353546; Mon, 15 Sep 2014 00:32:33 -0700 (PDT) Received: from mail-lb0-x233.google.com (mail-lb0-x233.google.com [2a00:1450:4010:c04::233]) by mx.google.com with ESMTPS id i1si17609813laf.41.2014.09.15.00.32.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Sep 2014 00:32:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::233 as permitted sender) client-ip=2a00:1450:4010:c04::233; Received: by mail-lb0-f179.google.com with SMTP id p9so3921051lbv.10 for ; Mon, 15 Sep 2014 00:32:32 -0700 (PDT) X-Received: by 10.152.42.136 with SMTP id o8mr6849894lal.71.1410766352229; Mon, 15 Sep 2014 00:32:32 -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 of9csp161706lbb; Mon, 15 Sep 2014 00:32:31 -0700 (PDT) X-Received: by 10.70.41.201 with SMTP id h9mr28091922pdl.55.1410766349186; Mon, 15 Sep 2014 00:32:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dc3si20968432pdb.254.2014.09.15.00.32.28 for ; Mon, 15 Sep 2014 00:32:29 -0700 (PDT) Received-SPF: none (google.com: linux-crypto-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 S1753477AbaIOHcC (ORCPT ); Mon, 15 Sep 2014 03:32:02 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:54808 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753505AbaIOHcA (ORCPT ); Mon, 15 Sep 2014 03:32:00 -0400 Received: by mail-pd0-f180.google.com with SMTP id ft15so5538508pdb.25 for ; Mon, 15 Sep 2014 00:31:59 -0700 (PDT) X-Received: by 10.68.131.134 with SMTP id om6mr35534455pbb.41.1410766319351; Mon, 15 Sep 2014 00:31:59 -0700 (PDT) Received: from galdor.edimax.com ([38.126.120.10]) by mx.google.com with ESMTPSA id cz1sm1011611pdb.85.2014.09.15.00.31.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Sep 2014 00:31:58 -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 v3 12/12] crypto: LLVMLinux: Remove VLAIS usage from crypto/testmgr.c Date: Mon, 15 Sep 2014 00:30:34 -0700 Message-Id: <1410766234-1634-13-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410766234-1634-1-git-send-email-behanw@converseincode.com> References: <1410766234-1634-1-git-send-email-behanw@converseincode.com> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-crypto@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:c04::233 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 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);