Commit bab5e2d6 authored by Fabian Frederick's avatar Fabian Frederick Committed by Linus Torvalds

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

kcalloc manages count*sizeof overflow.
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 85417aef
...@@ -106,7 +106,7 @@ static inline struct audit_entry *audit_init_entry(u32 field_count) ...@@ -106,7 +106,7 @@ static inline struct audit_entry *audit_init_entry(u32 field_count)
if (unlikely(!entry)) if (unlikely(!entry))
return NULL; return NULL;
fields = kzalloc(sizeof(*fields) * field_count, GFP_KERNEL); fields = kcalloc(field_count, sizeof(*fields), GFP_KERNEL);
if (unlikely(!fields)) { if (unlikely(!fields)) {
kfree(entry); kfree(entry);
return NULL; return NULL;
...@@ -160,7 +160,7 @@ static __u32 *classes[AUDIT_SYSCALL_CLASSES]; ...@@ -160,7 +160,7 @@ static __u32 *classes[AUDIT_SYSCALL_CLASSES];
int __init audit_register_class(int class, unsigned *list) int __init audit_register_class(int class, unsigned *list)
{ {
__u32 *p = kzalloc(AUDIT_BITMASK_SIZE * sizeof(__u32), GFP_KERNEL); __u32 *p = kcalloc(AUDIT_BITMASK_SIZE, sizeof(__u32), GFP_KERNEL);
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
while (*list != ~0U) { while (*list != ~0U) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment