From patchwork Tue Jan 10 01:39:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 13094563 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7B08C54EBE for ; Tue, 10 Jan 2023 01:39:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230179AbjAJBjO (ORCPT ); Mon, 9 Jan 2023 20:39:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230317AbjAJBjN (ORCPT ); Mon, 9 Jan 2023 20:39:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 578211AA1A; Mon, 9 Jan 2023 17:39:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE787614A3; Tue, 10 Jan 2023 01:39:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8EACC433EF; Tue, 10 Jan 2023 01:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673314750; bh=2kOxmVscJ0t8ceI4B5aGjHT1LyF2wAdxmeKbbucTgVM=; h=Date:From:To:Cc:Subject:From; b=s0zcsXJ1bYO8TaF0VS1YgBT615bIXmHXZD4oEytBCR1eBws6SdPfRKfb8iCQy2bwi owhRi/eU+e6OrfUiuL2KvlT9gPe2e84ZwDdTAgXGaJRJqaZ+3zYlII7zET63AuuacT OOLOQ5vkrHKQ+qCH5knAXbqMsy8ANjQm+QP7HRZ8bGYHHAu0TPQk7gdLxl8bsPX+d9 7Kl6R4WnMAEbXJE6xSR3P2eLOirCsBz8gUBHRq+0oN+5DNjocpnMFuTpR/zSs8yyuB 7hTz7g6pKLdX3dp9DEPrlcEIS7JV4OTc869bVmm5Jluoh6O0akYlKjOhE+gq9/w2Cn LDLPR+Yi6q1kg== Date: Mon, 9 Jan 2023 19:39:17 -0600 From: "Gustavo A. R. Silva" To: Neal Liu , Herbert Xu , "David S. Miller" , Joel Stanley , Andrew Jeffery Cc: linux-aspeed@lists.ozlabs.org, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] crypto: aspeed - Replace zero-length array with flexible-array member Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length array declaration in struct aspeed_sham_ctx with flex-array member. This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2]. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1] Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2] Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Gustavo A. R. Silva Reviewed-by: Neal Liu Reviewed-by: Kees Cook --- drivers/crypto/aspeed/aspeed-hace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/aspeed/aspeed-hace.h b/drivers/crypto/aspeed/aspeed-hace.h index f2cde23b56ae..05d0a15d546d 100644 --- a/drivers/crypto/aspeed/aspeed-hace.h +++ b/drivers/crypto/aspeed/aspeed-hace.h @@ -183,7 +183,7 @@ struct aspeed_sham_ctx { struct aspeed_hace_dev *hace_dev; unsigned long flags; /* hmac flag */ - struct aspeed_sha_hmac_ctx base[0]; + struct aspeed_sha_hmac_ctx base[]; }; struct aspeed_sham_reqctx {