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

kernel/auditfilter.c: replace count*size kmalloc by kcalloc

kcalloc manages count*sizeof overflow.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Fabian Frederick and committed by
Linus Torvalds
bab5e2d6 85417aef

+2 -2
+2 -2
kernel/auditfilter.c
··· 106 106 if (unlikely(!entry)) 107 107 return NULL; 108 108 109 - fields = kzalloc(sizeof(*fields) * field_count, GFP_KERNEL); 109 + fields = kcalloc(field_count, sizeof(*fields), GFP_KERNEL); 110 110 if (unlikely(!fields)) { 111 111 kfree(entry); 112 112 return NULL; ··· 160 160 161 161 int __init audit_register_class(int class, unsigned *list) 162 162 { 163 - __u32 *p = kzalloc(AUDIT_BITMASK_SIZE * sizeof(__u32), GFP_KERNEL); 163 + __u32 *p = kcalloc(AUDIT_BITMASK_SIZE, sizeof(__u32), GFP_KERNEL); 164 164 if (!p) 165 165 return -ENOMEM; 166 166 while (*list != ~0U) {