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: 4903481 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 00DA29F32F for ; Mon, 15 Sep 2014 07:29:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C261920179 for ; Mon, 15 Sep 2014 07:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E6342015E for ; Mon, 15 Sep 2014 07:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753515AbaIOHcJ (ORCPT ); Mon, 15 Sep 2014 03:32:09 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:44142 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753501AbaIOHb7 (ORCPT ); Mon, 15 Sep 2014 03:31:59 -0400 Received: by mail-pd0-f170.google.com with SMTP id fp1so5639543pdb.15 for ; Mon, 15 Sep 2014 00:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=converseincode.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=V8dtqPLj2e8nFQ4XHWN918riZ9DRsVUavEttdO2vXGo=; b=EXtbA9QnlxmGkZYbHZQAbUmujU4bv6bcXOD5dTrZ5+6Krk97gxHxgQgLy8IPu7AJ8u gp8IBSpr9ZlNUtZxAseK8GbgRZFVRROOfUQ/hVnJ7R+wgfPcQjxVvStduMbiCyBaKbVW +KQkVTRRqjBIT++C3CgDo2DSPf74yDtzLl80A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=V8dtqPLj2e8nFQ4XHWN918riZ9DRsVUavEttdO2vXGo=; b=c0x5NuBdRhQFYSBbp1yykcjrl0jtOfi/ZgCfCJcZR23869wWe+1puHLkKqWGBoJF1Z gEGnqrYA5h57DQq8HOwTTTJHvKX6O/fEOxf/1VTuW/13iKKAN4iy9nPEKnoqxdnZH0T7 3BTZ5jjxW8ul+be7SQIOHC3M71g5IiixsZNPcboie9VxjCc8sYsv+Du2SCX0na6CmoNf vGHSA+aRq4UJ19RsT6Miv9nQt6c/sujauIA2WCDo7MAI+zj+NaFei1RQzkpBrzJNFuIe h85F/iKaqEkwo4A1t6BtTeUWdgY9ORI2H3SGRx9DeIf/yZq6EfYAuo2f3KWKO40fq9Ji tIPA== X-Gm-Message-State: ALoCoQka3MAXQ+FNn+DLy6YZFnz2yAxNahNrPu4ypEqKAffC81AEUAdz5X0Y4ZuWskdmV8IlqW0Y 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-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);