netfilter: ipset: Use kmalloc() in comment extension helper
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Wed, 6 May 2015 05:27:28 +0000 (07:27 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 10 Nov 2016 12:28:43 +0000 (13:28 +0100)
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>
include/linux/netfilter/ipset/ip_set_comment.h

index bae5c7609be2641453c2340ea0b54b05ec87b801..5444b1bbe656ae6595c0fb81bb25cb02fd732bb9 100644 (file)
@@ -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);