diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-09-10 09:55:53 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-10 21:46:06 -0700 |
commit | 32230ac1ccbd66f36bd6955eddc45fc06861c1b5 (patch) | |
tree | 6213a5c4813317eefe271c95cd0f25b7dbddb842 /drivers/atm | |
parent | 0ba8abb770a8771ffb05cce2a5a7441530f06a55 (diff) | |
download | op-kernel-dev-32230ac1ccbd66f36bd6955eddc45fc06861c1b5.zip op-kernel-dev-32230ac1ccbd66f36bd6955eddc45fc06861c1b5.tar.gz |
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>
Diffstat (limited to 'drivers/atm')
-rw-r--r-- | drivers/atm/zatm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c index cecfb94..d378ff2 100644 --- a/drivers/atm/zatm.c +++ b/drivers/atm/zatm.c @@ -998,8 +998,9 @@ static int start_tx(struct atm_dev *dev) DPRINTK("start_tx\n"); zatm_dev = ZATM_DEV(dev); - zatm_dev->tx_map = kmalloc(sizeof(struct atm_vcc *)* - zatm_dev->chans,GFP_KERNEL); + zatm_dev->tx_map = kmalloc_array(zatm_dev->chans, + sizeof(*zatm_dev->tx_map), + GFP_KERNEL); if (!zatm_dev->tx_map) return -ENOMEM; zatm_dev->tx_bw = ATM_OC3_PCR; zatm_dev->free_shapers = (1 << NR_SHAPERS)-1; |