Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Josh Law and committed by
Masami Hiramatsu (Google)
73a9f74b ae9bf4d3

+1 -2
+1 -2
lib/bootconfig.c
··· 71 71 72 72 static inline void *xbc_alloc_mem(size_t size) 73 73 { 74 - return malloc(size); 74 + return calloc(1, size); 75 75 } 76 76 77 77 static inline void xbc_free_mem(void *addr, size_t size, bool early) ··· 983 983 _xbc_exit(true); 984 984 return -ENOMEM; 985 985 } 986 - memset(xbc_nodes, 0, sizeof(struct xbc_node) * XBC_NODE_MAX); 987 986 988 987 ret = xbc_parse_tree(); 989 988 if (!ret)