diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2021-05-06 18:04:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-05-06 19:24:13 -0700 |
commit | c1e4726f4654407bfd509bb8fc7324b96f2f9285 (patch) | |
tree | cb38de9520426363e093c36b68511784fc66cf9b /lib/xz/xz_private.h | |
parent | 312f79c486e9860ec4c2ec4ef5b89fd518d9c833 (diff) | |
download | linux-stable-c1e4726f4654407bfd509bb8fc7324b96f2f9285.tar.gz linux-stable-c1e4726f4654407bfd509bb8fc7324b96f2f9285.tar.bz2 linux-stable-c1e4726f4654407bfd509bb8fc7324b96f2f9285.zip |
hpfs: replace one-element 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].
Also, this helps with the ongoing efforts to enable -Warray-bounds by
fixing the following warning:
CC [M] fs/hpfs/dir.o
fs/hpfs/dir.c: In function `hpfs_readdir':
fs/hpfs/dir.c:163:41: warning: array subscript 1 is above array bounds of `u8[1]' {aka `unsigned char[1]'} [-Warray-bounds]
163 | || de ->name[0] != 1 || de->name[1] != 1))
| ~~~~~~~~^~~
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-and-one-element-arrays
Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/109
Link: https://lkml.kernel.org/r/20210326173510.GA81212@embeddedor
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Cc: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/xz/xz_private.h')
0 files changed, 0 insertions, 0 deletions