diff options
| author | Josh Law <objecting@objecting.org> | 2026-03-18 18:59:11 +0300 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-03-19 02:43:43 +0300 |
| commit | 73a9f74b86c6b88d1b6aec82adea56074ef2a9b9 (patch) | |
| tree | eae98e0814bf0296af2b3ba72e7a61ed9711deac | |
| parent | ae9bf4d3835fb1cd3f79ea74e96e6ab6cfe8f415 (diff) | |
| download | linux-73a9f74b86c6b88d1b6aec82adea56074ef2a9b9.tar.xz | |
lib/bootconfig: drop redundant memset of xbc_nodes
memblock_alloc() already returns zeroed memory, so the explicit memset
in xbc_init() is redundant. Switch the userspace xbc_alloc_mem() from
malloc() to calloc() so both paths return zeroed memory, and remove
the separate memset call.
Link: https://lore.kernel.org/all/20260318155919.78168-6-objecting@objecting.org/
Signed-off-by: Josh Law <objecting@objecting.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
| -rw-r--r-- | lib/bootconfig.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/bootconfig.c b/lib/bootconfig.c index c02b11a1b501..1b4900053abe 100644 --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -71,7 +71,7 @@ static inline void __init xbc_free_mem(void *addr, size_t size, bool early) static inline void *xbc_alloc_mem(size_t size) { - return malloc(size); + return calloc(1, size); } static inline void xbc_free_mem(void *addr, size_t size, bool early) @@ -983,7 +983,6 @@ int __init xbc_init(const char *data, size_t size, const char **emsg, int *epos) _xbc_exit(true); return -ENOMEM; } - memset(xbc_nodes, 0, sizeof(struct xbc_node) * XBC_NODE_MAX); ret = xbc_parse_tree(); if (!ret) |
