linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
@ 2022-09-26 23:18 Gustavo A. R. Silva
  2022-09-27  2:33 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2022-09-26 23:18 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, linux-kernel, Gustavo A. R. Silva, linux-hardening

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/227
Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 include/uapi/sound/asoc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h
index 053949287ce8..dd8ad790fc15 100644
--- a/include/uapi/sound/asoc.h
+++ b/include/uapi/sound/asoc.h
@@ -226,9 +226,9 @@ struct snd_soc_tplg_vendor_array {
 	__le32 type;	/* SND_SOC_TPLG_TUPLE_TYPE_ */
 	__le32 num_elems;	/* number of elements in array */
 	union {
-		struct snd_soc_tplg_vendor_uuid_elem uuid[0];
-		struct snd_soc_tplg_vendor_value_elem value[0];
-		struct snd_soc_tplg_vendor_string_elem string[0];
+		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_uuid_elem, uuid);
+		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_value_elem, value);
+		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_string_elem, string);
 	};
 } __attribute__((packed));
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2022-09-26 23:18 [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper Gustavo A. R. Silva
@ 2022-09-27  2:33 ` Kees Cook
  2022-09-27  7:37 ` Amadeusz Sławiński
  2023-02-02 20:34 ` Gustavo A. R. Silva
  2 siblings, 0 replies; 12+ messages in thread
From: Kees Cook @ 2022-09-27  2:33 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel, linux-hardening

On Mon, Sep 26, 2022 at 06:18:42PM -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/227
> Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Some day after the __element_count__ attribute exists, we might want to
consider a __type_select__ attribute to tie union members to a variable
outside the union (like the "type" member here).

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2022-09-26 23:18 [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper Gustavo A. R. Silva
  2022-09-27  2:33 ` Kees Cook
@ 2022-09-27  7:37 ` Amadeusz Sławiński
  2023-02-02 20:34 ` Gustavo A. R. Silva
  2 siblings, 0 replies; 12+ messages in thread
From: Amadeusz Sławiński @ 2022-09-27  7:37 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, linux-hardening, linux-kernel

On 9/27/2022 1:18 AM, 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/227
> Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>   include/uapi/sound/asoc.h | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h
> index 053949287ce8..dd8ad790fc15 100644
> --- a/include/uapi/sound/asoc.h
> +++ b/include/uapi/sound/asoc.h
> @@ -226,9 +226,9 @@ struct snd_soc_tplg_vendor_array {
>   	__le32 type;	/* SND_SOC_TPLG_TUPLE_TYPE_ */
>   	__le32 num_elems;	/* number of elements in array */
>   	union {
> -		struct snd_soc_tplg_vendor_uuid_elem uuid[0];
> -		struct snd_soc_tplg_vendor_value_elem value[0];
> -		struct snd_soc_tplg_vendor_string_elem string[0];
> +		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_uuid_elem, uuid);
> +		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_value_elem, value);
> +		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_string_elem, string);
>   	};
>   } __attribute__((packed));
>   

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2022-09-26 23:18 [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper Gustavo A. R. Silva
  2022-09-27  2:33 ` Kees Cook
  2022-09-27  7:37 ` Amadeusz Sławiński
@ 2023-02-02 20:34 ` Gustavo A. R. Silva
  2023-02-02 21:09   ` Mark Brown
  2 siblings, 1 reply; 12+ messages in thread
From: Gustavo A. R. Silva @ 2023-02-02 20:34 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Jaroslav Kysela, Takashi Iwai
  Cc: alsa-devel, linux-kernel, linux-hardening

Hi Takashi,

I wonder if this can go through your tree.

It's already been reviewed by a couple of people. :)

Thanks
--
Gustavo

On 9/26/22 18:18, 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/227
> Link: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>   include/uapi/sound/asoc.h | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h
> index 053949287ce8..dd8ad790fc15 100644
> --- a/include/uapi/sound/asoc.h
> +++ b/include/uapi/sound/asoc.h
> @@ -226,9 +226,9 @@ struct snd_soc_tplg_vendor_array {
>   	__le32 type;	/* SND_SOC_TPLG_TUPLE_TYPE_ */
>   	__le32 num_elems;	/* number of elements in array */
>   	union {
> -		struct snd_soc_tplg_vendor_uuid_elem uuid[0];
> -		struct snd_soc_tplg_vendor_value_elem value[0];
> -		struct snd_soc_tplg_vendor_string_elem string[0];
> +		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_uuid_elem, uuid);
> +		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_value_elem, value);
> +		__DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_string_elem, string);
>   	};
>   } __attribute__((packed));
>   

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2023-02-02 20:34 ` Gustavo A. R. Silva
@ 2023-02-02 21:09   ` Mark Brown
  2023-02-02 21:18     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Brown @ 2023-02-02 21:09 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Gustavo A. R. Silva, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linux-kernel, linux-hardening

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

