Skip to content

Commit 4420528

Browse files
GustavoARSilvatakaswie
authored andcommitted
firewire: Replace zero-length array with flexible-array member
Zero-length and one-element arrays are deprecated, and we are moving towards adopting C99 flexible-array members, instead. Address the following warnings found with GCC-13 and -fstrict-flex-arrays=3 enabled: sound/firewire/amdtp-stream.c: In function ‘build_it_pkt_header’: sound/firewire/amdtp-stream.c:694:17: warning: ‘generate_cip_header’ accessing 8 bytes in a region of size 0 [-Wstringop-overflow=] 694 | generate_cip_header(s, cip_header, data_block_counter, syt); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sound/firewire/amdtp-stream.c:694:17: note: referencing argument 2 of type ‘__be32[2]’ {aka ‘unsigned int[2]’} sound/firewire/amdtp-stream.c:667:13: note: in a call to function ‘generate_cip_header’ 667 | static void generate_cip_header(struct amdtp_stream *s, __be32 cip_header[2], | ^~~~~~~~~~~~~~~~~~~ This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1]. Link: KSPP/linux#21 Link: KSPP/linux#303 Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] Signed-off-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/ZHT0V3SpvHyxCv5W@work Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent 7877cb9 commit 4420528

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/firewire.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ struct fw_iso_packet {
391391
u32 tag:2; /* tx: Tag in packet header */
392392
u32 sy:4; /* tx: Sy in packet header */
393393
u32 header_length:8; /* Length of immediate header */
394-
u32 header[0]; /* tx: Top of 1394 isoch. data_block */
394+
u32 header[]; /* tx: Top of 1394 isoch. data_block */
395395
};
396396

397397
#define FW_ISO_CONTEXT_TRANSMIT 0

0 commit comments

Comments
 (0)