From patchwork Mon Sep 26 21:46:24 2022 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: 12989455 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 467B9C6FA8E for ; Mon, 26 Sep 2022 21:46:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbiIZVqd (ORCPT ); Mon, 26 Sep 2022 17:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbiIZVqc (ORCPT ); Mon, 26 Sep 2022 17:46:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE2F09AFCA; Mon, 26 Sep 2022 14:46:31 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id B372DB811FC; Mon, 26 Sep 2022 21:46:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EF63C433D6; Mon, 26 Sep 2022 21:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664228789; bh=2+SloBY+jDAlwq01BM/YlVe4LL61s2uwBV+FOoix9Hg=; h=Date:From:To:Cc:Subject:From; b=IUyQJKZKMNvQMVDa5pwPltIpqA9vuoitPz668khCwUFllBwBepH54hwNV+BS+W1E6 oWThT0EdHf3ZkFsgGTyrL1V0/eZ15rXQtHVow6MsfzOnPgHAQ0jMmQ4As5u45YL6NJ kCpjaTtOeAqcbkKeSSP1rGibGnmkDGF4m9BS5RPZGurEp4fmfyo1z34DrqTUMIf97h HKzTHK9oxxhOqwy36kmkJQdscWjdgpdjxit7pU/6Whp5hjZJgmSDwHhkdAn9jlJ/kM hYoMNoySNjzdU8CKZYO5smb2IfwBCjJtFa1dPvRIjGVRdJbROWw4c1pJBk5ZdeQLYs JizPRgkQg2Ggw== Date: Mon, 26 Sep 2022 16:46:24 -0500 From: "Gustavo A. R. Silva" To: Vinod Koul Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] dmaengine: sh: rcar-dmac: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro. This helper allows for flexible-array members in unions. Link: https://github.com/KSPP/linux/issues/193 Link: https://github.com/KSPP/linux/issues/217 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- drivers/dma/sh/rcar-dmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 13d12d660cc2..641d689d17ff 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -103,8 +103,8 @@ struct rcar_dmac_desc_page { struct list_head node; union { - struct rcar_dmac_desc descs[0]; - struct rcar_dmac_xfer_chunk chunks[0]; + DECLARE_FLEX_ARRAY(struct rcar_dmac_desc, descs); + DECLARE_FLEX_ARRAY(struct rcar_dmac_xfer_chunk, chunks); }; };