From patchwork Fri Sep 5 23:06:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 36911 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E7CF8202E4 for ; Fri, 5 Sep 2014 23:06:59 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 142sf37493772ykq.8 for ; Fri, 05 Sep 2014 16:06:59 -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 :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=NUbjnxrbGxrAEdTkyyK7do3Akb85rXvmcX/weqYAcqs=; b=CZo6Mzq47B4J63qywiw4oQqW4o8wLmU/8JPfQcPp+yUL5FoREaWO7MphFfcLpQRCKK rwxmMN3ygj7D13GEpWdNfQ1XJYblpO7ooH0QOADsMDHQn5ej3+sIUxdvZQIHUyeQW283 +ynWDZWCAMgz8PNJaLW5A/0NfPvmrj0HsxCs6uCmFt1M3u7aZzs7kYeiCSf3j3LlNWQ5 swNwfBi6kzsOOW1e6hlu8/Y6SG5+kxbdZyDCzHrmlgrY6YLDwpvoRYVQ7nN+57pf5RQ1 tWmjNpRM2e0us5k1TafH3yySQXqvjhrmb9gp9BvYJQtRItsMI0dkwKk7uaivw+HD2E5B zNVg== X-Gm-Message-State: ALoCoQlkXDzHCS7NBo1YXyqCCOPY19nu+xq3pqeZl6b+mHtEIAmoFR1rffEyIvYAj0gVuKNMROIV X-Received: by 10.236.231.76 with SMTP id k72mr9569003yhq.7.1409958419766; Fri, 05 Sep 2014 16:06:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.240 with SMTP id n103ls913505qgd.13.gmail; Fri, 05 Sep 2014 16:06:59 -0700 (PDT) X-Received: by 10.220.167.9 with SMTP id o9mr12995184vcy.8.1409958419629; Fri, 05 Sep 2014 16:06:59 -0700 (PDT) Received: from mail-vc0-x22a.google.com (mail-vc0-x22a.google.com [2607:f8b0:400c:c03::22a]) by mx.google.com with ESMTPS id n5si1536313vcz.59.2014.09.05.16.06.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 16:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c03::22a as permitted sender) client-ip=2607:f8b0:400c:c03::22a; Received: by mail-vc0-f170.google.com with SMTP id la4so13287708vcb.1 for ; Fri, 05 Sep 2014 16:06:59 -0700 (PDT) X-Received: by 10.221.64.205 with SMTP id xj13mr4333183vcb.18.1409958419548; Fri, 05 Sep 2014 16:06:59 -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.221.45.67 with SMTP id uj3csp148830vcb; Fri, 5 Sep 2014 16:06:59 -0700 (PDT) X-Received: by 10.70.90.76 with SMTP id bu12mr26739164pdb.31.1409958418685; Fri, 05 Sep 2014 16:06:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ur9si6272661pbc.125.2014.09.05.16.06.58 for ; Fri, 05 Sep 2014 16:06:58 -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 S1753921AbaIEXG5 (ORCPT ); Fri, 5 Sep 2014 19:06:57 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:48140 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752924AbaIEXG4 (ORCPT ); Fri, 5 Sep 2014 19:06:56 -0400 Received: by mail-pa0-f44.google.com with SMTP id rd3so22953214pab.17 for ; Fri, 05 Sep 2014 16:06:56 -0700 (PDT) X-Received: by 10.70.133.136 with SMTP id pc8mr27068697pdb.0.1409958415972; Fri, 05 Sep 2014 16:06:55 -0700 (PDT) Received: from galdor.websterwood.com (S0106dc9fdb80cffd.gv.shawcable.net. [96.50.97.138]) by mx.google.com with ESMTPSA id fa16sm2787239pac.43.2014.09.05.16.06.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Sep 2014 16:06:54 -0700 (PDT) From: behanw@converseincode.com To: davem@davemloft.net, herbert@gondor.apana.org.au Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= , Behan Webster , pageexec@freemail.hu Subject: [PATCH v2] crypto: LLVMLinux: Remove VLAIS usage from crypto/testmgr.c Date: Fri, 5 Sep 2014 16:06:47 -0700 Message-Id: <1409958407-9173-1-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.9.1 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 2607:f8b0:400c:c03::22a 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 The use of variable length arrays in structs (VLAIS) in the Linux Kernel code precludes the use of compilers which don't implement VLAIS (for instance the Clang compiler). This patch instead allocates the appropriate amount of memory using an char array. struct shash_desc contains a flexible array member member ctx declared with CRYPTO_MINALIGN_ATTR, so sizeof(struct shash_desc) aligns the beginning of the array declared after struct shash_desc with long long. No trailing padding is required because it is not a struct type that can be used in an array. The CRYPTO_MINALIGN_ATTR is required so that desc is aligned with long long as would be the case for a struct containing a member with CRYPTO_MINALIGN_ATTR. Signed-off-by: Jan-Simon Möller Signed-off-by: Behan Webster Cc: pageexec@freemail.hu --- crypto/testmgr.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index ac2b631..34f5a32 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1714,16 +1714,16 @@ static int alg_test_crc32c(const struct alg_test_desc *desc, } do { - struct { - struct shash_desc shash; - char ctx[crypto_shash_descsize(tfm)]; - } sdesc; + char sdesc[sizeof(struct shash_desc) + + crypto_shash_descsize(tfm)] CRYPTO_MINALIGN_ATTR; + struct shash_desc *shash = (struct shash_desc *)sdesc; + 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);