aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2016-09-10 03:55:53 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-11 00:46:06 -0400
commit32230ac1ccbd66f36bd6955eddc45fc06861c1b5 (patch)
tree6213a5c4813317eefe271c95cd0f25b7dbddb842
parent0ba8abb770a8771ffb05cce2a5a7441530f06a55 (diff)
ATM-ZeitNet: Use kmalloc_array() in start_tx()
* 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. * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/atm/zatm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index cecfb943762f..d378ff2d3925 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -998,8 +998,9 @@ static int start_tx(struct atm_dev *dev)
998 998
999 DPRINTK("start_tx\n"); 999 DPRINTK("start_tx\n");
1000 zatm_dev = ZATM_DEV(dev); 1000 zatm_dev = ZATM_DEV(dev);
1001 zatm_dev->tx_map = kmalloc(sizeof(struct atm_vcc *)* 1001 zatm_dev->tx_map = kmalloc_array(zatm_dev->chans,
1002 zatm_dev->chans,GFP_KERNEL); 1002 sizeof(*zatm_dev->tx_map),
1003 GFP_KERNEL);
1003 if (!zatm_dev->tx_map) return -ENOMEM; 1004 if (!zatm_dev->tx_map) return -ENOMEM;
1004 zatm_dev->tx_bw = ATM_OC3_PCR; 1005 zatm_dev->tx_bw = ATM_OC3_PCR;
1005 zatm_dev->free_shapers = (1 << NR_SHAPERS)-1; 1006 zatm_dev->free_shapers = (1 << NR_SHAPERS)-1;