Linux Lands And Then Reverts Usage Of Flexible Array Members

Written by Michael Larabel in Linux Kernel on 16 June 2020 at 02:37 AM EDT. 4 Comments
As a change past the Linux 5.8 merge window now that the flurry of code activity has settled down was changing the use of zero-length arrays in structs with flexible array members. Linus Torvalds did pull the change into Linux 5.8 but then decided shortly afterwards to drop the change at least for the time being.

The pull request replaced all the existing zero-length array usage within the kernel with C99 flexible array members for dynamically-sized trailing elements in a C structure. Using flexible array members is intended to provide proper sizeof() calculations, the ability for the code compiler to generate errors when improperly used, and avoid potential undefined behavior scenarios.

The flexible array member syntax has been standardized since C99 and the patches shifting away from zero-length arrays have been baking in linux-next for a while. The pull request lays out all of the details.

Linus Torvalds on Monday pulled in the changes only to have regrets and backed them out of the current mainline tree. Torvalds explained he was unhappy about the repetitive boiler-plate messages in all of the patches that amounted to around 2,000 lines of the same messages, thereby mucking up the Git log display, etc. So for now at least until the patches are reworked, the code is no longer in Linux 5.8.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week