[alsa-devel] [PATCH 4/6] usb: audio: Fix variable length field to be variable.

Clemens Ladisch clemens at ladisch.de
Wed Nov 29 12:33:00 CET 2017


Jorge Sanjuan wrote:
> Make bmaControls be a pointer insted of a fixed size array so it
> can have a variable length.

>  	/* bmaControls is actually u32,
>  	 * but u8 is needed for the hybrid parser */
> -	__u8 bmaControls[0]; /* variable length */
> +	__u8 bmaControls[]; /* variable length */
>  	/* wFeatureDescrStr omitted */
>  } __attribute__((packed));

This is not a pointer but a flexible array member.
And in theory, it does not change anything:
https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html


Regards,
Clemens


More information about the Alsa-devel mailing list