From: Josh Law Date: Wed, 18 Mar 2026 15:59:11 +0000 (+0000) Subject: lib/bootconfig: drop redundant memset of xbc_nodes X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=73a9f74b86c6b88d1b6aec82adea56074ef2a9b9;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Masami Hiramatsu (Google) --- diff --git a/lib/bootconfig.c b/lib/bootconfig.c index c02b11a1b5019..1b4900053abee 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)