mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 09:41:54 +09:00
netfilter: ipset: Use kmalloc() in comment extension helper
Allocate memory with kmalloc() rather than kzalloc(): the string is immediately initialized so it is unnecessary to zero out the allocated memory area. Ported from a patch proposed by Sergey Popovich <popovich_sergei@mail.ua>. Suggested-by: Sergey Popovich <popovich_sergei@mail.ua> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
This commit is contained in:
@@ -34,7 +34,7 @@ ip_set_init_comment(struct ip_set_comment *comment,
|
||||
return;
|
||||
if (unlikely(len > IPSET_MAX_COMMENT_SIZE))
|
||||
len = IPSET_MAX_COMMENT_SIZE;
|
||||
c = kzalloc(sizeof(*c) + len + 1, GFP_ATOMIC);
|
||||
c = kmalloc(sizeof(*c) + len + 1, GFP_ATOMIC);
|
||||
if (unlikely(!c))
|
||||
return;
|
||||
strlcpy(c->str, ext->comment, len + 1);
|
||||
|
||||
Reference in New Issue
Block a user