Commit 8f649b5
IB/hfi1: Replace 1-element array with singleton
Zero-length arrays are deprecated[1] and are being replaced with flexible
array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing
with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3.
Replace zero-length array with flexible-array member "lvs" in struct
opa_port_data_counters_msg and struct opa_port_error_counters64_msg.
Additionally, the "port" member of several structs is defined as a
single-element, but is only ever accessed at index 0. Replace it with a
singleton so that flexible array usage is sane.
This results in no differences in binary output.
[1] KSPP/linux#78
Link: https://lore.kernel.org/r/20221118215847.never.416-kees@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>1 parent 34a046f commit 8f649b5
1 file changed
+11
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2437 | 2437 | | |
2438 | 2438 | | |
2439 | 2439 | | |
2440 | | - | |
| 2440 | + | |
2441 | 2441 | | |
2442 | | - | |
| 2442 | + | |
2443 | 2443 | | |
2444 | 2444 | | |
2445 | 2445 | | |
| |||
2470 | 2470 | | |
2471 | 2471 | | |
2472 | 2472 | | |
2473 | | - | |
| 2473 | + | |
2474 | 2474 | | |
2475 | | - | |
| 2475 | + | |
2476 | 2476 | | |
2477 | 2477 | | |
2478 | 2478 | | |
| |||
2543 | 2543 | | |
2544 | 2544 | | |
2545 | 2545 | | |
2546 | | - | |
| 2546 | + | |
2547 | 2547 | | |
2548 | 2548 | | |
2549 | 2549 | | |
| |||
2966 | 2966 | | |
2967 | 2967 | | |
2968 | 2968 | | |
2969 | | - | |
| 2969 | + | |
2970 | 2970 | | |
2971 | 2971 | | |
2972 | 2972 | | |
| |||
2986 | 2986 | | |
2987 | 2987 | | |
2988 | 2988 | | |
2989 | | - | |
| 2989 | + | |
2990 | 2990 | | |
2991 | 2991 | | |
2992 | 2992 | | |
| |||
3182 | 3182 | | |
3183 | 3183 | | |
3184 | 3184 | | |
3185 | | - | |
| 3185 | + | |
3186 | 3186 | | |
3187 | 3187 | | |
3188 | 3188 | | |
| |||
3201 | 3201 | | |
3202 | 3202 | | |
3203 | 3203 | | |
3204 | | - | |
| 3204 | + | |
3205 | 3205 | | |
3206 | 3206 | | |
3207 | 3207 | | |
| |||
3340 | 3340 | | |
3341 | 3341 | | |
3342 | 3342 | | |
3343 | | - | |
| 3343 | + | |
3344 | 3344 | | |
3345 | 3345 | | |
3346 | 3346 | | |
| |||
3590 | 3590 | | |
3591 | 3591 | | |
3592 | 3592 | | |
3593 | | - | |
| 3593 | + | |
3594 | 3594 | | |
3595 | 3595 | | |
3596 | 3596 | | |
| |||
0 commit comments