ACPICA: iASL: Replace zero-length array with flexible-array member
Subsystems (2)
PATCH 1/1 ACPICA: iASL: Replace zero-length array with flexible-array member
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays
--- include/acpi/actbl2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/actbl2.h +1 -1
@@ -2319,7 +2319,7 @@ struct acpi_table_rgrt {u16 version;u8 image_type;u8 reserved; -u8 image[0 ]; +u8 image[]; };/* image_type values */
Signature · 1 line
2.27.0
Quoted 11 lines · Gustavo A. R. Silva
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays
Signature · 1 line
Kees Cook
Rafael J. Wysocki
maintainerQuoted 8 lines · Kees Cook
Quoted 6 lines · Gustavo A. R. Silva
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
Quoted 7 lines
Quoted 5 lines
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arraysSigned-off-by Gustavo A. R. Silva <gustavoars(a)kernel.org>Reviewed-by Kees Cook <keescook(a)chromium.org>
I've created an upstream ACPICA pull request for this change, thanks!
Quoted 3 lines · Rafael J. Wysocki
On Wed, Feb 16, 2022 at 9:36 PM Kees Cook <[email protected]> wrote:
I've created an upstream ACPICA pull request for this change, thanks!
Great.
Thanks, Rafael.
--
Gustavo