[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ca646e0a-9f04-149e-999a-df828b363861@users.sourceforge.net>
Date: Thu, 26 Jan 2017 20:00:08 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Francesco Ruggeri <fruggeri@...sta.com>,
Gao Feng <fgao@...ai8.com>, Jason Wang <jasowang@...hat.com>,
Marc Angel <marc@...sta.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>,
Willem de Bruijn <willemb@...gle.com>,
Zhang Shengju <zhangshengju@...s.chinamobile.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH] macvtap: Use kmalloc_array() in macvtap_queue_resize()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 26 Jan 2017 19:47:38 +0100
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/net/macvtap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 5c26653eceb5..1796d8f1ef47 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -1243,7 +1243,7 @@ static int macvtap_queue_resize(struct macvlan_dev *vlan)
int n = vlan->numqueues;
int ret, i = 0;
- arrays = kmalloc(sizeof *arrays * n, GFP_KERNEL);
+ arrays = kmalloc_array(n, sizeof(*arrays), GFP_KERNEL);
if (!arrays)
return -ENOMEM;
--
2.11.0
Powered by blists - more mailing lists