]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
hv_netvsc: use kcalloc
authorStephen Hemminger <sthemmin@microsoft.com>
Tue, 23 Aug 2016 19:17:46 +0000 (12:17 -0700)
committerLuis Henriques <luis.henriques@canonical.com>
Fri, 20 Jan 2017 13:04:58 +0000 (13:04 +0000)
BugLink: http://bugs.launchpad.net/bugs/1650059
Better to use kcalloc rather than kzalloc and multiply for an array.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e53a9c2a5a8cd0a3a8b3c0f9b7a3ad9bc6a28867)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/net/hyperv/netvsc.c

index b15edfc37a59ace3cc4d563d13fc1b134f7b5a77..f64c9781b6cfd7cc468f1b156e96d5b9bdc3ba9a 100644 (file)
@@ -421,8 +421,8 @@ static int netvsc_init_buf(struct hv_device *device)
        net_device->map_words = DIV_ROUND_UP(net_device->send_section_cnt,
                                             BITS_PER_LONG);
 
-       net_device->send_section_map =
-               kzalloc(net_device->map_words * sizeof(ulong), GFP_KERNEL);
+       net_device->send_section_map = kcalloc(net_device->map_words,
+                                              sizeof(ulong), GFP_KERNEL);
        if (net_device->send_section_map == NULL) {
                ret = -ENOMEM;
                goto cleanup;