HomeFreeBSD

Cleanup: Use C99 flexible array members instead of zero length arrays

Description

Cleanup: Use C99 flexible array members instead of zero length arrays

The Linux 5.16.14 kernel's coccicheck caught this. The semantic
patch that caught it was:

./scripts/coccinelle/misc/flexible_array.cocci

The Linux kernel's documentation makes a good case for why we should not
use these:

https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14372

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Jan 10 2023, 8:14 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jan 12 2023, 11:59 PM
Parents
rGc9c3ce79765d: Cleanup: Use kmem_zalloc() instead of memset() to zero memory
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG8e7ebf4e2d1a: Cleanup: Use C99 flexible array members instead of zero length arrays (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Jan 12 2023, 11:59 PM