From patchwork Mon Sep 26 21:40:55 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: 12989435 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 070C5C07E9D for ; Mon, 26 Sep 2022 21:41:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229829AbiIZVlG (ORCPT ); Mon, 26 Sep 2022 17:41:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbiIZVlE (ORCPT ); Mon, 26 Sep 2022 17:41:04 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F123257557; Mon, 26 Sep 2022 14:41:03 -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 sin.source.kernel.org (Postfix) with ESMTPS id 5A973CE13C2; Mon, 26 Sep 2022 21:41:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48BDCC433D6; Mon, 26 Sep 2022 21:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664228460; bh=nJA1vq18hGF5czX+YZ/5cu1/Q/04JTv3WsfWyuNLU98=; h=Date:From:To:Cc:Subject:From; b=LdO+D7fr3NTekOZ9TO67LzdnRndI0bSiPuk/vaSCbQnh5IexuusEDs2JQSzOQX/+h IhZ/2ymVHFA+S68q8XKpPhonAyPaKWHq7ufKKqioe9KIYMYHySV3B/v9jMfAOwBmp6 Y95W2p68e7AzJBWJGNR4xZvU2FJ2UZZambRQ0pz101mm3piun/eEQGp/0AG6VahTll Y1dlozoUohWuLcC4s10H291NHlbNt+IyM1HgtlN6Mkv78emhcQCemBMXXbisPGW2pb qtmwVVJo9KRCKnyk7FpCgNt5bwYuZjPqfPw3gM6Il2YWx/hBp3Cf8dKQsg5RAUS89Q E5sMUgfSVkd3w== Date: Mon, 26 Sep 2022 16:40:55 -0500 From: "Gustavo A. R. Silva" To: Jaroslav Kysela , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-hardening@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/211 Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html Signed-off-by: Gustavo A. R. Silva Reviewed-by: Kees Cook --- include/sound/sof/control.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/sound/sof/control.h b/include/sound/sof/control.h index 7379a33d7247..983d374fe511 100644 --- a/include/sound/sof/control.h +++ b/include/sound/sof/control.h @@ -117,11 +117,11 @@ struct sof_ipc_ctrl_data { /* control data - add new types if needed */ union { /* channel values can be used by volume type controls */ - struct sof_ipc_ctrl_value_chan chanv[0]; + DECLARE_FLEX_ARRAY(struct sof_ipc_ctrl_value_chan, chanv); /* component values used by routing controls like mux, mixer */ - struct sof_ipc_ctrl_value_comp compv[0]; + DECLARE_FLEX_ARRAY(struct sof_ipc_ctrl_value_comp, compv); /* data can be used by binary controls */ - struct sof_abi_hdr data[0]; + DECLARE_FLEX_ARRAY(struct sof_abi_hdr, data); }; } __packed;