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: 13094573 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3F8FEC5479D for ; Tue, 10 Jan 2023 01:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=l6d5d+pAvC4Nu7536UpgCwNuSSPz3SnsSBDHUR9Si8k=; b=eROX9ZFoIucR/x MUalrvpfkiWumAIp1WmxijdDX5acutCovCNx34dkFqCIQlPQDlYp0I8UgaAnIzHfbaWIXuRqdwilN LmzTdmWv7Py88WUMSxHJVeFLLDQl1suinP20Bq3Kuuz0Fa07pT1oD/CpVzbBIS6oimZDjSTih5Xun 5Vaf8nlDv2cqRHOwPXfJnCGMO1pr2tyl5GEPe2T5aji7oi1+6OMBy32xbIthcypVPCDqdBrCcLzwc JiUh8XTuPviSLxWGtNTBSHWsj7p5a9Waf1ekw2/cOQoW0OHb1/Sk90NUXe/aJKdB/zP0q/4CjMTEa ZqSMkvBpCzIcXAMulLIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pF3bf-004rZo-CJ; Tue, 10 Jan 2023 01:39:15 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pF3bc-004rZH-Fq for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2023 01:39:14 +0000 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 CA896614B1; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230109_173912_601604_0907E833 X-CRM114-Status: GOOD ( 12.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 {