Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

some kmalloc/memset ->kzalloc (tree wide)

Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc).

Here is a short excerpt of the semantic patch performing
this transformation:

@@
type T2;
expression x;
identifier f,fld;
expression E;
expression E1,E2;
expression e1,e2,e3,y;
statement S;
@@

x =
- kmalloc
+ kzalloc
(E1,E2)
... when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\)
- memset((T2)x,0,E1);

@@
expression E1,E2,E3;
@@

- kzalloc(E1 * E2,E3)
+ kcalloc(E1,E2,E3)

[akpm@linux-foundation.org: get kcalloc args the right way around]
Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Bryan Wu <bryan.wu@analog.com>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Acked-by: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Greg KH <greg@kroah.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Yoann Padioleau and committed by
Linus Torvalds
dd00cc48 3b5ad079

+157 -330
+1 -2
Documentation/connector/cn_test.c
··· 124 124 struct cn_msg *m; 125 125 char data[32]; 126 126 127 - m = kmalloc(sizeof(*m) + sizeof(data), GFP_ATOMIC); 127 + m = kzalloc(sizeof(*m) + sizeof(data), GFP_ATOMIC); 128 128 if (m) { 129 - memset(m, 0, sizeof(*m) + sizeof(data)); 130 129 131 130 memcpy(&m->id, &cn_test_id, sizeof(m->id)); 132 131 m->seq = cn_test_timer_counter;
+2 -4
Documentation/filesystems/configfs/configfs_example.c
··· 277 277 { 278 278 struct simple_child *simple_child; 279 279 280 - simple_child = kmalloc(sizeof(struct simple_child), GFP_KERNEL); 280 + simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL); 281 281 if (!simple_child) 282 282 return NULL; 283 283 284 - memset(simple_child, 0, sizeof(struct simple_child)); 285 284 286 285 config_item_init_type_name(&simple_child->item, name, 287 286 &simple_child_type); ··· 363 364 { 364 365 struct simple_children *simple_children; 365 366 366 - simple_children = kmalloc(sizeof(struct simple_children), 367 + simple_children = kzalloc(sizeof(struct simple_children), 367 368 GFP_KERNEL); 368 369 if (!simple_children) 369 370 return NULL; 370 371 371 - memset(simple_children, 0, sizeof(struct simple_children)); 372 372 373 373 config_group_init_type_name(&simple_children->group, name, 374 374 &simple_children_type);
+1 -2
arch/alpha/kernel/module.c
··· 119 119 } 120 120 121 121 nsyms = symtab->sh_size / sizeof(Elf64_Sym); 122 - chains = kmalloc(nsyms * sizeof(struct got_entry), GFP_KERNEL); 123 - memset(chains, 0, nsyms * sizeof(struct got_entry)); 122 + chains = kcalloc(nsyms, sizeof(struct got_entry), GFP_KERNEL); 124 123 125 124 got->sh_size = 0; 126 125 got->sh_addralign = 8;
+1 -2
arch/arm/mach-iop13xx/pci.c
··· 1002 1002 if (nr > 1) 1003 1003 return 0; 1004 1004 1005 - res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL); 1005 + res = kcalloc(2, sizeof(struct resource), GFP_KERNEL); 1006 1006 if (!res) 1007 1007 panic("PCI: unable to alloc resources"); 1008 1008 1009 - memset(res, 0, sizeof(struct resource) * 2); 1010 1009 1011 1010 /* 'nr' assumptions: 1012 1011 * ATUX is always 0
+1 -2
arch/blackfin/mm/blackfin_sram.c
··· 521 521 struct sram_list_struct *lsl = NULL; 522 522 struct mm_struct *mm = current->mm; 523 523 524 - lsl = kmalloc(sizeof(struct sram_list_struct), GFP_KERNEL); 524 + lsl = kzalloc(sizeof(struct sram_list_struct), GFP_KERNEL); 525 525 if (!lsl) 526 526 return NULL; 527 - memset(lsl, 0, sizeof(*lsl)); 528 527 529 528 if (flags & L1_INST_SRAM) 530 529 addr = l1_inst_sram_alloc(size);
+2 -4
arch/cris/arch-v32/drivers/pci/dma.c
··· 91 91 if (!mem_base) 92 92 goto out; 93 93 94 - dev->dma_mem = kmalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL); 94 + dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL); 95 95 if (!dev->dma_mem) 96 96 goto out; 97 - memset(dev->dma_mem, 0, sizeof(struct dma_coherent_mem)); 98 - dev->dma_mem->bitmap = kmalloc(bitmap_size, GFP_KERNEL); 97 + dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL); 99 98 if (!dev->dma_mem->bitmap) 100 99 goto free1_out; 101 - memset(dev->dma_mem->bitmap, 0, bitmap_size); 102 100 103 101 dev->dma_mem->virt_base = mem_base; 104 102 dev->dma_mem->device_base = device_addr;
+1 -2
arch/powerpc/kernel/lparcfg.c
··· 248 248 } else { 249 249 int splpar_strlen; 250 250 int idx, w_idx; 251 - char *workbuffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); 251 + char *workbuffer = kzalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); 252 252 if (!workbuffer) { 253 253 printk(KERN_ERR "%s %s kmalloc failure at line %d \n", 254 254 __FILE__, __FUNCTION__, __LINE__); ··· 261 261 splpar_strlen = local_buffer[0] * 256 + local_buffer[1]; 262 262 local_buffer += 2; /* step over strlen value */ 263 263 264 - memset(workbuffer, 0, SPLPAR_MAXLENGTH); 265 264 w_idx = 0; 266 265 idx = 0; 267 266 while ((*local_buffer) && (idx < splpar_strlen)) {
+1 -2
arch/powerpc/kernel/of_platform.c
··· 222 222 { 223 223 struct of_device *dev; 224 224 225 - dev = kmalloc(sizeof(*dev), GFP_KERNEL); 225 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 226 226 if (!dev) 227 227 return NULL; 228 - memset(dev, 0, sizeof(*dev)); 229 228 230 229 dev->node = of_node_get(np); 231 230 dev->dma_mask = 0xffffffffUL;
+1 -2
block/scsi_ioctl.c
··· 436 436 437 437 bytes = max(in_len, out_len); 438 438 if (bytes) { 439 - buffer = kmalloc(bytes, q->bounce_gfp | GFP_USER| __GFP_NOWARN); 439 + buffer = kzalloc(bytes, q->bounce_gfp | GFP_USER| __GFP_NOWARN); 440 440 if (!buffer) 441 441 return -ENOMEM; 442 442 443 - memset(buffer, 0, bytes); 444 443 } 445 444 446 445 rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT);
+1 -2
drivers/block/sx8.c
··· 1608 1608 } 1609 1609 #endif 1610 1610 1611 - host = kmalloc(sizeof(*host), GFP_KERNEL); 1611 + host = kzalloc(sizeof(*host), GFP_KERNEL); 1612 1612 if (!host) { 1613 1613 printk(KERN_ERR DRV_NAME "(%s): memory alloc failure\n", 1614 1614 pci_name(pdev)); ··· 1616 1616 goto err_out_regions; 1617 1617 } 1618 1618 1619 - memset(host, 0, sizeof(*host)); 1620 1619 host->pdev = pdev; 1621 1620 host->flags = pci_dac ? FL_DAC : 0; 1622 1621 spin_lock_init(&host->lock);
+1 -2
drivers/char/amiserial.c
··· 1721 1721 *ret_info = sstate->info; 1722 1722 return 0; 1723 1723 } 1724 - info = kmalloc(sizeof(struct async_struct), GFP_KERNEL); 1724 + info = kzalloc(sizeof(struct async_struct), GFP_KERNEL); 1725 1725 if (!info) { 1726 1726 sstate->count--; 1727 1727 return -ENOMEM; 1728 1728 } 1729 - memset(info, 0, sizeof(struct async_struct)); 1730 1729 #ifdef DECLARE_WAITQUEUE 1731 1730 init_waitqueue_head(&info->open_wait); 1732 1731 init_waitqueue_head(&info->close_wait);
+1 -2
drivers/char/drm/via_dmablit.c
··· 273 273 vsg->num_desc_pages = (vsg->num_desc + vsg->descriptors_per_page - 1) / 274 274 vsg->descriptors_per_page; 275 275 276 - if (NULL == (vsg->desc_pages = kmalloc(sizeof(void *) * vsg->num_desc_pages, GFP_KERNEL))) 276 + if (NULL == (vsg->desc_pages = kcalloc(vsg->num_desc_pages, sizeof(void *), GFP_KERNEL))) 277 277 return DRM_ERR(ENOMEM); 278 278 279 - memset(vsg->desc_pages, 0, sizeof(void *) * vsg->num_desc_pages); 280 279 vsg->state = dr_via_desc_pages_alloc; 281 280 for (i=0; i<vsg->num_desc_pages; ++i) { 282 281 if (NULL == (vsg->desc_pages[i] =
+2 -4
drivers/char/esp.c
··· 2459 2459 return 1; 2460 2460 } 2461 2461 2462 - info = kmalloc(sizeof(struct esp_struct), GFP_KERNEL); 2462 + info = kzalloc(sizeof(struct esp_struct), GFP_KERNEL); 2463 2463 2464 2464 if (!info) 2465 2465 { ··· 2469 2469 return 1; 2470 2470 } 2471 2471 2472 - memset((void *)info, 0, sizeof(struct esp_struct)); 2473 2472 spin_lock_init(&info->lock); 2474 2473 /* rx_trigger, tx_trigger are needed by autoconfig */ 2475 2474 info->config.rx_trigger = rx_trigger; ··· 2526 2527 if (!dma) 2527 2528 info->stat_flags |= ESP_STAT_NEVER_DMA; 2528 2529 2529 - info = kmalloc(sizeof(struct esp_struct), GFP_KERNEL); 2530 + info = kzalloc(sizeof(struct esp_struct), GFP_KERNEL); 2530 2531 if (!info) 2531 2532 { 2532 2533 printk(KERN_ERR "Couldn't allocate memory for esp serial device information\n"); ··· 2535 2536 return 0; 2536 2537 } 2537 2538 2538 - memset((void *)info, 0, sizeof(struct esp_struct)); 2539 2539 /* rx_trigger, tx_trigger are needed by autoconfig */ 2540 2540 info->config.rx_trigger = rx_trigger; 2541 2541 info->config.tx_trigger = tx_trigger;
+1 -3
drivers/char/hvcs.c
··· 784 784 return -EFAULT; 785 785 } 786 786 787 - hvcsd = kmalloc(sizeof(*hvcsd), GFP_KERNEL); 787 + hvcsd = kzalloc(sizeof(*hvcsd), GFP_KERNEL); 788 788 if (!hvcsd) 789 789 return -ENODEV; 790 790 791 - /* hvcsd->tty is zeroed out with the memset */ 792 - memset(hvcsd, 0x00, sizeof(*hvcsd)); 793 791 794 792 spin_lock_init(&hvcsd->lock); 795 793 /* Automatically incs the refcount the first time */
+1 -2
drivers/char/ipmi/ipmi_msghandler.c
··· 2639 2639 return -ENODEV; 2640 2640 } 2641 2641 2642 - intf = kmalloc(sizeof(*intf), GFP_KERNEL); 2642 + intf = kzalloc(sizeof(*intf), GFP_KERNEL); 2643 2643 if (!intf) 2644 2644 return -ENOMEM; 2645 - memset(intf, 0, sizeof(*intf)); 2646 2645 2647 2646 intf->ipmi_version_major = ipmi_version_major(device_id); 2648 2647 intf->ipmi_version_minor = ipmi_version_minor(device_id);
+1 -3
drivers/char/rio/rio_linux.c
··· 803 803 { 804 804 void *p; 805 805 806 - p = kmalloc(size, GFP_KERNEL); 807 - if (p) 808 - memset(p, 0, size); 806 + p = kzalloc(size, GFP_KERNEL); 809 807 return p; 810 808 } 811 809
+1 -3
drivers/char/rio/riocmd.c
··· 556 556 { 557 557 struct CmdBlk *CmdBlkP; 558 558 559 - CmdBlkP = kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); 560 - if (CmdBlkP) 561 - memset(CmdBlkP, 0, sizeof(struct CmdBlk)); 559 + CmdBlkP = kzalloc(sizeof(struct CmdBlk), GFP_ATOMIC); 562 560 return CmdBlkP; 563 561 } 564 562
+1 -2
drivers/char/rio/riotable.c
··· 863 863 if (PortP->TxRingBuffer) 864 864 memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); 865 865 else if (p->RIOBufferSize) { 866 - PortP->TxRingBuffer = kmalloc(p->RIOBufferSize, GFP_KERNEL); 867 - memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); 866 + PortP->TxRingBuffer = kzalloc(p->RIOBufferSize, GFP_KERNEL); 868 867 } 869 868 PortP->TxBufferOut = 0; 870 869 PortP->TxBufferIn = 0;
+1 -2
drivers/char/rocket.c
··· 635 635 ctlp = sCtlNumToCtlPtr(board); 636 636 637 637 /* Get a r_port struct for the port, fill it in and save it globally, indexed by line number */ 638 - info = kmalloc(sizeof (struct r_port), GFP_KERNEL); 638 + info = kzalloc(sizeof (struct r_port), GFP_KERNEL); 639 639 if (!info) { 640 640 printk(KERN_INFO "Couldn't allocate info struct for line #%d\n", line); 641 641 return; 642 642 } 643 - memset(info, 0, sizeof (struct r_port)); 644 643 645 644 info->magic = RPORT_MAGIC; 646 645 info->line = line;
+1 -2
drivers/char/synclink.c
··· 4324 4324 { 4325 4325 struct mgsl_struct *info; 4326 4326 4327 - info = kmalloc(sizeof(struct mgsl_struct), 4327 + info = kzalloc(sizeof(struct mgsl_struct), 4328 4328 GFP_KERNEL); 4329 4329 4330 4330 if (!info) { 4331 4331 printk("Error can't allocate device instance data\n"); 4332 4332 } else { 4333 - memset(info, 0, sizeof(struct mgsl_struct)); 4334 4333 info->magic = MGSL_MAGIC; 4335 4334 INIT_WORK(&info->task, mgsl_bh_handler); 4336 4335 info->max_frame_size = 4096;
+1 -2
drivers/char/synclinkmp.c
··· 3786 3786 { 3787 3787 SLMP_INFO *info; 3788 3788 3789 - info = kmalloc(sizeof(SLMP_INFO), 3789 + info = kzalloc(sizeof(SLMP_INFO), 3790 3790 GFP_KERNEL); 3791 3791 3792 3792 if (!info) { 3793 3793 printk("%s(%d) Error can't allocate device instance data for adapter %d, port %d\n", 3794 3794 __FILE__,__LINE__, adapter_num, port_num); 3795 3795 } else { 3796 - memset(info, 0, sizeof(SLMP_INFO)); 3797 3796 info->magic = MGSL_MAGIC; 3798 3797 INIT_WORK(&info->task, bh_handler); 3799 3798 info->max_frame_size = 4096;
+1 -2
drivers/char/watchdog/mpcore_wdt.c
··· 328 328 goto err_out; 329 329 } 330 330 331 - wdt = kmalloc(sizeof(struct mpcore_wdt), GFP_KERNEL); 331 + wdt = kzalloc(sizeof(struct mpcore_wdt), GFP_KERNEL); 332 332 if (!wdt) { 333 333 ret = -ENOMEM; 334 334 goto err_out; 335 335 } 336 - memset(wdt, 0, sizeof(struct mpcore_wdt)); 337 336 338 337 wdt->dev = &dev->dev; 339 338 wdt->irq = platform_get_irq(dev, 0);
+1 -2
drivers/char/watchdog/pcwd_usb.c
··· 626 626 maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); 627 627 628 628 /* allocate memory for our device and initialize it */ 629 - usb_pcwd = kmalloc (sizeof(struct usb_pcwd_private), GFP_KERNEL); 629 + usb_pcwd = kzalloc (sizeof(struct usb_pcwd_private), GFP_KERNEL); 630 630 if (usb_pcwd == NULL) { 631 631 printk(KERN_ERR PFX "Out of memory\n"); 632 632 goto error; 633 633 } 634 - memset (usb_pcwd, 0x00, sizeof (*usb_pcwd)); 635 634 636 635 usb_pcwd_device = usb_pcwd; 637 636
+1 -2
drivers/ide/mips/swarm.c
··· 165 165 goto out; 166 166 } 167 167 168 - if (!(pldev = kmalloc(sizeof (*pldev), GFP_KERNEL))) { 168 + if (!(pldev = kzalloc(sizeof (*pldev), GFP_KERNEL))) { 169 169 err = -ENOMEM; 170 170 goto out_unregister_driver; 171 171 } 172 172 173 - memset (pldev, 0, sizeof (*pldev)); 174 173 pldev->name = swarm_ide_string; 175 174 pldev->id = 0; 176 175 pldev->dev.release = swarm_ide_platform_release;
+1 -2
drivers/infiniband/core/addr.c
··· 295 295 struct addr_req *req; 296 296 int ret = 0; 297 297 298 - req = kmalloc(sizeof *req, GFP_KERNEL); 298 + req = kzalloc(sizeof *req, GFP_KERNEL); 299 299 if (!req) 300 300 return -ENOMEM; 301 - memset(req, 0, sizeof *req); 302 301 303 302 if (src_addr) 304 303 memcpy(&req->src_addr, src_addr, ip_addr_size(src_addr));
+1 -2
drivers/infiniband/hw/cxgb3/iwch_cm.c
··· 229 229 { 230 230 struct iwch_ep_common *epc; 231 231 232 - epc = kmalloc(size, gfp); 232 + epc = kzalloc(size, gfp); 233 233 if (epc) { 234 - memset(epc, 0, size); 235 234 kref_init(&epc->kref); 236 235 spin_lock_init(&epc->lock); 237 236 init_waitqueue_head(&epc->waitq);
+2 -4
drivers/input/serio/ambakmi.c
··· 117 117 if (ret) 118 118 return ret; 119 119 120 - kmi = kmalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); 121 - io = kmalloc(sizeof(struct serio), GFP_KERNEL); 120 + kmi = kzalloc(sizeof(struct amba_kmi_port), GFP_KERNEL); 121 + io = kzalloc(sizeof(struct serio), GFP_KERNEL); 122 122 if (!kmi || !io) { 123 123 ret = -ENOMEM; 124 124 goto out; 125 125 } 126 126 127 - memset(kmi, 0, sizeof(struct amba_kmi_port)); 128 - memset(io, 0, sizeof(struct serio)); 129 127 130 128 io->id.type = SERIO_8042; 131 129 io->write = amba_kmi_write;
+2 -4
drivers/input/serio/pcips2.c
··· 140 140 if (ret) 141 141 goto disable; 142 142 143 - ps2if = kmalloc(sizeof(struct pcips2_data), GFP_KERNEL); 144 - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); 143 + ps2if = kzalloc(sizeof(struct pcips2_data), GFP_KERNEL); 144 + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 145 145 if (!ps2if || !serio) { 146 146 ret = -ENOMEM; 147 147 goto release; 148 148 } 149 149 150 - memset(ps2if, 0, sizeof(struct pcips2_data)); 151 - memset(serio, 0, sizeof(struct serio)); 152 150 153 151 serio->id.type = SERIO_8042; 154 152 serio->write = pcips2_write;
+2 -4
drivers/input/serio/sa1111ps2.c
··· 234 234 struct serio *serio; 235 235 int ret; 236 236 237 - ps2if = kmalloc(sizeof(struct ps2if), GFP_KERNEL); 238 - serio = kmalloc(sizeof(struct serio), GFP_KERNEL); 237 + ps2if = kzalloc(sizeof(struct ps2if), GFP_KERNEL); 238 + serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 239 239 if (!ps2if || !serio) { 240 240 ret = -ENOMEM; 241 241 goto free; 242 242 } 243 243 244 - memset(ps2if, 0, sizeof(struct ps2if)); 245 - memset(serio, 0, sizeof(struct serio)); 246 244 247 245 serio->id.type = SERIO_8042; 248 246 serio->write = ps2_write;
+1 -2
drivers/macintosh/macio_asic.c
··· 365 365 if (np == NULL) 366 366 return NULL; 367 367 368 - dev = kmalloc(sizeof(*dev), GFP_KERNEL); 368 + dev = kzalloc(sizeof(*dev), GFP_KERNEL); 369 369 if (!dev) 370 370 return NULL; 371 - memset(dev, 0, sizeof(*dev)); 372 371 373 372 dev->bus = &chip->lbus; 374 373 dev->media_bay = in_bay;
+1 -2
drivers/macintosh/smu.c
··· 1053 1053 struct smu_private *pp; 1054 1054 unsigned long flags; 1055 1055 1056 - pp = kmalloc(sizeof(struct smu_private), GFP_KERNEL); 1056 + pp = kzalloc(sizeof(struct smu_private), GFP_KERNEL); 1057 1057 if (pp == 0) 1058 1058 return -ENOMEM; 1059 - memset(pp, 0, sizeof(struct smu_private)); 1060 1059 spin_lock_init(&pp->lock); 1061 1060 pp->mode = smu_file_commands; 1062 1061 init_waitqueue_head(&pp->wait);
+1 -2
drivers/macintosh/therm_pm72.c
··· 318 318 if (adap == NULL) 319 319 return NULL; 320 320 321 - clt = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 321 + clt = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); 322 322 if (clt == NULL) 323 323 return NULL; 324 - memset(clt, 0, sizeof(struct i2c_client)); 325 324 326 325 clt->addr = (id >> 1) & 0x7f; 327 326 clt->adapter = adap;
+1 -2
drivers/macintosh/therm_windtunnel.c
··· 431 431 | I2C_FUNC_SMBUS_WRITE_BYTE) ) 432 432 return 0; 433 433 434 - if( !(cl=kmalloc(sizeof(*cl), GFP_KERNEL)) ) 434 + if( !(cl=kzalloc(sizeof(*cl), GFP_KERNEL)) ) 435 435 return -ENOMEM; 436 - memset( cl, 0, sizeof(struct i2c_client) ); 437 436 438 437 cl->addr = addr; 439 438 cl->adapter = adapter;
+1 -2
drivers/macintosh/windfarm_lm75_sensor.c
··· 117 117 DBG("wf_lm75: creating %s device at address 0x%02x\n", 118 118 ds1775 ? "ds1775" : "lm75", addr); 119 119 120 - lm = kmalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL); 120 + lm = kzalloc(sizeof(struct wf_lm75_sensor), GFP_KERNEL); 121 121 if (lm == NULL) 122 122 return NULL; 123 - memset(lm, 0, sizeof(struct wf_lm75_sensor)); 124 123 125 124 /* Usual rant about sensor names not beeing very consistent in 126 125 * the device-tree, oh well ...
+1 -2
drivers/md/dm-raid1.c
··· 951 951 952 952 len = sizeof(*ms) + (sizeof(ms->mirror[0]) * nr_mirrors); 953 953 954 - ms = kmalloc(len, GFP_KERNEL); 954 + ms = kzalloc(len, GFP_KERNEL); 955 955 if (!ms) { 956 956 ti->error = "Cannot allocate mirror context"; 957 957 return NULL; 958 958 } 959 959 960 - memset(ms, 0, len); 961 960 spin_lock_init(&ms->lock); 962 961 963 962 ms->ti = ti;
+1 -2
drivers/media/dvb/cinergyT2/cinergyT2.c
··· 905 905 struct cinergyt2 *cinergyt2; 906 906 int err; 907 907 908 - if (!(cinergyt2 = kmalloc (sizeof(struct cinergyt2), GFP_KERNEL))) { 908 + if (!(cinergyt2 = kzalloc (sizeof(struct cinergyt2), GFP_KERNEL))) { 909 909 dprintk(1, "out of memory?!?\n"); 910 910 return -ENOMEM; 911 911 } 912 912 913 - memset (cinergyt2, 0, sizeof (struct cinergyt2)); 914 913 usb_set_intfdata (intf, (void *) cinergyt2); 915 914 916 915 mutex_init(&cinergyt2->sem);
+1 -3
drivers/media/video/cpia2/cpia2_core.c
··· 2224 2224 { 2225 2225 struct camera_data *cam; 2226 2226 2227 - cam = kmalloc(sizeof(*cam), GFP_KERNEL); 2227 + cam = kzalloc(sizeof(*cam), GFP_KERNEL); 2228 2228 2229 2229 if (!cam) { 2230 2230 ERR("couldn't kmalloc cpia2 struct\n"); 2231 2231 return NULL; 2232 2232 } 2233 2233 2234 - /* Default everything to 0 */ 2235 - memset(cam, 0, sizeof(struct camera_data)); 2236 2234 2237 2235 cam->present = 1; 2238 2236 mutex_init(&cam->busy_lock);
+1 -2
drivers/media/video/msp3400-driver.c
··· 812 812 int msp_product, msp_prod_hi, msp_prod_lo; 813 813 int msp_rom; 814 814 815 - client = kmalloc(sizeof(*client), GFP_KERNEL); 815 + client = kzalloc(sizeof(*client), GFP_KERNEL); 816 816 if (client == NULL) 817 817 return -ENOMEM; 818 - memset(client, 0, sizeof(*client)); 819 818 client->addr = address; 820 819 client->adapter = adapter; 821 820 client->driver = &i2c_driver;
+1 -2
drivers/media/video/planb.c
··· 353 353 * PLANB_DUMMY)*sizeof(struct dbdma_cmd) 354 354 +(PLANB_MAXLINES*((PLANB_MAXPIXELS+7)& ~7))/8 355 355 +MAX_GBUFFERS*sizeof(unsigned int); 356 - if ((pb->priv_space = kmalloc (size, GFP_KERNEL)) == 0) 356 + if ((pb->priv_space = kzalloc (size, GFP_KERNEL)) == 0) 357 357 return -ENOMEM; 358 - memset ((void *) pb->priv_space, 0, size); 359 358 pb->overlay_last1 = pb->ch1_cmd = (volatile struct dbdma_cmd *) 360 359 DBDMA_ALIGN (pb->priv_space); 361 360 pb->overlay_last2 = pb->ch2_cmd = pb->ch1_cmd + pb->tab_size;
+1 -2
drivers/media/video/usbvideo/vicam.c
··· 1130 1130 } 1131 1131 1132 1132 if ((cam = 1133 - kmalloc(sizeof (struct vicam_camera), GFP_KERNEL)) == NULL) { 1133 + kzalloc(sizeof (struct vicam_camera), GFP_KERNEL)) == NULL) { 1134 1134 printk(KERN_WARNING 1135 1135 "could not allocate kernel memory for vicam_camera struct\n"); 1136 1136 return -ENOMEM; 1137 1137 } 1138 1138 1139 - memset(cam, 0, sizeof (struct vicam_camera)); 1140 1139 1141 1140 cam->shutter_speed = 15; 1142 1141
+1 -2
drivers/mfd/mcp-core.c
··· 200 200 { 201 201 struct mcp *mcp; 202 202 203 - mcp = kmalloc(sizeof(struct mcp) + size, GFP_KERNEL); 203 + mcp = kzalloc(sizeof(struct mcp) + size, GFP_KERNEL); 204 204 if (mcp) { 205 - memset(mcp, 0, sizeof(struct mcp) + size); 206 205 spin_lock_init(&mcp->lock); 207 206 mcp->attached_device.parent = parent; 208 207 mcp->attached_device.bus = &mcp_bus_type;
+1 -2
drivers/mfd/ucb1x00-core.c
··· 484 484 goto err_disable; 485 485 } 486 486 487 - ucb = kmalloc(sizeof(struct ucb1x00), GFP_KERNEL); 487 + ucb = kzalloc(sizeof(struct ucb1x00), GFP_KERNEL); 488 488 ret = -ENOMEM; 489 489 if (!ucb) 490 490 goto err_disable; 491 491 492 - memset(ucb, 0, sizeof(struct ucb1x00)); 493 492 494 493 ucb->cdev.class = &ucb1x00_class; 495 494 ucb->cdev.dev = &mcp->attached_device;
+1 -2
drivers/misc/asus-laptop.c
··· 979 979 printk(ASUS_NOTICE "Asus Laptop Support version %s\n", 980 980 ASUS_LAPTOP_VERSION); 981 981 982 - hotk = kmalloc(sizeof(struct asus_hotk), GFP_KERNEL); 982 + hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL); 983 983 if (!hotk) 984 984 return -ENOMEM; 985 - memset(hotk, 0, sizeof(struct asus_hotk)); 986 985 987 986 hotk->handle = device->handle; 988 987 strcpy(acpi_device_name(device), ASUS_HOTK_DEVICE_NAME);
+2 -4
drivers/misc/ibmasm/command.c
··· 41 41 if (buffer_size > IBMASM_CMD_MAX_BUFFER_SIZE) 42 42 return NULL; 43 43 44 - cmd = kmalloc(sizeof(struct command), GFP_KERNEL); 44 + cmd = kzalloc(sizeof(struct command), GFP_KERNEL); 45 45 if (cmd == NULL) 46 46 return NULL; 47 47 48 - memset(cmd, 0, sizeof(*cmd)); 49 48 50 - cmd->buffer = kmalloc(buffer_size, GFP_KERNEL); 49 + cmd->buffer = kzalloc(buffer_size, GFP_KERNEL); 51 50 if (cmd->buffer == NULL) { 52 51 kfree(cmd); 53 52 return NULL; 54 53 } 55 - memset(cmd->buffer, 0, buffer_size); 56 54 cmd->buffer_size = buffer_size; 57 55 58 56 kobject_init(&cmd->kobj);
+1 -2
drivers/misc/ibmasm/ibmasmfs.c
··· 563 563 if (*offset != 0) 564 564 return 0; 565 565 566 - buff = kmalloc (count + 1, GFP_KERNEL); 566 + buff = kzalloc (count + 1, GFP_KERNEL); 567 567 if (!buff) 568 568 return -ENOMEM; 569 569 570 - memset(buff, 0x0, count + 1); 571 570 572 571 if (copy_from_user(buff, ubuff, count)) { 573 572 kfree(buff);
+1 -2
drivers/misc/ibmasm/module.c
··· 77 77 /* vnc client won't work without bus-mastering */ 78 78 pci_set_master(pdev); 79 79 80 - sp = kmalloc(sizeof(struct service_processor), GFP_KERNEL); 80 + sp = kzalloc(sizeof(struct service_processor), GFP_KERNEL); 81 81 if (sp == NULL) { 82 82 dev_err(&pdev->dev, "Failed to allocate memory\n"); 83 83 result = -ENOMEM; 84 84 goto error_kmalloc; 85 85 } 86 - memset(sp, 0, sizeof(struct service_processor)); 87 86 88 87 spin_lock_init(&sp->lock); 89 88 INIT_LIST_HEAD(&sp->command_queue);
+1 -2
drivers/mmc/card/block.c
··· 414 414 return ERR_PTR(-ENOSPC); 415 415 __set_bit(devidx, dev_use); 416 416 417 - md = kmalloc(sizeof(struct mmc_blk_data), GFP_KERNEL); 417 + md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL); 418 418 if (!md) { 419 419 ret = -ENOMEM; 420 420 goto out; 421 421 } 422 422 423 - memset(md, 0, sizeof(struct mmc_blk_data)); 424 423 425 424 /* 426 425 * Set the read-only status based on the supported commands
+1 -2
drivers/net/b44.c
··· 1519 1519 u8 *pwol_pattern; 1520 1520 u8 pwol_mask[B44_PMASK_SIZE]; 1521 1521 1522 - pwol_pattern = kmalloc(B44_PATTERN_SIZE, GFP_KERNEL); 1522 + pwol_pattern = kzalloc(B44_PATTERN_SIZE, GFP_KERNEL); 1523 1523 if (!pwol_pattern) { 1524 1524 printk(KERN_ERR PFX "Memory not available for WOL\n"); 1525 1525 return; 1526 1526 } 1527 1527 1528 1528 /* Ipv4 magic packet pattern - pattern 0.*/ 1529 - memset(pwol_pattern, 0, B44_PATTERN_SIZE); 1530 1529 memset(pwol_mask, 0, B44_PMASK_SIZE); 1531 1530 plen0 = b44_magic_pattern(bp->dev->dev_addr, pwol_pattern, pwol_mask, 1532 1531 B44_ETHIPV4UDP_HLEN);
+1 -2
drivers/net/bsd_comp.c
··· 395 395 * Allocate the main control structure for this instance. 396 396 */ 397 397 maxmaxcode = MAXCODE(bits); 398 - db = kmalloc(sizeof (struct bsd_db), 398 + db = kzalloc(sizeof (struct bsd_db), 399 399 GFP_KERNEL); 400 400 if (!db) 401 401 { 402 402 return NULL; 403 403 } 404 404 405 - memset (db, 0, sizeof(struct bsd_db)); 406 405 /* 407 406 * Allocate space for the dictionary. This may be more than one page in 408 407 * length.
+2 -4
drivers/net/forcedeth.c
··· 5137 5137 goto out_unmap; 5138 5138 np->tx_ring.ex = &np->rx_ring.ex[np->rx_ring_size]; 5139 5139 } 5140 - np->rx_skb = kmalloc(sizeof(struct nv_skb_map) * np->rx_ring_size, GFP_KERNEL); 5141 - np->tx_skb = kmalloc(sizeof(struct nv_skb_map) * np->tx_ring_size, GFP_KERNEL); 5140 + np->rx_skb = kcalloc(np->rx_ring_size, sizeof(struct nv_skb_map), GFP_KERNEL); 5141 + np->tx_skb = kcalloc(np->tx_ring_size, sizeof(struct nv_skb_map), GFP_KERNEL); 5142 5142 if (!np->rx_skb || !np->tx_skb) 5143 5143 goto out_freering; 5144 - memset(np->rx_skb, 0, sizeof(struct nv_skb_map) * np->rx_ring_size); 5145 - memset(np->tx_skb, 0, sizeof(struct nv_skb_map) * np->tx_ring_size); 5146 5144 5147 5145 dev->open = nv_open; 5148 5146 dev->stop = nv_close;
+2 -4
drivers/net/hamradio/dmascc.c
··· 453 453 int scc_base = card_base + hw[type].scc_offset; 454 454 char *chipnames[] = CHIPNAMES; 455 455 456 - /* Allocate memory */ 457 - info = kmalloc(sizeof(struct scc_info), GFP_KERNEL | GFP_DMA); 456 + /* Initialize what is necessary for write_scc and write_scc_data */ 457 + info = kzalloc(sizeof(struct scc_info), GFP_KERNEL | GFP_DMA); 458 458 if (!info) { 459 459 printk(KERN_ERR "dmascc: " 460 460 "could not allocate memory for %s at %#3x\n", ··· 462 462 goto out; 463 463 } 464 464 465 - /* Initialize what is necessary for write_scc and write_scc_data */ 466 - memset(info, 0, sizeof(struct scc_info)); 467 465 468 466 info->dev[0] = alloc_netdev(0, "", dev_setup); 469 467 if (!info->dev[0]) {
+1 -2
drivers/net/irda/irport.c
··· 164 164 165 165 /* Allocate memory if needed */ 166 166 if (self->tx_buff.truesize > 0) { 167 - self->tx_buff.head = kmalloc(self->tx_buff.truesize, 167 + self->tx_buff.head = kzalloc(self->tx_buff.truesize, 168 168 GFP_KERNEL); 169 169 if (self->tx_buff.head == NULL) { 170 170 IRDA_ERROR("%s(), can't allocate memory for " 171 171 "transmit buffer!\n", __FUNCTION__); 172 172 goto err_out4; 173 173 } 174 - memset(self->tx_buff.head, 0, self->tx_buff.truesize); 175 174 } 176 175 self->tx_buff.data = self->tx_buff.head; 177 176
+1 -2
drivers/net/irda/irtty-sir.c
··· 505 505 } 506 506 507 507 /* allocate private device info block */ 508 - priv = kmalloc(sizeof(*priv), GFP_KERNEL); 508 + priv = kzalloc(sizeof(*priv), GFP_KERNEL); 509 509 if (!priv) 510 510 goto out_put; 511 - memset(priv, 0, sizeof(*priv)); 512 511 513 512 priv->magic = IRTTY_MAGIC; 514 513 priv->tty = tty;
+2 -4
drivers/net/iseries_veth.c
··· 822 822 || ! HvLpConfig_doLpsCommunicateOnVirtualLan(this_lp, rlp) ) 823 823 return 0; 824 824 825 - cnx = kmalloc(sizeof(*cnx), GFP_KERNEL); 825 + cnx = kzalloc(sizeof(*cnx), GFP_KERNEL); 826 826 if (! cnx) 827 827 return -ENOMEM; 828 - memset(cnx, 0, sizeof(*cnx)); 829 828 830 829 cnx->remote_lp = rlp; 831 830 spin_lock_init(&cnx->lock); ··· 851 852 if (rc != 0) 852 853 return rc; 853 854 854 - msgs = kmalloc(VETH_NUMBUFFERS * sizeof(struct veth_msg), GFP_KERNEL); 855 + msgs = kcalloc(VETH_NUMBUFFERS, sizeof(struct veth_msg), GFP_KERNEL); 855 856 if (! msgs) { 856 857 veth_error("Can't allocate buffers for LPAR %d.\n", rlp); 857 858 return -ENOMEM; 858 859 } 859 860 860 861 cnx->msgs = msgs; 861 - memset(msgs, 0, VETH_NUMBUFFERS * sizeof(struct veth_msg)); 862 862 863 863 for (i = 0; i < VETH_NUMBUFFERS; i++) { 864 864 msgs[i].token = i;
+1 -2
drivers/net/lance.c
··· 533 533 dev->base_addr = ioaddr; 534 534 /* Make certain the data structures used by the LANCE are aligned and DMAble. */ 535 535 536 - lp = kmalloc(sizeof(*lp), GFP_DMA | GFP_KERNEL); 536 + lp = kzalloc(sizeof(*lp), GFP_DMA | GFP_KERNEL); 537 537 if(lp==NULL) 538 538 return -ENODEV; 539 539 if (lance_debug > 6) printk(" (#0x%05lx)", (unsigned long)lp); 540 - memset(lp, 0, sizeof(*lp)); 541 540 dev->priv = lp; 542 541 lp->name = chipname; 543 542 lp->rx_buffs = (unsigned long)kmalloc(PKT_BUF_SZ*RX_RING_SIZE,
+1 -2
drivers/net/pcmcia/com20020_cs.c
··· 147 147 DEBUG(0, "com20020_attach()\n"); 148 148 149 149 /* Create new network device */ 150 - info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); 150 + info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); 151 151 if (!info) 152 152 goto fail_alloc_info; 153 153 ··· 155 155 if (!dev) 156 156 goto fail_alloc_dev; 157 157 158 - memset(info, 0, sizeof(struct com20020_dev_t)); 159 158 lp = dev->priv; 160 159 lp->timeout = timeout; 161 160 lp->backplane = backplane;
+1 -2
drivers/net/pcmcia/ibmtr_cs.c
··· 146 146 DEBUG(0, "ibmtr_attach()\n"); 147 147 148 148 /* Create new token-ring device */ 149 - info = kmalloc(sizeof(*info), GFP_KERNEL); 149 + info = kzalloc(sizeof(*info), GFP_KERNEL); 150 150 if (!info) return -ENOMEM; 151 - memset(info,0,sizeof(*info)); 152 151 dev = alloc_trdev(sizeof(struct tok_info)); 153 152 if (!dev) { 154 153 kfree(info);
+1 -2
drivers/net/ppp_async.c
··· 159 159 int err; 160 160 161 161 err = -ENOMEM; 162 - ap = kmalloc(sizeof(*ap), GFP_KERNEL); 162 + ap = kzalloc(sizeof(*ap), GFP_KERNEL); 163 163 if (ap == 0) 164 164 goto out; 165 165 166 166 /* initialize the asyncppp structure */ 167 - memset(ap, 0, sizeof(*ap)); 168 167 ap->tty = tty; 169 168 ap->mru = PPP_MRU; 170 169 spin_lock_init(&ap->xmit_lock);
+2 -4
drivers/net/ppp_deflate.c
··· 121 121 if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) 122 122 return NULL; 123 123 124 - state = kmalloc(sizeof(*state), 124 + state = kzalloc(sizeof(*state), 125 125 GFP_KERNEL); 126 126 if (state == NULL) 127 127 return NULL; 128 128 129 - memset (state, 0, sizeof (struct ppp_deflate_state)); 130 129 state->strm.next_in = NULL; 131 130 state->w_size = w_size; 132 131 state->strm.workspace = vmalloc(zlib_deflate_workspacesize()); ··· 340 341 if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) 341 342 return NULL; 342 343 343 - state = kmalloc(sizeof(*state), GFP_KERNEL); 344 + state = kzalloc(sizeof(*state), GFP_KERNEL); 344 345 if (state == NULL) 345 346 return NULL; 346 347 347 - memset (state, 0, sizeof (struct ppp_deflate_state)); 348 348 state->w_size = w_size; 349 349 state->strm.next_out = NULL; 350 350 state->strm.workspace = kmalloc(zlib_inflate_workspacesize(),
+1 -2
drivers/net/ppp_mppe.c
··· 200 200 || options[0] != CI_MPPE || options[1] != CILEN_MPPE) 201 201 goto out; 202 202 203 - state = kmalloc(sizeof(*state), GFP_KERNEL); 203 + state = kzalloc(sizeof(*state), GFP_KERNEL); 204 204 if (state == NULL) 205 205 goto out; 206 206 207 - memset(state, 0, sizeof(*state)); 208 207 209 208 state->arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); 210 209 if (IS_ERR(state->arc4)) {
+1 -2
drivers/net/ppp_synctty.c
··· 207 207 struct syncppp *ap; 208 208 int err; 209 209 210 - ap = kmalloc(sizeof(*ap), GFP_KERNEL); 210 + ap = kzalloc(sizeof(*ap), GFP_KERNEL); 211 211 err = -ENOMEM; 212 212 if (ap == 0) 213 213 goto out; 214 214 215 215 /* initialize the syncppp structure */ 216 - memset(ap, 0, sizeof(*ap)); 217 216 ap->tty = tty; 218 217 ap->mru = PPP_MRU; 219 218 spin_lock_init(&ap->xmit_lock);
+1 -2
drivers/net/shaper.c
··· 600 600 return -ENODEV; 601 601 602 602 alloc_size = sizeof(*dev) * shapers; 603 - devs = kmalloc(alloc_size, GFP_KERNEL); 603 + devs = kzalloc(alloc_size, GFP_KERNEL); 604 604 if (!devs) 605 605 return -ENOMEM; 606 - memset(devs, 0, alloc_size); 607 606 608 607 for (i = 0; i < shapers; i++) { 609 608
+1 -2
drivers/net/wan/c101.c
··· 315 315 return -ENODEV; 316 316 } 317 317 318 - card = kmalloc(sizeof(card_t), GFP_KERNEL); 318 + card = kzalloc(sizeof(card_t), GFP_KERNEL); 319 319 if (card == NULL) { 320 320 printk(KERN_ERR "c101: unable to allocate memory\n"); 321 321 return -ENOBUFS; 322 322 } 323 - memset(card, 0, sizeof(card_t)); 324 323 325 324 card->dev = alloc_hdlcdev(card); 326 325 if (!card->dev) {
+1 -3
drivers/net/wan/cosa.c
··· 572 572 sprintf(cosa->name, "cosa%d", cosa->num); 573 573 574 574 /* Initialize the per-channel data */ 575 - cosa->chan = kmalloc(sizeof(struct channel_data)*cosa->nchannels, 576 - GFP_KERNEL); 575 + cosa->chan = kcalloc(cosa->nchannels, sizeof(struct channel_data), GFP_KERNEL); 577 576 if (!cosa->chan) { 578 577 err = -ENOMEM; 579 578 goto err_out3; 580 579 } 581 - memset(cosa->chan, 0, sizeof(struct channel_data)*cosa->nchannels); 582 580 for (i=0; i<cosa->nchannels; i++) { 583 581 cosa->chan[i].cosa = cosa; 584 582 cosa->chan[i].num = i;
+1 -3
drivers/net/wan/cycx_main.c
··· 113 113 /* Verify number of cards and allocate adapter data space */ 114 114 cycx_ncards = min_t(int, cycx_ncards, CYCX_MAX_CARDS); 115 115 cycx_ncards = max_t(int, cycx_ncards, 1); 116 - cycx_card_array = kmalloc(sizeof(struct cycx_device) * cycx_ncards, 117 - GFP_KERNEL); 116 + cycx_card_array = kcalloc(cycx_ncards, sizeof(struct cycx_device), GFP_KERNEL); 118 117 if (!cycx_card_array) 119 118 goto out; 120 119 121 - memset(cycx_card_array, 0, sizeof(struct cycx_device) * cycx_ncards); 122 120 123 121 /* Register adapters with WAN router */ 124 122 for (cnt = 0; cnt < cycx_ncards; ++cnt) {
+1 -2
drivers/net/wan/cycx_x25.c
··· 376 376 } 377 377 378 378 /* allocate and initialize private data */ 379 - chan = kmalloc(sizeof(struct cycx_x25_channel), GFP_KERNEL); 379 + chan = kzalloc(sizeof(struct cycx_x25_channel), GFP_KERNEL); 380 380 if (!chan) 381 381 return -ENOMEM; 382 382 383 - memset(chan, 0, sizeof(*chan)); 384 383 strcpy(chan->name, conf->name); 385 384 chan->card = card; 386 385 chan->link = conf->port;
+2 -4
drivers/net/wan/dscc4.c
··· 890 890 struct dscc4_dev_priv *root; 891 891 int i, ret = -ENOMEM; 892 892 893 - root = kmalloc(dev_per_card*sizeof(*root), GFP_KERNEL); 893 + root = kcalloc(dev_per_card, sizeof(*root), GFP_KERNEL); 894 894 if (!root) { 895 895 printk(KERN_ERR "%s: can't allocate data\n", DRV_NAME); 896 896 goto err_out; 897 897 } 898 - memset(root, 0, dev_per_card*sizeof(*root)); 899 898 900 899 for (i = 0; i < dev_per_card; i++) { 901 900 root[i].dev = alloc_hdlcdev(root + i); ··· 902 903 goto err_free_dev; 903 904 } 904 905 905 - ppriv = kmalloc(sizeof(*ppriv), GFP_KERNEL); 906 + ppriv = kzalloc(sizeof(*ppriv), GFP_KERNEL); 906 907 if (!ppriv) { 907 908 printk(KERN_ERR "%s: can't allocate private data\n", DRV_NAME); 908 909 goto err_free_dev; 909 910 } 910 - memset(ppriv, 0, sizeof(struct dscc4_pci_priv)); 911 911 912 912 ppriv->root = root; 913 913 spin_lock_init(&ppriv->lock);
+1 -2
drivers/net/wan/farsync.c
··· 2476 2476 } 2477 2477 2478 2478 /* Allocate driver private data */ 2479 - card = kmalloc(sizeof (struct fst_card_info), GFP_KERNEL); 2479 + card = kzalloc(sizeof (struct fst_card_info), GFP_KERNEL); 2480 2480 if (card == NULL) { 2481 2481 printk_err("FarSync card found but insufficient memory for" 2482 2482 " driver storage\n"); 2483 2483 return -ENOMEM; 2484 2484 } 2485 - memset(card, 0, sizeof (struct fst_card_info)); 2486 2485 2487 2486 /* Try to enable the device */ 2488 2487 if ((err = pci_enable_device(pdev)) != 0) {
+1 -2
drivers/net/wan/hostess_sv11.c
··· 231 231 return NULL; 232 232 } 233 233 234 - sv = kmalloc(sizeof(struct sv11_device), GFP_KERNEL); 234 + sv = kzalloc(sizeof(struct sv11_device), GFP_KERNEL); 235 235 if(!sv) 236 236 goto fail3; 237 237 238 - memset(sv, 0, sizeof(*sv)); 239 238 sv->if_ptr=&sv->netdev; 240 239 241 240 sv->netdev.dev = alloc_netdev(0, "hdlc%d", sv11_setup);
+1 -2
drivers/net/wan/n2.c
··· 351 351 return -ENODEV; 352 352 } 353 353 354 - card = kmalloc(sizeof(card_t), GFP_KERNEL); 354 + card = kzalloc(sizeof(card_t), GFP_KERNEL); 355 355 if (card == NULL) { 356 356 printk(KERN_ERR "n2: unable to allocate memory\n"); 357 357 return -ENOBUFS; 358 358 } 359 - memset(card, 0, sizeof(card_t)); 360 359 361 360 card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); 362 361 card->ports[1].dev = alloc_hdlcdev(&card->ports[1]);
+1 -2
drivers/net/wan/pc300_drv.c
··· 3456 3456 if ((err = pci_enable_device(pdev)) < 0) 3457 3457 return err; 3458 3458 3459 - card = kmalloc(sizeof(pc300_t), GFP_KERNEL); 3459 + card = kzalloc(sizeof(pc300_t), GFP_KERNEL); 3460 3460 if (card == NULL) { 3461 3461 printk("PC300 found at RAM 0x%016llx, " 3462 3462 "but could not allocate card structure.\n", ··· 3464 3464 err = -ENOMEM; 3465 3465 goto err_disable_dev; 3466 3466 } 3467 - memset(card, 0, sizeof(pc300_t)); 3468 3467 3469 3468 err = -ENODEV; 3470 3469
+1 -2
drivers/net/wan/pc300too.c
··· 334 334 return i; 335 335 } 336 336 337 - card = kmalloc(sizeof(card_t), GFP_KERNEL); 337 + card = kzalloc(sizeof(card_t), GFP_KERNEL); 338 338 if (card == NULL) { 339 339 printk(KERN_ERR "pc300: unable to allocate memory\n"); 340 340 pci_release_regions(pdev); 341 341 pci_disable_device(pdev); 342 342 return -ENOBUFS; 343 343 } 344 - memset(card, 0, sizeof(card_t)); 345 344 pci_set_drvdata(pdev, card); 346 345 347 346 if (pdev->device == PCI_DEVICE_ID_PC300_TE_1 ||
+1 -2
drivers/net/wan/pci200syn.c
··· 312 312 return i; 313 313 } 314 314 315 - card = kmalloc(sizeof(card_t), GFP_KERNEL); 315 + card = kzalloc(sizeof(card_t), GFP_KERNEL); 316 316 if (card == NULL) { 317 317 printk(KERN_ERR "pci200syn: unable to allocate memory\n"); 318 318 pci_release_regions(pdev); 319 319 pci_disable_device(pdev); 320 320 return -ENOBUFS; 321 321 } 322 - memset(card, 0, sizeof(card_t)); 323 322 pci_set_drvdata(pdev, card); 324 323 card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); 325 324 card->ports[1].dev = alloc_hdlcdev(&card->ports[1]);
+1 -2
drivers/net/wan/sdla.c
··· 1196 1196 1197 1197 if (read) 1198 1198 { 1199 - temp = kmalloc(mem.len, GFP_KERNEL); 1199 + temp = kzalloc(mem.len, GFP_KERNEL); 1200 1200 if (!temp) 1201 1201 return(-ENOMEM); 1202 - memset(temp, 0, mem.len); 1203 1202 sdla_read(dev, mem.addr, temp, mem.len); 1204 1203 if(copy_to_user(mem.data, temp, mem.len)) 1205 1204 {
+1 -2
drivers/net/wan/sealevel.c
··· 270 270 return NULL; 271 271 } 272 272 273 - b = kmalloc(sizeof(struct slvl_board), GFP_KERNEL); 273 + b = kzalloc(sizeof(struct slvl_board), GFP_KERNEL); 274 274 if(!b) 275 275 goto fail3; 276 276 277 - memset(b, 0, sizeof(*b)); 278 277 if (!(b->dev[0]= slvl_alloc(iobase, irq))) 279 278 goto fail2; 280 279
+1 -2
drivers/net/wan/wanxl.c
··· 599 599 } 600 600 601 601 alloc_size = sizeof(card_t) + ports * sizeof(port_t); 602 - card = kmalloc(alloc_size, GFP_KERNEL); 602 + card = kzalloc(alloc_size, GFP_KERNEL); 603 603 if (card == NULL) { 604 604 printk(KERN_ERR "wanXL %s: unable to allocate memory\n", 605 605 pci_name(pdev)); ··· 607 607 pci_disable_device(pdev); 608 608 return -ENOBUFS; 609 609 } 610 - memset(card, 0, alloc_size); 611 610 612 611 pci_set_drvdata(pdev, card); 613 612 card->pdev = pdev;
+1 -3
drivers/net/wan/x25_asy.c
··· 786 786 printk(KERN_INFO "X.25 async: version 0.00 ALPHA " 787 787 "(dynamic channels, max=%d).\n", x25_asy_maxdev ); 788 788 789 - x25_asy_devs = kmalloc(sizeof(struct net_device *)*x25_asy_maxdev, 790 - GFP_KERNEL); 789 + x25_asy_devs = kcalloc(x25_asy_maxdev, sizeof(struct net_device*), GFP_KERNEL); 791 790 if (!x25_asy_devs) { 792 791 printk(KERN_WARNING "X25 async: Can't allocate x25_asy_ctrls[] " 793 792 "array! Uaargh! (-> No X.25 available)\n"); 794 793 return -ENOMEM; 795 794 } 796 - memset(x25_asy_devs, 0, sizeof(struct net_device *)*x25_asy_maxdev); 797 795 798 796 return tty_register_ldisc(N_X25, &x25_ldisc); 799 797 }
+2 -4
drivers/nubus/nubus.c
··· 466 466 parent->base, dir.base); 467 467 468 468 /* Actually we should probably panic if this fails */ 469 - if ((dev = kmalloc(sizeof(*dev), GFP_ATOMIC)) == NULL) 469 + if ((dev = kzalloc(sizeof(*dev), GFP_ATOMIC)) == NULL) 470 470 return NULL; 471 - memset(dev, 0, sizeof(*dev)); 472 471 dev->resid = parent->type; 473 472 dev->directory = dir.base; 474 473 dev->board = board; ··· 799 800 nubus_rewind(&rp, FORMAT_BLOCK_SIZE, bytelanes); 800 801 801 802 /* Actually we should probably panic if this fails */ 802 - if ((board = kmalloc(sizeof(*board), GFP_ATOMIC)) == NULL) 803 + if ((board = kzalloc(sizeof(*board), GFP_ATOMIC)) == NULL) 803 804 return NULL; 804 - memset(board, 0, sizeof(*board)); 805 805 board->fblock = rp; 806 806 807 807 /* Dump the format block for debugging purposes */
+1 -2
drivers/parport/parport_cs.c
··· 105 105 DEBUG(0, "parport_attach()\n"); 106 106 107 107 /* Create new parport device */ 108 - info = kmalloc(sizeof(*info), GFP_KERNEL); 108 + info = kzalloc(sizeof(*info), GFP_KERNEL); 109 109 if (!info) return -ENOMEM; 110 - memset(info, 0, sizeof(*info)); 111 110 link->priv = info; 112 111 info->p_dev = link; 113 112
+1 -2
drivers/parport/parport_serial.c
··· 324 324 struct parport_serial_private *priv; 325 325 int err; 326 326 327 - priv = kmalloc (sizeof *priv, GFP_KERNEL); 327 + priv = kzalloc (sizeof *priv, GFP_KERNEL); 328 328 if (!priv) 329 329 return -ENOMEM; 330 - memset(priv, 0, sizeof(struct parport_serial_private)); 331 330 pci_set_drvdata (dev, priv); 332 331 333 332 err = pci_enable_device (dev);
+1 -2
drivers/pci/pcie/aer/aerdrv.c
··· 148 148 { 149 149 struct aer_rpc *rpc; 150 150 151 - if (!(rpc = kmalloc(sizeof(struct aer_rpc), 151 + if (!(rpc = kzalloc(sizeof(struct aer_rpc), 152 152 GFP_KERNEL))) 153 153 return NULL; 154 154 155 - memset(rpc, 0, sizeof(struct aer_rpc)); 156 155 /* 157 156 * Initialize Root lock access, e_lock, to Root Error Status Reg, 158 157 * Root Error ID Reg, and Root error producer/consumer index.
+1 -2
drivers/pnp/core.c
··· 35 35 { 36 36 void *result; 37 37 38 - result = kmalloc(size, GFP_KERNEL); 38 + result = kzalloc(size, GFP_KERNEL); 39 39 if (!result){ 40 40 printk(KERN_ERR "pnp: Out of Memory\n"); 41 41 return NULL; 42 42 } 43 - memset(result, 0, size); 44 43 return result; 45 44 } 46 45
+2 -4
drivers/rapidio/rio-scan.c
··· 297 297 struct rio_switch *rswitch; 298 298 int result, rdid; 299 299 300 - rdev = kmalloc(sizeof(struct rio_dev), GFP_KERNEL); 300 + rdev = kzalloc(sizeof(struct rio_dev), GFP_KERNEL); 301 301 if (!rdev) 302 302 goto out; 303 303 304 - memset(rdev, 0, sizeof(struct rio_dev)); 305 304 rdev->net = net; 306 305 rio_mport_read_config_32(port, destid, hopcount, RIO_DEV_ID_CAR, 307 306 &result); ··· 800 801 { 801 802 struct rio_net *net; 802 803 803 - net = kmalloc(sizeof(struct rio_net), GFP_KERNEL); 804 + net = kzalloc(sizeof(struct rio_net), GFP_KERNEL); 804 805 if (net) { 805 - memset(net, 0, sizeof(struct rio_net)); 806 806 INIT_LIST_HEAD(&net->node); 807 807 INIT_LIST_HEAD(&net->devices); 808 808 INIT_LIST_HEAD(&net->mports);
+1 -2
drivers/s390/char/tape_34xx.c
··· 131 131 { 132 132 struct tape_34xx_work *p; 133 133 134 - if ((p = kmalloc(sizeof(*p), GFP_ATOMIC)) == NULL) 134 + if ((p = kzalloc(sizeof(*p), GFP_ATOMIC)) == NULL) 135 135 return -ENOMEM; 136 136 137 - memset(p, 0, sizeof(*p)); 138 137 INIT_WORK(&p->work, tape_34xx_work_handler); 139 138 140 139 p->device = tape_get_device_reference(device);
+3 -6
drivers/s390/net/claw.c
··· 317 317 CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); 318 318 return -ENOMEM; 319 319 } 320 - privptr->p_mtc_envelope= kmalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); 321 - privptr->p_env = kmalloc(sizeof(struct claw_env), GFP_KERNEL); 320 + privptr->p_mtc_envelope= kzalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); 321 + privptr->p_env = kzalloc(sizeof(struct claw_env), GFP_KERNEL); 322 322 if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { 323 323 probe_error(cgdev); 324 324 put_device(&cgdev->dev); ··· 327 327 CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); 328 328 return -ENOMEM; 329 329 } 330 - memset(privptr->p_mtc_envelope, 0x00, MAX_ENVELOPE_SIZE); 331 - memset(privptr->p_env, 0x00, sizeof(struct claw_env)); 332 330 memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8); 333 331 memcpy(privptr->p_env->host_name,WS_NAME_NOT_DEF,8); 334 332 memcpy(privptr->p_env->api_type,WS_NAME_NOT_DEF,8); ··· 3922 3924 snprintf(p_ch->id, CLAW_ID_SIZE, "cl-%s", cdev->dev.bus_id); 3923 3925 ccw_device_get_id(cdev, &dev_id); 3924 3926 p_ch->devno = dev_id.devno; 3925 - if ((p_ch->irb = kmalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { 3927 + if ((p_ch->irb = kzalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { 3926 3928 printk(KERN_WARNING "%s Out of memory in %s for irb\n", 3927 3929 p_ch->id,__FUNCTION__); 3928 3930 #ifdef FUNCTRACE ··· 3931 3933 #endif 3932 3934 return -ENOMEM; 3933 3935 } 3934 - memset(p_ch->irb, 0, sizeof (struct irb)); 3935 3936 #ifdef FUNCTRACE 3936 3937 printk(KERN_INFO "%s:%s Exit on line %d\n", 3937 3938 cdev->dev.bus_id,__FUNCTION__,__LINE__);
+1 -2
drivers/sbus/char/bbc_i2c.c
··· 156 156 157 157 if (!bp) 158 158 return NULL; 159 - client = kmalloc(sizeof(*client), GFP_KERNEL); 159 + client = kzalloc(sizeof(*client), GFP_KERNEL); 160 160 if (!client) 161 161 return NULL; 162 - memset(client, 0, sizeof(*client)); 163 162 client->bp = bp; 164 163 client->echild = echild; 165 164 client->bus = echild->resource[0].start;
+1 -4
drivers/sbus/char/vfc_dev.c
··· 656 656 if (!cards) 657 657 return -ENODEV; 658 658 659 - vfc_dev_lst = kmalloc(sizeof(struct vfc_dev *) * 660 - (cards+1), 661 - GFP_KERNEL); 659 + vfc_dev_lst = kcalloc(cards + 1, sizeof(struct vfc_dev*), GFP_KERNEL); 662 660 if (vfc_dev_lst == NULL) 663 661 return -ENOMEM; 664 - memset(vfc_dev_lst, 0, sizeof(struct vfc_dev *) * (cards + 1)); 665 662 vfc_dev_lst[cards] = NULL; 666 663 667 664 ret = register_chrdev(VFC_MAJOR, vfcstr, &vfc_fops);
+1 -2
drivers/scsi/3w-9xxx.c
··· 1160 1160 } 1161 1161 1162 1162 /* Allocate event info space */ 1163 - tw_dev->event_queue[0] = kmalloc(sizeof(TW_Event) * TW_Q_LENGTH, GFP_KERNEL); 1163 + tw_dev->event_queue[0] = kcalloc(TW_Q_LENGTH, sizeof(TW_Event), GFP_KERNEL); 1164 1164 if (!tw_dev->event_queue[0]) { 1165 1165 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x18, "Event info memory allocation failed"); 1166 1166 goto out; 1167 1167 } 1168 1168 1169 - memset(tw_dev->event_queue[0], 0, sizeof(TW_Event) * TW_Q_LENGTH); 1170 1169 1171 1170 for (i = 0; i < TW_Q_LENGTH; i++) { 1172 1171 tw_dev->event_queue[i] = (TW_Event *)((unsigned char *)tw_dev->event_queue[0] + (i * sizeof(TW_Event)));
+1 -2
drivers/scsi/NCR53C9x.c
··· 3606 3606 int esp_slave_alloc(struct scsi_device *SDptr) 3607 3607 { 3608 3608 struct esp_device *esp_dev = 3609 - kmalloc(sizeof(struct esp_device), GFP_ATOMIC); 3609 + kzalloc(sizeof(struct esp_device), GFP_ATOMIC); 3610 3610 3611 3611 if (!esp_dev) 3612 3612 return -ENOMEM; 3613 - memset(esp_dev, 0, sizeof(struct esp_device)); 3614 3613 SDptr->hostdata = esp_dev; 3615 3614 return 0; 3616 3615 }
+1 -2
drivers/scsi/NCR_D700.c
··· 181 181 struct Scsi_Host *host; 182 182 int ret; 183 183 184 - hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL); 184 + hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL); 185 185 if (!hostdata) { 186 186 printk(KERN_ERR "NCR D700: SIOP%d: Failed to allocate host" 187 187 "data, detatching\n", siop); 188 188 return -ENOMEM; 189 189 } 190 - memset(hostdata, 0, sizeof(*hostdata)); 191 190 192 191 if (!request_region(region, 64, "NCR_D700")) { 193 192 printk(KERN_ERR "NCR D700: Failed to reserve IO region 0x%x\n",
+1 -2
drivers/scsi/NCR_Q720.c
··· 148 148 __u32 base_addr, mem_size; 149 149 void __iomem *mem_base; 150 150 151 - p = kmalloc(sizeof(*p), GFP_KERNEL); 151 + p = kzalloc(sizeof(*p), GFP_KERNEL); 152 152 if (!p) 153 153 return -ENOMEM; 154 154 155 - memset(p, 0, sizeof(*p)); 156 155 pos2 = mca_device_read_pos(mca_dev, 2); 157 156 /* enable device */ 158 157 pos2 |= NCR_Q720_POS2_BOARD_ENABLE | NCR_Q720_POS2_INTERRUPT_ENABLE;
+1 -2
drivers/scsi/imm.c
··· 1159 1159 1160 1160 init_waitqueue_head(&waiting); 1161 1161 1162 - dev = kmalloc(sizeof(imm_struct), GFP_KERNEL); 1162 + dev = kzalloc(sizeof(imm_struct), GFP_KERNEL); 1163 1163 if (!dev) 1164 1164 return -ENOMEM; 1165 1165 1166 - memset(dev, 0, sizeof(imm_struct)); 1167 1166 1168 1167 dev->base = -1; 1169 1168 dev->mode = IMM_AUTODETECT;
+1 -2
drivers/scsi/ips.c
··· 7068 7068 subdevice_id = pci_dev->subsystem_device; 7069 7069 7070 7070 /* found a controller */ 7071 - ha = kmalloc(sizeof (ips_ha_t), GFP_KERNEL); 7071 + ha = kzalloc(sizeof (ips_ha_t), GFP_KERNEL); 7072 7072 if (ha == NULL) { 7073 7073 IPS_PRINTK(KERN_WARNING, pci_dev, 7074 7074 "Unable to allocate temporary ha struct\n"); 7075 7075 return -1; 7076 7076 } 7077 7077 7078 - memset(ha, 0, sizeof (ips_ha_t)); 7079 7078 7080 7079 ips_sh[index] = NULL; 7081 7080 ips_ha[index] = ha;
+1 -2
drivers/scsi/lasi700.c
··· 101 101 struct NCR_700_Host_Parameters *hostdata; 102 102 struct Scsi_Host *host; 103 103 104 - hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL); 104 + hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL); 105 105 if (!hostdata) { 106 106 printk(KERN_ERR "%s: Failed to allocate host data\n", 107 107 dev->dev.bus_id); 108 108 return -ENOMEM; 109 109 } 110 - memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); 111 110 112 111 hostdata->dev = &dev->dev; 113 112 dma_set_mask(&dev->dev, DMA_32BIT_MASK);
+1 -2
drivers/scsi/lpfc/lpfc_init.c
··· 1830 1830 /* Initialize and populate the iocb list per host. */ 1831 1831 INIT_LIST_HEAD(&phba->lpfc_iocb_list); 1832 1832 for (i = 0; i < LPFC_IOCB_LIST_CNT; i++) { 1833 - iocbq_entry = kmalloc(sizeof(struct lpfc_iocbq), GFP_KERNEL); 1833 + iocbq_entry = kzalloc(sizeof(struct lpfc_iocbq), GFP_KERNEL); 1834 1834 if (iocbq_entry == NULL) { 1835 1835 printk(KERN_ERR "%s: only allocated %d iocbs of " 1836 1836 "expected %d count. Unloading driver.\n", ··· 1839 1839 goto out_free_iocbq; 1840 1840 } 1841 1841 1842 - memset(iocbq_entry, 0, sizeof(struct lpfc_iocbq)); 1843 1842 iotag = lpfc_sli_next_iotag(phba, iocbq_entry); 1844 1843 if (iotag == 0) { 1845 1844 kfree (iocbq_entry);
+4 -10
drivers/scsi/megaraid/megaraid_mbox.c
··· 454 454 pci_set_master(pdev); 455 455 456 456 // Allocate the per driver initialization structure 457 - adapter = kmalloc(sizeof(adapter_t), GFP_KERNEL); 457 + adapter = kzalloc(sizeof(adapter_t), GFP_KERNEL); 458 458 459 459 if (adapter == NULL) { 460 460 con_log(CL_ANN, (KERN_WARNING ··· 462 462 463 463 goto out_probe_one; 464 464 } 465 - memset(adapter, 0, sizeof(adapter_t)); 466 465 467 466 468 467 // set up PCI related soft state and other pre-known parameters ··· 745 746 * Allocate and initialize the init data structure for mailbox 746 747 * controllers 747 748 */ 748 - raid_dev = kmalloc(sizeof(mraid_device_t), GFP_KERNEL); 749 + raid_dev = kzalloc(sizeof(mraid_device_t), GFP_KERNEL); 749 750 if (raid_dev == NULL) return -1; 750 751 751 - memset(raid_dev, 0, sizeof(mraid_device_t)); 752 752 753 753 /* 754 754 * Attach the adapter soft state to raid device soft state ··· 1048 1050 * since the calling routine does not yet know the number of available 1049 1051 * commands. 1050 1052 */ 1051 - adapter->kscb_list = kmalloc(sizeof(scb_t) * MBOX_MAX_SCSI_CMDS, 1052 - GFP_KERNEL); 1053 + adapter->kscb_list = kcalloc(MBOX_MAX_SCSI_CMDS, sizeof(scb_t), GFP_KERNEL); 1053 1054 1054 1055 if (adapter->kscb_list == NULL) { 1055 1056 con_log(CL_ANN, (KERN_WARNING ··· 1056 1059 __LINE__)); 1057 1060 goto out_free_ibuf; 1058 1061 } 1059 - memset(adapter->kscb_list, 0, sizeof(scb_t) * MBOX_MAX_SCSI_CMDS); 1060 1062 1061 1063 // memory allocation for our command packets 1062 1064 if (megaraid_mbox_setup_dma_pools(adapter) != 0) { ··· 3491 3495 int i; 3492 3496 3493 3497 // Allocate memory for the base list of scb for management module. 3494 - adapter->uscb_list = kmalloc(sizeof(scb_t) * MBOX_MAX_USER_CMDS, 3495 - GFP_KERNEL); 3498 + adapter->uscb_list = kcalloc(MBOX_MAX_USER_CMDS, sizeof(scb_t), GFP_KERNEL); 3496 3499 3497 3500 if (adapter->uscb_list == NULL) { 3498 3501 con_log(CL_ANN, (KERN_WARNING ··· 3499 3504 __LINE__)); 3500 3505 return -1; 3501 3506 } 3502 - memset(adapter->uscb_list, 0, sizeof(scb_t) * MBOX_MAX_USER_CMDS); 3503 3507 3504 3508 3505 3509 // Initialize the synchronization parameters for resources for
+1 -2
drivers/scsi/megaraid/megaraid_mm.c
··· 890 890 if (lld_adp->drvr_type != DRVRTYPE_MBOX) 891 891 return (-EINVAL); 892 892 893 - adapter = kmalloc(sizeof(mraid_mmadp_t), GFP_KERNEL); 893 + adapter = kzalloc(sizeof(mraid_mmadp_t), GFP_KERNEL); 894 894 895 895 if (!adapter) 896 896 return -ENOMEM; 897 897 898 - memset(adapter, 0, sizeof(mraid_mmadp_t)); 899 898 900 899 adapter->unique_id = lld_adp->unique_id; 901 900 adapter->drvr_type = lld_adp->drvr_type;
+1 -3
drivers/scsi/megaraid/megaraid_sas.c
··· 1636 1636 * Allocate the dynamic array first and then allocate individual 1637 1637 * commands. 1638 1638 */ 1639 - instance->cmd_list = kmalloc(sizeof(struct megasas_cmd *) * max_cmd, 1640 - GFP_KERNEL); 1639 + instance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL); 1641 1640 1642 1641 if (!instance->cmd_list) { 1643 1642 printk(KERN_DEBUG "megasas: out of memory\n"); 1644 1643 return -ENOMEM; 1645 1644 } 1646 1645 1647 - memset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) * max_cmd); 1648 1646 1649 1647 for (i = 0; i < max_cmd; i++) { 1650 1648 instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),
+1 -2
drivers/scsi/pcmcia/aha152x_stub.c
··· 106 106 DEBUG(0, "aha152x_attach()\n"); 107 107 108 108 /* Create new SCSI device */ 109 - info = kmalloc(sizeof(*info), GFP_KERNEL); 109 + info = kzalloc(sizeof(*info), GFP_KERNEL); 110 110 if (!info) return -ENOMEM; 111 - memset(info, 0, sizeof(*info)); 112 111 info->p_dev = link; 113 112 link->priv = info; 114 113
+1 -2
drivers/scsi/pcmcia/nsp_cs.c
··· 1602 1602 nsp_dbg(NSP_DEBUG_INIT, "in"); 1603 1603 1604 1604 /* Create new SCSI device */ 1605 - info = kmalloc(sizeof(*info), GFP_KERNEL); 1605 + info = kzalloc(sizeof(*info), GFP_KERNEL); 1606 1606 if (info == NULL) { return -ENOMEM; } 1607 - memset(info, 0, sizeof(*info)); 1608 1607 info->p_dev = link; 1609 1608 link->priv = info; 1610 1609 data->ScsiInfo = info;
+1 -2
drivers/scsi/pcmcia/qlogic_stub.c
··· 162 162 DEBUG(0, "qlogic_attach()\n"); 163 163 164 164 /* Create new SCSI device */ 165 - info = kmalloc(sizeof(*info), GFP_KERNEL); 165 + info = kzalloc(sizeof(*info), GFP_KERNEL); 166 166 if (!info) 167 167 return -ENOMEM; 168 - memset(info, 0, sizeof(*info)); 169 168 info->p_dev = link; 170 169 link->priv = info; 171 170 link->io.NumPorts1 = 16;
+1 -2
drivers/scsi/pcmcia/sym53c500_cs.c
··· 875 875 DEBUG(0, "SYM53C500_attach()\n"); 876 876 877 877 /* Create new SCSI device */ 878 - info = kmalloc(sizeof(*info), GFP_KERNEL); 878 + info = kzalloc(sizeof(*info), GFP_KERNEL); 879 879 if (!info) 880 880 return -ENOMEM; 881 - memset(info, 0, sizeof(*info)); 882 881 info->p_dev = link; 883 882 link->priv = info; 884 883 link->io.NumPorts1 = 16;
+1 -2
drivers/scsi/ppa.c
··· 1014 1014 int modes, ppb, ppb_hi; 1015 1015 int err = -ENOMEM; 1016 1016 1017 - dev = kmalloc(sizeof(ppa_struct), GFP_KERNEL); 1017 + dev = kzalloc(sizeof(ppa_struct), GFP_KERNEL); 1018 1018 if (!dev) 1019 1019 return -ENOMEM; 1020 - memset(dev, 0, sizeof(ppa_struct)); 1021 1020 dev->base = -1; 1022 1021 dev->mode = PPA_AUTODETECT; 1023 1022 dev->recon_tmo = PPA_RECON_TMO;
+1 -2
drivers/scsi/sim710.c
··· 100 100 { 101 101 struct Scsi_Host * host = NULL; 102 102 struct NCR_700_Host_Parameters *hostdata = 103 - kmalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); 103 + kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL); 104 104 105 105 printk(KERN_NOTICE "sim710: %s\n", dev->bus_id); 106 106 printk(KERN_NOTICE "sim710: irq = %d, clock = %d, base = 0x%lx, scsi_id = %d\n", ··· 110 110 printk(KERN_ERR "sim710: Failed to allocate host data\n"); 111 111 goto out; 112 112 } 113 - memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters)); 114 113 115 114 if(request_region(base_addr, 64, "sim710") == NULL) { 116 115 printk(KERN_ERR "sim710: Failed to reserve IO region 0x%lx\n",
+1 -2
drivers/scsi/tmscsim.c
··· 2082 2082 uint id = scsi_device->id; 2083 2083 uint lun = scsi_device->lun; 2084 2084 2085 - pDCB = kmalloc(sizeof(struct dc390_dcb), GFP_KERNEL); 2085 + pDCB = kzalloc(sizeof(struct dc390_dcb), GFP_KERNEL); 2086 2086 if (!pDCB) 2087 2087 return -ENOMEM; 2088 - memset(pDCB, 0, sizeof(struct dc390_dcb)); 2089 2088 2090 2089 if (!pACB->DCBCnt++) { 2091 2090 pACB->pLinkDCB = pDCB;
+1 -2
drivers/serial/amba-pl011.c
··· 716 716 goto out; 717 717 } 718 718 719 - uap = kmalloc(sizeof(struct uart_amba_port), GFP_KERNEL); 719 + uap = kzalloc(sizeof(struct uart_amba_port), GFP_KERNEL); 720 720 if (uap == NULL) { 721 721 ret = -ENOMEM; 722 722 goto out; ··· 728 728 goto free; 729 729 } 730 730 731 - memset(uap, 0, sizeof(struct uart_amba_port)); 732 731 uap->clk = clk_get(&dev->dev, "UARTCLK"); 733 732 if (IS_ERR(uap->clk)) { 734 733 ret = PTR_ERR(uap->clk);
+1 -2
drivers/sh/superhyway/superhyway.c
··· 56 56 struct superhyway_device *dev = sdev; 57 57 58 58 if (!dev) { 59 - dev = kmalloc(sizeof(struct superhyway_device), GFP_KERNEL); 59 + dev = kzalloc(sizeof(struct superhyway_device), GFP_KERNEL); 60 60 if (!dev) 61 61 return -ENOMEM; 62 62 63 - memset(dev, 0, sizeof(struct superhyway_device)); 64 63 } 65 64 66 65 dev->bus = bus;
+1 -2
drivers/sn/ioc3.c
··· 629 629 #endif 630 630 631 631 /* Set up per-IOC3 data */ 632 - idd = kmalloc(sizeof(struct ioc3_driver_data), GFP_KERNEL); 632 + idd = kzalloc(sizeof(struct ioc3_driver_data), GFP_KERNEL); 633 633 if (!idd) { 634 634 printk(KERN_WARNING 635 635 "%s: Failed to allocate IOC3 data for pci_dev %s.\n", ··· 637 637 ret = -ENODEV; 638 638 goto out_idd; 639 639 } 640 - memset(idd, 0, sizeof(struct ioc3_driver_data)); 641 640 spin_lock_init(&idd->ir_lock); 642 641 spin_lock_init(&idd->gpio_lock); 643 642 idd->pdev = pdev;
+1 -2
drivers/telephony/ixj_pcmcia.c
··· 45 45 p_dev->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 46 46 p_dev->io.IOAddrLines = 3; 47 47 p_dev->conf.IntType = INT_MEMORY_AND_IO; 48 - p_dev->priv = kmalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 48 + p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); 49 49 if (!p_dev->priv) { 50 50 return -ENOMEM; 51 51 } 52 - memset(p_dev->priv, 0, sizeof(struct ixj_info_t)); 53 52 54 53 return ixj_config(p_dev); 55 54 }
+1 -2
drivers/usb/gadget/goku_udc.c
··· 1777 1777 } 1778 1778 1779 1779 /* alloc, and start init */ 1780 - dev = kmalloc (sizeof *dev, GFP_KERNEL); 1780 + dev = kzalloc (sizeof *dev, GFP_KERNEL); 1781 1781 if (dev == NULL){ 1782 1782 pr_debug("enomem %s\n", pci_name(pdev)); 1783 1783 retval = -ENOMEM; 1784 1784 goto done; 1785 1785 } 1786 1786 1787 - memset(dev, 0, sizeof *dev); 1788 1787 spin_lock_init(&dev->lock); 1789 1788 dev->pdev = pdev; 1790 1789 dev->gadget.ops = &goku_ops;
+1 -2
drivers/usb/gadget/serial.c
··· 1427 1427 gs_acm_config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP; 1428 1428 } 1429 1429 1430 - gs_device = dev = kmalloc(sizeof(struct gs_dev), GFP_KERNEL); 1430 + gs_device = dev = kzalloc(sizeof(struct gs_dev), GFP_KERNEL); 1431 1431 if (dev == NULL) 1432 1432 return -ENOMEM; 1433 1433 ··· 1435 1435 init_utsname()->sysname, init_utsname()->release, 1436 1436 gadget->name); 1437 1437 1438 - memset(dev, 0, sizeof(struct gs_dev)); 1439 1438 dev->dev_gadget = gadget; 1440 1439 spin_lock_init(&dev->dev_lock); 1441 1440 INIT_LIST_HEAD(&dev->dev_req_list);
+1 -2
drivers/usb/host/ohci-hcd.c
··· 171 171 } 172 172 173 173 /* allocate the private part of the URB */ 174 - urb_priv = kmalloc (sizeof (urb_priv_t) + size * sizeof (struct td *), 174 + urb_priv = kzalloc (sizeof (urb_priv_t) + size * sizeof (struct td *), 175 175 mem_flags); 176 176 if (!urb_priv) 177 177 return -ENOMEM; 178 - memset (urb_priv, 0, sizeof (urb_priv_t) + size * sizeof (struct td *)); 179 178 INIT_LIST_HEAD (&urb_priv->pending); 180 179 urb_priv->length = size; 181 180 urb_priv->ed = ed;
+1 -2
drivers/usb/host/sl811_cs.c
··· 278 278 { 279 279 local_info_t *local; 280 280 281 - local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 281 + local = kzalloc(sizeof(local_info_t), GFP_KERNEL); 282 282 if (!local) 283 283 return -ENOMEM; 284 - memset(local, 0, sizeof(local_info_t)); 285 284 local->p_dev = link; 286 285 link->priv = local; 287 286
+1 -2
drivers/video/amba-clcd.c
··· 447 447 goto out; 448 448 } 449 449 450 - fb = kmalloc(sizeof(struct clcd_fb), GFP_KERNEL); 450 + fb = kzalloc(sizeof(struct clcd_fb), GFP_KERNEL); 451 451 if (!fb) { 452 452 printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n"); 453 453 ret = -ENOMEM; 454 454 goto free_region; 455 455 } 456 - memset(fb, 0, sizeof(struct clcd_fb)); 457 456 458 457 fb->dev = dev; 459 458 fb->board = board;
+1 -2
drivers/video/aty/atyfb_base.c
··· 2937 2937 /* nothing */ ; 2938 2938 j = i + 4; 2939 2939 2940 - par->mmap_map = kmalloc(j * sizeof(*par->mmap_map), GFP_ATOMIC); 2940 + par->mmap_map = kcalloc(j, sizeof(*par->mmap_map), GFP_ATOMIC); 2941 2941 if (!par->mmap_map) { 2942 2942 PRINTKE("atyfb_setup_sparc() can't alloc mmap_map\n"); 2943 2943 return -ENOMEM; 2944 2944 } 2945 - memset(par->mmap_map, 0, j * sizeof(*par->mmap_map)); 2946 2945 2947 2946 for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) { 2948 2947 struct resource *rp = &pdev->resource[i];
+1 -2
drivers/video/au1200fb.c
··· 1589 1589 return -EFAULT; 1590 1590 } 1591 1591 1592 - fbi->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); 1592 + fbi->pseudo_palette = kcalloc(16, sizeof(u32), GFP_KERNEL); 1593 1593 if (!fbi->pseudo_palette) { 1594 1594 return -ENOMEM; 1595 1595 } 1596 - memset(fbi->pseudo_palette, 0, sizeof(u32) * 16); 1597 1596 1598 1597 if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { 1599 1598 print_err("Fail to allocate colormap (%d entries)",
+1 -2
drivers/video/clps711xfb.c
··· 366 366 if (fb_get_options("clps711xfb", NULL)) 367 367 return -ENODEV; 368 368 369 - cfb = kmalloc(sizeof(*cfb), GFP_KERNEL); 369 + cfb = kzalloc(sizeof(*cfb), GFP_KERNEL); 370 370 if (!cfb) 371 371 goto out; 372 372 373 - memset(cfb, 0, sizeof(*cfb)); 374 373 strcpy(cfb->fix.id, "clps711x"); 375 374 376 375 cfb->fbops = &clps7111fb_ops;
+1 -2
drivers/video/cyber2000fb.c
··· 1221 1221 { 1222 1222 struct cfb_info *cfb; 1223 1223 1224 - cfb = kmalloc(sizeof(struct cfb_info), GFP_KERNEL); 1224 + cfb = kzalloc(sizeof(struct cfb_info), GFP_KERNEL); 1225 1225 if (!cfb) 1226 1226 return NULL; 1227 1227 1228 - memset(cfb, 0, sizeof(struct cfb_info)); 1229 1228 1230 1229 cfb->id = id; 1231 1230
+1 -2
drivers/video/pvr2fb.c
··· 1082 1082 #endif 1083 1083 size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32); 1084 1084 1085 - fb_info = kmalloc(size, GFP_KERNEL); 1085 + fb_info = kzalloc(size, GFP_KERNEL); 1086 1086 if (!fb_info) { 1087 1087 printk(KERN_ERR "Failed to allocate memory for fb_info\n"); 1088 1088 return -ENOMEM; 1089 1089 } 1090 1090 1091 - memset(fb_info, 0, size); 1092 1091 1093 1092 currentpar = (struct pvr2fb_par *)(fb_info + 1); 1094 1093
+1 -2
drivers/video/savage/savagefb_driver.c
··· 2174 2174 2175 2175 #if defined(CONFIG_FB_SAVAGE_ACCEL) 2176 2176 /* FIFO size + padding for commands */ 2177 - info->pixmap.addr = kmalloc(8*1024, GFP_KERNEL); 2177 + info->pixmap.addr = kcalloc(8, 1024, GFP_KERNEL); 2178 2178 2179 2179 err = -ENOMEM; 2180 2180 if (info->pixmap.addr) { 2181 - memset(info->pixmap.addr, 0, 8*1024); 2182 2181 info->pixmap.size = 8*1024; 2183 2182 info->pixmap.scan_align = 4; 2184 2183 info->pixmap.buf_align = 4;
+1 -2
drivers/video/valkyriefb.c
··· 356 356 } 357 357 #endif /* ppc (!CONFIG_MAC) */ 358 358 359 - p = kmalloc(sizeof(*p), GFP_ATOMIC); 359 + p = kzalloc(sizeof(*p), GFP_ATOMIC); 360 360 if (p == 0) 361 361 return -ENOMEM; 362 - memset(p, 0, sizeof(*p)); 363 362 364 363 /* Map in frame buffer and registers */ 365 364 if (!request_mem_region(frame_buffer_phys, 0x100000, "valkyriefb")) {
+1 -2
drivers/w1/masters/matrox_w1.c
··· 164 164 if (pdev->vendor != PCI_VENDOR_ID_MATROX || pdev->device != PCI_DEVICE_ID_MATROX_G400) 165 165 return -ENODEV; 166 166 167 - dev = kmalloc(sizeof(struct matrox_device) + 167 + dev = kzalloc(sizeof(struct matrox_device) + 168 168 sizeof(struct w1_bus_master), GFP_KERNEL); 169 169 if (!dev) { 170 170 dev_err(&pdev->dev, ··· 173 173 return -ENOMEM; 174 174 } 175 175 176 - memset(dev, 0, sizeof(struct matrox_device) + sizeof(struct w1_bus_master)); 177 176 178 177 dev->bus_master = (struct w1_bus_master *)(dev + 1); 179 178
+1 -2
drivers/w1/slaves/w1_ds2433.c
··· 266 266 #ifdef CONFIG_W1_SLAVE_DS2433_CRC 267 267 struct w1_f23_data *data; 268 268 269 - data = kmalloc(sizeof(struct w1_f23_data), GFP_KERNEL); 269 + data = kzalloc(sizeof(struct w1_f23_data), GFP_KERNEL); 270 270 if (!data) 271 271 return -ENOMEM; 272 - memset(data, 0, sizeof(struct w1_f23_data)); 273 272 sl->family_data = data; 274 273 275 274 #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
+1 -2
drivers/w1/w1.c
··· 520 520 int err; 521 521 struct w1_netlink_msg msg; 522 522 523 - sl = kmalloc(sizeof(struct w1_slave), GFP_KERNEL); 523 + sl = kzalloc(sizeof(struct w1_slave), GFP_KERNEL); 524 524 if (!sl) { 525 525 dev_err(&dev->dev, 526 526 "%s: failed to allocate new slave device.\n", ··· 528 528 return -ENOMEM; 529 529 } 530 530 531 - memset(sl, 0, sizeof(*sl)); 532 531 533 532 sl->owner = THIS_MODULE; 534 533 sl->master = dev;
+1 -2
drivers/w1/w1_int.c
··· 41 41 /* 42 42 * We are in process context(kernel thread), so can sleep. 43 43 */ 44 - dev = kmalloc(sizeof(struct w1_master) + sizeof(struct w1_bus_master), GFP_KERNEL); 44 + dev = kzalloc(sizeof(struct w1_master) + sizeof(struct w1_bus_master), GFP_KERNEL); 45 45 if (!dev) { 46 46 printk(KERN_ERR 47 47 "Failed to allocate %zd bytes for new w1 device.\n", ··· 49 49 return NULL; 50 50 } 51 51 52 - memset(dev, 0, sizeof(struct w1_master) + sizeof(struct w1_bus_master)); 53 52 54 53 dev->bus_master = (struct w1_bus_master *)(dev + 1); 55 54
+3 -9
fs/dlm/memory.c
··· 39 39 { 40 40 char *p; 41 41 42 - p = kmalloc(ls->ls_lvblen, GFP_KERNEL); 43 - if (p) 44 - memset(p, 0, ls->ls_lvblen); 42 + p = kzalloc(ls->ls_lvblen, GFP_KERNEL); 45 43 return p; 46 44 } 47 45 ··· 57 59 58 60 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); 59 61 60 - r = kmalloc(sizeof(*r) + namelen, GFP_KERNEL); 61 - if (r) 62 - memset(r, 0, sizeof(*r) + namelen); 62 + r = kzalloc(sizeof(*r) + namelen, GFP_KERNEL); 63 63 return r; 64 64 } 65 65 ··· 97 101 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN, 98 102 printk("namelen = %d\n", namelen);); 99 103 100 - de = kmalloc(sizeof(*de) + namelen, GFP_KERNEL); 101 - if (de) 102 - memset(de, 0, sizeof(*de) + namelen); 104 + de = kzalloc(sizeof(*de) + namelen, GFP_KERNEL); 103 105 return de; 104 106 } 105 107
+1 -3
fs/ext2/super.c
··· 883 883 goto failed_mount; 884 884 } 885 885 bgl_lock_init(&sbi->s_blockgroup_lock); 886 - sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts), 887 - GFP_KERNEL); 886 + sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); 888 887 if (!sbi->s_debts) { 889 888 printk ("EXT2-fs: not enough memory\n"); 890 889 goto failed_mount_group_desc; 891 890 } 892 - memset(sbi->s_debts, 0, sbi->s_groups_count * sizeof(*sbi->s_debts)); 893 891 for (i = 0; i < db_count; i++) { 894 892 block = descriptor_loc(sb, logic_sb_block, i); 895 893 sbi->s_group_desc[i] = sb_bread(sb, block);
+1 -2
fs/partitions/check.c
··· 372 372 { 373 373 struct hd_struct *p; 374 374 375 - p = kmalloc(sizeof(*p), GFP_KERNEL); 375 + p = kzalloc(sizeof(*p), GFP_KERNEL); 376 376 if (!p) 377 377 return; 378 378 379 - memset(p, 0, sizeof(*p)); 380 379 p->start_sect = start; 381 380 p->nr_sects = len; 382 381 p->partno = part;
+1 -2
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
··· 177 177 struct ct_iter_state *st; 178 178 int ret; 179 179 180 - st = kmalloc(sizeof(struct ct_iter_state), GFP_KERNEL); 180 + st = kzalloc(sizeof(struct ct_iter_state), GFP_KERNEL); 181 181 if (st == NULL) 182 182 return -ENOMEM; 183 183 ret = seq_open(file, &ct_seq_ops); ··· 185 185 goto out_free; 186 186 seq = file->private_data; 187 187 seq->private = st; 188 - memset(st, 0, sizeof(struct ct_iter_state)); 189 188 return ret; 190 189 out_free: 191 190 kfree(st);
+1 -2
net/mac80211/ieee80211_rate.c
··· 24 24 { 25 25 struct rate_control_alg *alg; 26 26 27 - alg = kmalloc(sizeof(*alg), GFP_KERNEL); 27 + alg = kzalloc(sizeof(*alg), GFP_KERNEL); 28 28 if (alg == NULL) { 29 29 return -ENOMEM; 30 30 } 31 - memset(alg, 0, sizeof(*alg)); 32 31 alg->ops = ops; 33 32 34 33 mutex_lock(&rate_ctrl_mutex);
+1 -2
net/mac80211/ieee80211_sta.c
··· 1327 1327 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1328 1328 struct ieee80211_sta_bss *bss; 1329 1329 1330 - bss = kmalloc(sizeof(*bss), GFP_ATOMIC); 1330 + bss = kzalloc(sizeof(*bss), GFP_ATOMIC); 1331 1331 if (!bss) 1332 1332 return NULL; 1333 - memset(bss, 0, sizeof(*bss)); 1334 1333 atomic_inc(&bss->users); 1335 1334 atomic_inc(&bss->users); 1336 1335 memcpy(bss->bssid, bssid, ETH_ALEN);
+1 -2
net/netfilter/nf_conntrack_standalone.c
··· 198 198 struct ct_iter_state *st; 199 199 int ret; 200 200 201 - st = kmalloc(sizeof(struct ct_iter_state), GFP_KERNEL); 201 + st = kzalloc(sizeof(struct ct_iter_state), GFP_KERNEL); 202 202 if (st == NULL) 203 203 return -ENOMEM; 204 204 ret = seq_open(file, &ct_seq_ops); ··· 206 206 goto out_free; 207 207 seq = file->private_data; 208 208 seq->private = st; 209 - memset(st, 0, sizeof(struct ct_iter_state)); 210 209 return ret; 211 210 out_free: 212 211 kfree(st);
+1 -2
net/tipc/name_table.c
··· 1052 1052 { 1053 1053 int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; 1054 1054 1055 - table.types = kmalloc(array_size, GFP_ATOMIC); 1055 + table.types = kzalloc(array_size, GFP_ATOMIC); 1056 1056 if (!table.types) 1057 1057 return -ENOMEM; 1058 1058 1059 1059 write_lock_bh(&tipc_nametbl_lock); 1060 - memset(table.types, 0, array_size); 1061 1060 table.local_publ_count = 0; 1062 1061 write_unlock_bh(&tipc_nametbl_lock); 1063 1062 return 0;
+1 -2
sound/core/seq/seq_virmidi.c
··· 363 363 if (rdev->client >= 0) 364 364 return 0; 365 365 366 - pinfo = kmalloc(sizeof(*pinfo), GFP_KERNEL); 366 + pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL); 367 367 if (!pinfo) { 368 368 err = -ENOMEM; 369 369 goto __error; ··· 380 380 rdev->client = client; 381 381 382 382 /* create a port */ 383 - memset(pinfo, 0, sizeof(*pinfo)); 384 383 pinfo->addr.client = client; 385 384 sprintf(pinfo->name, "VirMIDI %d-%d", rdev->card->number, rdev->device); 386 385 /* set all capabilities */