2022-09-26 21:46:41

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

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 <[email protected]>
---
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;

--
2.34.1


2022-09-26 22:49:28

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper



On 9/26/22 17:12, Mark Brown wrote:
> On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:
>> 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.
>
> As documented in submitting-patches.rst please send patches to the
> maintainers for the code you would like to change. The normal kernel
> workflow is that people apply patches from their inboxes, if they aren't
> copied they are likely to not see the patch at all and it is much more
> difficult to apply patches.

That's exactly what I intended to do:

$ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/sound/sof/control.h

Jaroslav Kysela <[email protected]> (maintainer:SOUND)

Takashi Iwai <[email protected]> (maintainer:SOUND)

[email protected] (moderated list:SOUND)

[email protected] (open list)

Did you see anything wrong with this or something...?

Thanks
--
Gustavo

2022-09-26 23:05:03

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:
> 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.

As documented in submitting-patches.rst please send patches to the
maintainers for the code you would like to change. The normal kernel
workflow is that people apply patches from their inboxes, if they aren't
copied they are likely to not see the patch at all and it is much more
difficult to apply patches.


Attachments:
(No filename) (680.00 B)
signature.asc (499.00 B)
Download all attachments

2022-09-26 23:33:11

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

On Mon, Sep 26, 2022 at 05:27:41PM -0500, Gustavo A. R. Silva wrote:
> On 9/26/22 17:12, Mark Brown wrote:
> > On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:

> > As documented in submitting-patches.rst please send patches to the
> > maintainers for the code you would like to change. The normal kernel
> > workflow is that people apply patches from their inboxes, if they aren't
> > copied they are likely to not see the patch at all and it is much more
> > difficult to apply patches.

> That's exactly what I intended to do:

> $ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/sound/sof/control.h
>
> Jaroslav Kysela <[email protected]> (maintainer:SOUND)
>
> Takashi Iwai <[email protected]> (maintainer:SOUND)
>
> [email protected] (moderated list:SOUND)
>
> [email protected] (open list)
>
> Did you see anything wrong with this or something...?

Yes, you should've also included me and the SOF maintainers. It looks
like the MAINTAINERS patterns aren't entirely up to date there
unfortunately. Though that said given that you'd picked up on the
subject line I'd have expected the signoffs on the commits to also be
pointing at the right tree as well.


Attachments:
(No filename) (1.23 kB)
signature.asc (499.00 B)
Download all attachments

2022-09-26 23:36:24

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:
> 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 <[email protected]>

Reviewed-by: Kees Cook <[email protected]>

--
Kees Cook

2022-09-27 04:01:21

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

On Mon, Sep 26, 2022 at 11:39:50PM +0100, Mark Brown wrote:
> On Mon, Sep 26, 2022 at 05:27:41PM -0500, Gustavo A. R. Silva wrote:
> > On 9/26/22 17:12, Mark Brown wrote:
> > > On Mon, Sep 26, 2022 at 04:40:55PM -0500, Gustavo A. R. Silva wrote:
>
> > > As documented in submitting-patches.rst please send patches to the
> > > maintainers for the code you would like to change. The normal kernel
> > > workflow is that people apply patches from their inboxes, if they aren't
> > > copied they are likely to not see the patch at all and it is much more
> > > difficult to apply patches.
>
> > That's exactly what I intended to do:
> >
> > $ scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/sound/sof/control.h
> > Jaroslav Kysela <[email protected]> (maintainer:SOUND)
> > Takashi Iwai <[email protected]> (maintainer:SOUND)
> > [email protected] (moderated list:SOUND)
> > [email protected] (open list)
> >
> > Did you see anything wrong with this or something...?
>
> Yes, you should've also included me and the SOF maintainers. It looks
> like the MAINTAINERS patterns aren't entirely up to date there
> unfortunately. Though that said given that you'd picked up on the
> subject line I'd have expected the signoffs on the commits to also be
> pointing at the right tree as well.

Subject line heuristics look at X-many commits, but it looks like
get_maintainers stops looking at git history by default after 1 year,
which seems kind of odd. I had to work at it to get it to emit your
name. :)

scripts/get_maintainer.pl --git --git-since=3-years-ago

Seems like it's worth getting the MAINTAINERS regex updated? Is this
right?

diff --git a/MAINTAINERS b/MAINTAINERS
index a34ec41fbf7a..2560dded0e3e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19261,6 +19261,7 @@ F: Documentation/devicetree/bindings/sound/
F: Documentation/sound/soc/
F: include/dt-bindings/sound/
F: include/sound/soc*
+F: include/sound/sof/
F: sound/soc/

SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS
@@ -19275,6 +19276,7 @@ L: [email protected] (moderated for non-subscribers)
S: Supported
W: https://github.com/thesofproject/linux/
F: sound/soc/sof/
+F: include/sound/sof/

SOUNDWIRE SUBSYSTEM
M: Vinod Koul <[email protected]>

--
Kees Cook

2022-09-27 11:22:09

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

On Mon, Sep 26, 2022 at 08:16:16PM -0700, Kees Cook wrote:

> Seems like it's worth getting the MAINTAINERS regex updated? Is this
> right?

Yes, looks about right.


Attachments:
(No filename) (171.00 B)
signature.asc (499.00 B)
Download all attachments

2022-09-27 14:17:48

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH][next] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper

On Mon, 26 Sep 2022 16:40:55 -0500, Gustavo A. R. Silva wrote:
> 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.
>
> [...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: control.h: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
commit: b264ef796959cb65cdbc811da5ab950e33df4162

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark