Skip to content

Commit 1b30dd3

Browse files
ralfbaechledavem330
authored andcommitted
[AX.25]: Use kzalloc
Replace kzalloc instead of kmalloc + memset. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2478173 commit 1b30dd3

4 files changed

Lines changed: 4 additions & 10 deletions

File tree

‎net/ax25/af_ax25.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,9 @@ ax25_cb *ax25_create_cb(void)
486486
{
487487
ax25_cb *ax25;
488488

489-
if ((ax25 = kmalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL)
489+
if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL)
490490
return NULL;
491491

492-
memset(ax25, 0x00, sizeof(*ax25));
493492
atomic_set(&ax25->refcount, 1);
494493

495494
skb_queue_head_init(&ax25->write_queue);

‎net/ax25/ax25_dev.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ void ax25_dev_device_up(struct net_device *dev)
5555
{
5656
ax25_dev *ax25_dev;
5757

58-
if ((ax25_dev = kmalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) {
58+
if ((ax25_dev = kzalloc(sizeof(*ax25_dev), GFP_ATOMIC)) == NULL) {
5959
printk(KERN_ERR "AX.25: ax25_dev_device_up - out of memory\n");
6060
return;
6161
}
6262

6363
ax25_unregister_sysctl();
6464

65-
memset(ax25_dev, 0x00, sizeof(*ax25_dev));
66-
6765
dev->ax25_ptr = ax25_dev;
6866
ax25_dev->dev = dev;
6967
dev_hold(dev);

‎net/netrom/af_netrom.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,14 +1382,12 @@ static int __init nr_proto_init(void)
13821382
return -1;
13831383
}
13841384

1385-
dev_nr = kmalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL);
1385+
dev_nr = kzalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL);
13861386
if (dev_nr == NULL) {
13871387
printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n");
13881388
return -1;
13891389
}
13901390

1391-
memset(dev_nr, 0x00, nr_ndevs * sizeof(struct net_device *));
1392-
13931391
for (i = 0; i < nr_ndevs; i++) {
13941392
char name[IFNAMSIZ];
13951393
struct net_device *dev;

‎net/rose/af_rose.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,14 +1490,13 @@ static int __init rose_proto_init(void)
14901490

14911491
rose_callsign = null_ax25_address;
14921492

1493-
dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);
1493+
dev_rose = kzalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);
14941494
if (dev_rose == NULL) {
14951495
printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");
14961496
rc = -ENOMEM;
14971497
goto out_proto_unregister;
14981498
}
14991499

1500-
memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*));
15011500
for (i = 0; i < rose_ndevs; i++) {
15021501
struct net_device *dev;
15031502
char name[IFNAMSIZ];

0 commit comments

Comments
 (0)