nvmem: u-boot-env: replace zero-length array with flexible-array member
Subsystems (2)
PATCH 1/1 nvmem: u-boot-env: replace zero-length array with flexible-array member
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length array declaration in struct u_boot_env_image_broadcom with flex-array member.
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 [2].
--- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/u-boot-env.c +1 -1
@@ -45,7 +45,7 @@ struct u_boot_env_image_broadcom {__le32 magic;__le32 len;__le32 crc32; -uint8_t data[0 ]; +uint8_t data[]; } __packed; static int u_boot_env_read(void *context, unsigned int offset, void *val,
Signature · 1 line
2.34.1
Quoted 5 lines · Gustavo A. R. Silva
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length array declaration in struct
u_boot_env_image_broadcomwith flex-array member.
Quoted 8 lines
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2].
Signature · 1 line
Kees Cook
Rafał Miłecki
maintainerQuoted 8 lines · Gustavo A. R. Silva
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length array declaration in struct
u_boot_env_image_broadcomwith flex-array member.This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2].
I also handled this issue in my
[PATCH V2 4/6] nvmem: u-boot-env: convert to layout driver
https://lore.kernel.org/linux-arm-kernel/[email protected]/
Quoted 6 lines · Rafał Miłecki
Quoted 5 lines · Gustavo A. R. Silva
Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length array declaration in struct
u_boot_env_image_broadcomwith flex-array member.
Quoted 7 lines
Quoted 3 lines
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2].I also handled this issue in my
[PATCH V2 4/6] nvmem: u-boot-env: convert to layout driver
https://lore.kernel.org/linux-arm-kernel/[email protected]/
Ah-ha, thanks! Looks good. :)
Signature · 1 line
Kees Cook