devm_kzalloc() zeroes the memory Fix the allocation size of kvmalloc_array() Add devm_kcalloc() and kvzalloc() Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> --- smatch_allocations.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/smatch_allocations.c b/smatch_allocations.c index 8c7bdb2077d9..ae6182178405 100644 --- a/smatch_allocations.c +++ b/smatch_allocations.c @@ -44,8 +44,9 @@ static struct alloc_fn_info kernel_alloc_funcs[] = { {"__alloc_skb", "$0"}, {"devm_kmalloc", "$1"}, - {"devm_kzalloc", "$1"}, + {"devm_kzalloc", "$1", .zeroed=true}, {"devm_kmalloc_array", "$1 * $2"}, + {"devm_kcalloc", "$1 * $2", .zeroed=true}, {"dma_alloc_attrs", "$1"}, {"dma_alloc_coherent", "$1"}, @@ -67,7 +68,8 @@ static struct alloc_fn_info kernel_alloc_funcs[] = { {"vzalloc", "$0", .zeroed=true}, {"kvmalloc", "$0"}, - {"kvmalloc_array", "$0"}, + {"kvmalloc_array", "$0 * $1"}, + {"kvzalloc", "$0", .zeroed=true}, {"kvcalloc", "$0 * $1", .zeroed=true}, {"kmemdup", "$1"}, -- 2.34.1