-
Couldn't load subscription status.
- Fork 8.1k
Labels
StalebugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugplatform: Microchip MECMicrochip MEC PlatformMicrochip MEC Platformpriority: lowLow impact/importance bugLow impact/importance bug
Description
(Report of a static analyzer, may be incorrect)
struct girq_regs has a trailing array field of length one
zephyr/soc/microchip/mec/mec172x/reg/mec172x_ecia.h
Lines 1129 to 1136 in e416496
| /** @brief GIRQ registers. Total size = 20(0x14) bytes */ | |
| struct girq_regs { | |
| volatile uint32_t SRC; | |
| volatile uint32_t EN_SET; | |
| volatile uint32_t RESULT; | |
| volatile uint32_t EN_CLR; | |
| uint32_t RSVD1[1]; | |
| }; |
which seems to be a flexible array, and used in the middle of other structs and arrays (struct
ecia_named_regs and struct ecia_regs below this). As mentioned in the comments above its definition, it seems not intended to be a flexible array. And the array field RSVD1 is not used as an array (according to the grep results).
If it is intended to be a flexible array struct, it is suggested to use the unsized declaration.
If it is actually an unused placeholder or not a flexible array struct, it would be better to declare field RSVD1 as a normal field (as suggested in https://people.kernel.org/kees/bounded-flexible-arrays-in-c).
report ids: 250106-1641:7-25
Metadata
Metadata
Assignees
Labels
StalebugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugplatform: Microchip MECMicrochip MEC PlatformMicrochip MEC Platformpriority: lowLow impact/importance bugLow impact/importance bug