On Thu, Feb 02, 2023 at 02:34:17PM -0600, Gustavo A. R. Silva wrote:
> Hi Takashi,
> 
> I wonder if this can go through your tree.
> 
> It's already been reviewed by a couple of people. :)

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2023-02-02 21:09   ` Mark Brown
@ 2023-02-02 21:18     ` Gustavo A. R. Silva
  2023-02-03 12:57       ` Mark Brown
  0 siblings, 1 reply; 12+ messages in thread
From: Gustavo A. R. Silva @ 2023-02-02 21:18 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gustavo A. R. Silva, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linux-kernel, linux-hardening



On 2/2/23 15:09, Mark Brown wrote:
> On Thu, Feb 02, 2023 at 02:34:17PM -0600, Gustavo A. R. Silva wrote:
>> Hi Takashi,
>>
>> I wonder if this can go through your tree.
>>
>> It's already been reviewed by a couple of people. :)
> 
> 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.

Yep; that's exactly what I did. :)

scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/uapi/sound/asoc.h
Jaroslav Kysela <perex@perex.cz> (maintainer:SOUND)
Takashi Iwai <tiwai@suse.com> (maintainer:SOUND)
alsa-devel@alsa-project.org (moderated list:SOUND)
linux-kernel@vger.kernel.org (open list)

If you're one the maintainers of that file, you're clearly not listed as such.

--
Gustavo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2023-02-02 21:18     ` Gustavo A. R. Silva
@ 2023-02-03 12:57       ` Mark Brown
  2023-02-03 13:27         ` Gustavo A. R. Silva
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Brown @ 2023-02-03 12:57 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Gustavo A. R. Silva, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linux-kernel, linux-hardening

