Commit 32230ac1 authored by Markus Elfring's avatar Markus Elfring Committed by David S. Miller

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0ba8abb7
...@@ -998,8 +998,9 @@ static int start_tx(struct atm_dev *dev) ...@@ -998,8 +998,9 @@ static int start_tx(struct atm_dev *dev)
DPRINTK("start_tx\n"); DPRINTK("start_tx\n");
zatm_dev = ZATM_DEV(dev); zatm_dev = ZATM_DEV(dev);
zatm_dev->tx_map = kmalloc(sizeof(struct atm_vcc *)* zatm_dev->tx_map = kmalloc_array(zatm_dev->chans,
zatm_dev->chans,GFP_KERNEL); sizeof(*zatm_dev->tx_map),
GFP_KERNEL);
if (!zatm_dev->tx_map) return -ENOMEM; if (!zatm_dev->tx_map) return -ENOMEM;
zatm_dev->tx_bw = ATM_OC3_PCR; zatm_dev->tx_bw = ATM_OC3_PCR;
zatm_dev->free_shapers = (1 << NR_SHAPERS)-1; zatm_dev->free_shapers = (1 << NR_SHAPERS)-1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment