diff options
| author | Huang Borong <[email protected]> | 2025-01-03 10:38:28 +0800 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2025-02-11 16:58:24 +0530 |
| commit | a76aca030d1b2026d9b1b8867d59bb57bd47241a (patch) | |
| tree | 9f06a825198c1d0e7f296f92554dcc5d41fc12e1 | |
| parent | 555055d14534e436073c818e04f4a5f0d3c141dc (diff) | |
lib: utils/fdt: update fdt_parse_aplic_node()
1. Initialize struct imsic_data imsic to 0 at definition to prevent the
use of uninitialized memory, ensuring the variable starts with known
values.
2. Remove the redundant memset call on the "aplic" parameter since the
memory for aplic is allocated using sbi_zalloc() by the caller
irqchip_aplic_cold_init(), which guarantees it is already set to 0.
Signed-off-by: Huang Borong <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
| -rw-r--r-- | lib/utils/fdt/fdt_helper.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c index cb350e5a..e92484cd 100644 --- a/lib/utils/fdt/fdt_helper.c +++ b/lib/utils/fdt/fdt_helper.c @@ -630,14 +630,13 @@ int fdt_parse_aplic_node(const void *fdt, int nodeoff, struct aplic_data *aplic) bool child_found; const fdt32_t *val; const fdt32_t *del; - struct imsic_data imsic; + struct imsic_data imsic = { 0 }; int i, j, d, dcnt, len, noff, rc; uint64_t reg_addr, reg_size; struct aplic_delegate_data *deleg; if (nodeoff < 0 || !aplic || !fdt) return SBI_ENODEV; - memset(aplic, 0, sizeof(*aplic)); rc = fdt_get_node_addr_size(fdt, nodeoff, 0, ®_addr, ®_size); if (rc < 0 || !reg_addr || !reg_size) |