[-- Attachment #1: Type: text/plain, Size: 1003 bytes --]

On Thu, Feb 02, 2023 at 03:18:47PM -0600, Gustavo A. R. Silva wrote:
> On 2/2/23 15:09, Mark Brown wrote:
> > On Thu, Feb 02, 2023 at 02:34:17PM -0600, 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.

> Yep; that's exactly what I did. :)

> scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/uapi/sound/asoc.h
> Jaroslav Kysela <perex@perex.cz> (maintainer:SOUND)
> Takashi Iwai <tiwai@suse.com> (maintainer:SOUND)
> alsa-devel@alsa-project.org (moderated list:SOUND)
> linux-kernel@vger.kernel.org (open list)

> If you're one the maintainers of that file, you're clearly not listed as such.

You did manage to figure out that it's an ASoC patch given the subject
line...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2023-02-03 12:57       ` Mark Brown
@ 2023-02-03 13:27         ` Gustavo A. R. Silva
  2023-02-03 13:45           ` Mark Brown
  0 siblings, 1 reply; 12+ messages in thread
From: Gustavo A. R. Silva @ 2023-02-03 13:27 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gustavo A. R. Silva, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linux-kernel, linux-hardening



On 2/3/23 06:57, Mark Brown wrote:
> On Thu, Feb 02, 2023 at 03:18:47PM -0600, Gustavo A. R. Silva wrote:
>> On 2/2/23 15:09, Mark Brown wrote:
>>> On Thu, Feb 02, 2023 at 02:34:17PM -0600, 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.
> 
>> Yep; that's exactly what I did. :)
> 
>> scripts/get_maintainer.pl --nokeywords --nogit --nogit-fallback include/uapi/sound/asoc.h
>> Jaroslav Kysela <perex@perex.cz> (maintainer:SOUND)
>> Takashi Iwai <tiwai@suse.com> (maintainer:SOUND)
>> alsa-devel@alsa-project.org (moderated list:SOUND)
>> linux-kernel@vger.kernel.org (open list)
> 
>> If you're one the maintainers of that file, you're clearly not listed as such.
> 
> You did manage to figure out that it's an ASoC patch given the subject
> line...

As with the list of maintainers, I use a tool to get that info:

git log --oneline include/uapi/sound/asoc.h

I think we have run into this same issue (you not being listed in the
MAINTAINERS file) at least once in the past, right? (thinkingface)

IMHO, the sensible solution for this is to keep the MAINTAINERS file
up-to-date. So, get_maintainer.pl can continue to be useful for people.

--
Gustavo


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2023-02-03 13:27         ` Gustavo A. R. Silva
@ 2023-02-03 13:45           ` Mark Brown
  2023-02-03 13:50             ` Gustavo A. R. Silva
  2023-02-03 16:29             ` Kees Cook
  0 siblings, 2 replies; 12+ messages in thread
From: Mark Brown @ 2023-02-03 13:45 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Gustavo A. R. Silva, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linux-kernel, linux-hardening

[-- Attachment #1: Type: text/plain, Size: 395 bytes --]

On Fri, Feb 03, 2023 at 07:27:03AM -0600, Gustavo A. R. Silva wrote:

> I think we have run into this same issue (you not being listed in the
> MAINTAINERS file) at least once in the past, right? (thinkingface)

> IMHO, the sensible solution for this is to keep the MAINTAINERS file
> up-to-date. So, get_maintainer.pl can continue to be useful for people.

Sure, feel free to send an update...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2023-02-03 13:45           ` Mark Brown
@ 2023-02-03 13:50             ` Gustavo A. R. Silva
  2023-02-03 16:29             ` Kees Cook
  1 sibling, 0 replies; 12+ messages in thread
From: Gustavo A. R. Silva @ 2023-02-03 13:50 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gustavo A. R. Silva, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linux-kernel, linux-hardening



On 2/3/23 07:45, Mark Brown wrote:
> On Fri, Feb 03, 2023 at 07:27:03AM -0600, Gustavo A. R. Silva wrote:
> 
>> I think we have run into this same issue (you not being listed in the
>> MAINTAINERS file) at least once in the past, right? (thinkingface)
> 
>> IMHO, the sensible solution for this is to keep the MAINTAINERS file
>> up-to-date. So, get_maintainer.pl can continue to be useful for people.
> 
> Sure, feel free to send an update...

[chuckles]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2023-02-03 13:45           ` Mark Brown
  2023-02-03 13:50             ` Gustavo A. R. Silva
@ 2023-02-03 16:29             ` Kees Cook
  2023-02-03 18:36               ` Mark Brown
  1 sibling, 1 reply; 12+ messages in thread
From: Kees Cook @ 2023-02-03 16:29 UTC (permalink / raw)
  To: Mark Brown
  Cc: Gustavo A. R. Silva, Gustavo A. R. Silva, Jaroslav Kysela,
	Takashi Iwai, alsa-devel, linux-kernel, linux-hardening

On Fri, Feb 03, 2023 at 01:45:02PM +0000, Mark Brown wrote:
> On Fri, Feb 03, 2023 at 07:27:03AM -0600, Gustavo A. R. Silva wrote:
> 
> > I think we have run into this same issue (you not being listed in the
> > MAINTAINERS file) at least once in the past, right? (thinkingface)
> 
> > IMHO, the sensible solution for this is to keep the MAINTAINERS file
> > up-to-date. So, get_maintainer.pl can continue to be useful for people.
> 
> Sure, feel free to send an update...

Is this accurate?


diff --git a/MAINTAINERS b/MAINTAINERS
index 7f86d02cb427..e21a3412a546 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19564,6 +19564,8 @@ F:	Documentation/devicetree/bindings/sound/
 F:	Documentation/sound/soc/
 F:	include/dt-bindings/sound/
 F:	include/sound/soc*
+F:	include/sound/sof/
+F:	include/uapi/sound/asoc.h
 F:	sound/soc/
 
 SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS


-- 
Kees Cook

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper
  2023-02-03 16:29             ` Kees Cook
@ 2023-02-03 18:36               ` Mark Brown
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2023-02-03 18:36 UTC (permalink / raw)
  To: Kees Cook
  Cc: Gustavo A. R. Silva, Gustavo A. R. Silva, Jaroslav Kysela,
	Takashi Iwai, alsa-devel, linux-kernel, linux-hardening

[-- Attachment #1: Type: text/plain, Size: 683 bytes --]

On Fri, Feb 03, 2023 at 04:29:41PM +0000, Kees Cook wrote:
> On Fri, Feb 03, 2023 at 01:45:02PM +0000, Mark Brown wrote:

> > Sure, feel free to send an update...

> Is this accurate?

> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7f86d02cb427..e21a3412a546 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -19564,6 +19564,8 @@ F:	Documentation/devicetree/bindings/sound/
>  F:	Documentation/sound/soc/
>  F:	include/dt-bindings/sound/
>  F:	include/sound/soc*
> +F:	include/sound/sof/
> +F:	include/uapi/sound/asoc.h
>  F:	sound/soc/

Might be missing stuff but those are both good additions.  Looks like
the SOF directory also wants adding to the SOF section in MAINTAINERS.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-02-03 18:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 23:18 [PATCH][next] ASoC: uapi: Replace zero-length arrays with __DECLARE_FLEX_ARRAY() helper Gustavo A. R. Silva
2022-09-27  2:33 ` Kees Cook
2022-09-27  7:37 ` Amadeusz Sławiński
2023-02-02 20:34 ` Gustavo A. R. Silva
2023-02-02 21:09   ` Mark Brown
2023-02-02 21:18     ` Gustavo A. R. Silva
2023-02-03 12:57       ` Mark Brown
2023-02-03 13:27         ` Gustavo A. R. Silva
2023-02-03 13:45           ` Mark Brown
2023-02-03 13:50             ` Gustavo A. R. Silva
2023-02-03 16:29             ` Kees Cook
2023-02-03 18:36               ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).