[PATCH] getting rid of all casts of k[cmz]alloc() calls

Run this:

#!/bin/sh
for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
echo "De-casting $f..."
perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
done

And then go through and reinstate those cases where code is casting pointers
to non-pointers.

And then drop a few hunks which conflicted with outstanding work.

Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Greg KH <greg@kroah.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Karsten Keil <kkeil@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Steven French <sfrench@us.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Robert P. J. Day and committed by Linus Torvalds 5cbded58 0743b868

+250 -250
+1 -1
arch/arm/kernel/apm.c
··· 423 { 424 struct apm_user *as; 425 426 - as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL); 427 if (as) { 428 /* 429 * XXX - this is a tiny bit broken, when we consider BSD
··· 423 { 424 struct apm_user *as; 425 426 + as = kzalloc(sizeof(*as), GFP_KERNEL); 427 if (as) { 428 /* 429 * XXX - this is a tiny bit broken, when we consider BSD
+1 -1
arch/arm/kernel/ecard.c
··· 353 } 354 if (c_id(&excd) == 0x80) { /* loader */ 355 if (!ec->loader) { 356 - ec->loader = (loader_t)kmalloc(c_len(&excd), 357 GFP_KERNEL); 358 if (ec->loader) 359 ecard_readbytes(ec->loader, ec,
··· 353 } 354 if (c_id(&excd) == 0x80) { /* loader */ 355 if (!ec->loader) { 356 + ec->loader = kmalloc(c_len(&excd), 357 GFP_KERNEL); 358 if (ec->loader) 359 ecard_readbytes(ec->loader, ec,
+1 -1
arch/arm26/kernel/ecard.c
··· 215 } 216 if (c_id(&excd) == 0x80) { /* loader */ 217 if (!ec->loader) { 218 - ec->loader = (loader_t)kmalloc(c_len(&excd), 219 GFP_KERNEL); 220 if (ec->loader) 221 ecard_readbytes(ec->loader, ec,
··· 215 } 216 if (c_id(&excd) == 0x80) { /* loader */ 217 if (!ec->loader) { 218 + ec->loader = kmalloc(c_len(&excd), 219 GFP_KERNEL); 220 if (ec->loader) 221 ecard_readbytes(ec->loader, ec,
+1 -1
arch/arm26/kernel/irq.c
··· 545 (irq_flags & IRQF_SHARED && !dev_id)) 546 return -EINVAL; 547 548 - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); 549 if (!action) 550 return -ENOMEM; 551
··· 545 (irq_flags & IRQF_SHARED && !dev_id)) 546 return -EINVAL; 547 548 + action = kmalloc(sizeof(struct irqaction), GFP_KERNEL); 549 if (!action) 550 return -ENOMEM; 551
+1 -1
arch/cris/arch-v10/drivers/axisflashmap.c
··· 516 #else 517 struct mtd_info *mtd_ram; 518 519 - mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info), 520 GFP_KERNEL); 521 if (!mtd_ram) { 522 panic("axisflashmap couldn't allocate memory for "
··· 516 #else 517 struct mtd_info *mtd_ram; 518 519 + mtd_ram = kmalloc(sizeof(struct mtd_info), 520 GFP_KERNEL); 521 if (!mtd_ram) { 522 panic("axisflashmap couldn't allocate memory for "
+1 -1
arch/cris/arch-v10/drivers/gpio.c
··· 440 if (p > GPIO_MINOR_LAST) 441 return -EINVAL; 442 443 - priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private), 444 GFP_KERNEL); 445 446 if (!priv)
··· 440 if (p > GPIO_MINOR_LAST) 441 return -EINVAL; 442 443 + priv = kmalloc(sizeof(struct gpio_private), 444 GFP_KERNEL); 445 446 if (!priv)
+1 -1
arch/cris/arch-v32/drivers/axisflashmap.c
··· 427 #else 428 struct mtd_info *mtd_ram; 429 430 - mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info), 431 GFP_KERNEL); 432 if (!mtd_ram) { 433 panic("axisflashmap couldn't allocate memory for "
··· 427 #else 428 struct mtd_info *mtd_ram; 429 430 + mtd_ram = kmalloc(sizeof(struct mtd_info), 431 GFP_KERNEL); 432 if (!mtd_ram) { 433 panic("axisflashmap couldn't allocate memory for "
+1 -1
arch/cris/arch-v32/drivers/gpio.c
··· 423 if (p > GPIO_MINOR_LAST) 424 return -EINVAL; 425 426 - priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private), 427 GFP_KERNEL); 428 429 if (!priv)
··· 423 if (p > GPIO_MINOR_LAST) 424 return -EINVAL; 425 426 + priv = kmalloc(sizeof(struct gpio_private), 427 GFP_KERNEL); 428 429 if (!priv)
+1 -1
arch/cris/arch-v32/kernel/signal.c
··· 686 int __init 687 cris_init_signal(void) 688 { 689 - u16* data = (u16*)kmalloc(PAGE_SIZE, GFP_KERNEL); 690 691 /* This is movu.w __NR_sigreturn, r9; break 13; */ 692 data[0] = 0x9c5f;
··· 686 int __init 687 cris_init_signal(void) 688 { 689 + u16* data = kmalloc(PAGE_SIZE, GFP_KERNEL); 690 691 /* This is movu.w __NR_sigreturn, r9; break 13; */ 692 data[0] = 0x9c5f;
+1 -1
arch/cris/kernel/profile.c
··· 59 __init init_cris_profile(void) 60 { 61 struct proc_dir_entry *entry; 62 - sample_buffer = (char*)kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL); 63 sample_buffer_pos = sample_buffer; 64 entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL); 65 if (entry) {
··· 59 __init init_cris_profile(void) 60 { 61 struct proc_dir_entry *entry; 62 + sample_buffer = kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL); 63 sample_buffer_pos = sample_buffer; 64 entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL); 65 if (entry) {
+1 -1
arch/h8300/kernel/ints.c
··· 141 return -EBUSY; 142 143 if (use_kmalloc) 144 - irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); 145 else { 146 /* use bootmem allocater */ 147 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
··· 141 return -EBUSY; 142 143 if (use_kmalloc) 144 + irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); 145 else { 146 /* use bootmem allocater */ 147 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
+1 -1
arch/h8300/platform/h8s/ints.c
··· 176 } 177 178 if (use_kmalloc) 179 - irq_handle = (irq_handler_t *)kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); 180 else { 181 /* use bootmem allocater */ 182 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
··· 176 } 177 178 if (use_kmalloc) 179 + irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); 180 else { 181 /* use bootmem allocater */ 182 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
+1 -1
arch/i386/kernel/apm.c
··· 1604 { 1605 struct apm_user * as; 1606 1607 - as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL); 1608 if (as == NULL) { 1609 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", 1610 sizeof(*as));
··· 1604 { 1605 struct apm_user * as; 1606 1607 + as = kmalloc(sizeof(*as), GFP_KERNEL); 1608 if (as == NULL) { 1609 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", 1610 sizeof(*as));
+1 -1
arch/ia64/sn/kernel/sn2/sn_hwperf.c
··· 189 int e; 190 191 for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) { 192 - if (!(p = (char *)kmalloc(sz, GFP_KERNEL))) 193 break; 194 e = ia64_sn_ioif_get_pci_topology(__pa(p), sz); 195 if (e == SALRET_OK)
··· 189 int e; 190 191 for (sz = PAGE_SIZE; sz < 16 * PAGE_SIZE; sz += PAGE_SIZE) { 192 + if (!(p = kmalloc(sz, GFP_KERNEL))) 193 break; 194 e = ia64_sn_ioif_get_pci_topology(__pa(p), sz); 195 if (e == SALRET_OK)
+1 -1
arch/m68k/mm/kmap.c
··· 59 unsigned long addr; 60 struct vm_struct **p, *tmp, *area; 61 62 - area = (struct vm_struct *)kmalloc(sizeof(*area), GFP_KERNEL); 63 if (!area) 64 return NULL; 65 addr = KMAP_START;
··· 59 unsigned long addr; 60 struct vm_struct **p, *tmp, *area; 61 62 + area = kmalloc(sizeof(*area), GFP_KERNEL); 63 if (!area) 64 return NULL; 65 addr = KMAP_START;
+1 -1
arch/mips/kernel/apm.c
··· 356 { 357 struct apm_user *as; 358 359 - as = (struct apm_user *)kzalloc(sizeof(*as), GFP_KERNEL); 360 if (as) { 361 /* 362 * XXX - this is a tiny bit broken, when we consider BSD
··· 356 { 357 struct apm_user *as; 358 359 + as = kzalloc(sizeof(*as), GFP_KERNEL); 360 if (as) { 361 /* 362 * XXX - this is a tiny bit broken, when we consider BSD
+1 -1
arch/parisc/hpux/sys_hpux.c
··· 475 printk(KERN_DEBUG "len of arg1 = %d\n", len); 476 if (len == 0) 477 return 0; 478 - fsname = (char *) kmalloc(len, GFP_KERNEL); 479 if ( !fsname ) { 480 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 481 return 0;
··· 475 printk(KERN_DEBUG "len of arg1 = %d\n", len); 476 if (len == 0) 477 return 0; 478 + fsname = kmalloc(len, GFP_KERNEL); 479 if ( !fsname ) { 480 printk(KERN_DEBUG "failed to kmalloc fsname\n"); 481 return 0;
+1 -1
arch/parisc/kernel/unwind.c
··· 343 struct pt_regs *r = &t->thread.regs; 344 struct pt_regs *r2; 345 346 - r2 = (struct pt_regs *)kmalloc(sizeof(struct pt_regs), GFP_KERNEL); 347 if (!r2) 348 return; 349 *r2 = *r;
··· 343 struct pt_regs *r = &t->thread.regs; 344 struct pt_regs *r2; 345 346 + r2 = kmalloc(sizeof(struct pt_regs), GFP_KERNEL); 347 if (!r2) 348 return; 349 *r2 = *r;
+2 -2
arch/powerpc/kernel/nvram_64.c
··· 505 return -ENODEV; 506 total_size = ppc_md.nvram_size(); 507 508 - header = (char *) kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL); 509 if (!header) { 510 printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n"); 511 return -ENOMEM; ··· 574 } 575 576 /* initialize our anchor for the nvram partition list */ 577 - nvram_part = (struct nvram_partition *) kmalloc(sizeof(struct nvram_partition), GFP_KERNEL); 578 if (!nvram_part) { 579 printk(KERN_ERR "nvram_init: Failed kmalloc\n"); 580 return -ENOMEM;
··· 505 return -ENODEV; 506 total_size = ppc_md.nvram_size(); 507 508 + header = kmalloc(NVRAM_HEADER_LEN, GFP_KERNEL); 509 if (!header) { 510 printk(KERN_ERR "nvram_scan_partitions: Failed kmalloc\n"); 511 return -ENOMEM; ··· 574 } 575 576 /* initialize our anchor for the nvram partition list */ 577 + nvram_part = kmalloc(sizeof(struct nvram_partition), GFP_KERNEL); 578 if (!nvram_part) { 579 printk(KERN_ERR "nvram_init: Failed kmalloc\n"); 580 return -ENOMEM;
+1 -1
arch/powerpc/kernel/pci_32.c
··· 670 struct pci_controller* hose; 671 struct property *map_prop; 672 673 - pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); 674 if (!pci_to_OF_bus_map) { 675 printk(KERN_ERR "Can't allocate OF bus map !\n"); 676 return;
··· 670 struct pci_controller* hose; 671 struct property *map_prop; 672 673 + pci_to_OF_bus_map = kmalloc(pci_bus_count, GFP_KERNEL); 674 if (!pci_to_OF_bus_map) { 675 printk(KERN_ERR "Can't allocate OF bus map !\n"); 676 return;
+3 -3
arch/powerpc/mm/imalloc.c
··· 138 struct vm_struct *vm2 = NULL; 139 struct vm_struct *new_vm = NULL; 140 141 - vm1 = (struct vm_struct *) kmalloc(sizeof(*vm1), GFP_KERNEL); 142 if (vm1 == NULL) { 143 printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); 144 return NULL; ··· 172 * uppermost remainder, and use existing parent one for the 173 * lower remainder of parent range 174 */ 175 - vm2 = (struct vm_struct *) kmalloc(sizeof(*vm2), GFP_KERNEL); 176 if (vm2 == NULL) { 177 printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); 178 kfree(vm1); ··· 206 break; 207 } 208 209 - area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL); 210 if (!area) 211 return NULL; 212 area->flags = 0;
··· 138 struct vm_struct *vm2 = NULL; 139 struct vm_struct *new_vm = NULL; 140 141 + vm1 = kmalloc(sizeof(*vm1), GFP_KERNEL); 142 if (vm1 == NULL) { 143 printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); 144 return NULL; ··· 172 * uppermost remainder, and use existing parent one for the 173 * lower remainder of parent range 174 */ 175 + vm2 = kmalloc(sizeof(*vm2), GFP_KERNEL); 176 if (vm2 == NULL) { 177 printk(KERN_ERR "%s() out of memory\n", __FUNCTION__); 178 kfree(vm1); ··· 206 break; 207 } 208 209 + area = kmalloc(sizeof(*area), GFP_KERNEL); 210 if (!area) 211 return NULL; 212 area->flags = 0;
+1 -1
arch/powerpc/platforms/pseries/eeh_cache.c
··· 153 return piar; 154 } 155 } 156 - piar = (struct pci_io_addr_range *)kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); 157 if (!piar) 158 return NULL; 159
··· 153 return piar; 154 } 155 } 156 + piar = kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); 157 if (!piar) 158 return NULL; 159
+2 -2
arch/ppc/8260_io/fcc_enet.c
··· 1892 /* Allocate space for the buffer descriptors from regular memory. 1893 * Initialize base addresses for the buffer descriptors. 1894 */ 1895 - cep->rx_bd_base = (cbd_t *)kmalloc(sizeof(cbd_t) * RX_RING_SIZE, 1896 GFP_KERNEL | GFP_DMA); 1897 ep->fen_genfcc.fcc_rbase = __pa(cep->rx_bd_base); 1898 - cep->tx_bd_base = (cbd_t *)kmalloc(sizeof(cbd_t) * TX_RING_SIZE, 1899 GFP_KERNEL | GFP_DMA); 1900 ep->fen_genfcc.fcc_tbase = __pa(cep->tx_bd_base); 1901
··· 1892 /* Allocate space for the buffer descriptors from regular memory. 1893 * Initialize base addresses for the buffer descriptors. 1894 */ 1895 + cep->rx_bd_base = kmalloc(sizeof(cbd_t) * RX_RING_SIZE, 1896 GFP_KERNEL | GFP_DMA); 1897 ep->fen_genfcc.fcc_rbase = __pa(cep->rx_bd_base); 1898 + cep->tx_bd_base = kmalloc(sizeof(cbd_t) * TX_RING_SIZE, 1899 GFP_KERNEL | GFP_DMA); 1900 ep->fen_genfcc.fcc_tbase = __pa(cep->tx_bd_base); 1901
+1 -1
arch/ppc/8xx_io/cs4218_tdm.c
··· 2601 /* Initialize beep stuff */ 2602 orig_mksound = kd_mksound; 2603 kd_mksound = cs_mksound; 2604 - beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); 2605 if (beep_buf == NULL) 2606 printk(KERN_WARNING "dmasound: no memory for " 2607 "beep buffer\n");
··· 2601 /* Initialize beep stuff */ 2602 orig_mksound = kd_mksound; 2603 kd_mksound = cs_mksound; 2604 + beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); 2605 if (beep_buf == NULL) 2606 printk(KERN_WARNING "dmasound: no memory for " 2607 "beep buffer\n");
+4 -4
arch/s390/kernel/debug.c
··· 191 debug_entry_t*** areas; 192 int i,j; 193 194 - areas = (debug_entry_t ***) kmalloc(nr_areas * 195 sizeof(debug_entry_t**), 196 GFP_KERNEL); 197 if (!areas) 198 goto fail_malloc_areas; 199 for (i = 0; i < nr_areas; i++) { 200 - areas[i] = (debug_entry_t**) kmalloc(pages_per_area * 201 sizeof(debug_entry_t*),GFP_KERNEL); 202 if (!areas[i]) { 203 goto fail_malloc_areas2; ··· 242 243 /* alloc everything */ 244 245 - rc = (debug_info_t*) kmalloc(sizeof(debug_info_t), GFP_KERNEL); 246 if(!rc) 247 goto fail_malloc_rc; 248 rc->active_entries = kcalloc(nr_areas, sizeof(int), GFP_KERNEL); ··· 634 rc = -ENOMEM; 635 goto out; 636 } 637 - p_info = (file_private_info_t *) kmalloc(sizeof(file_private_info_t), 638 GFP_KERNEL); 639 if(!p_info){ 640 if(debug_info_snapshot)
··· 191 debug_entry_t*** areas; 192 int i,j; 193 194 + areas = kmalloc(nr_areas * 195 sizeof(debug_entry_t**), 196 GFP_KERNEL); 197 if (!areas) 198 goto fail_malloc_areas; 199 for (i = 0; i < nr_areas; i++) { 200 + areas[i] = kmalloc(pages_per_area * 201 sizeof(debug_entry_t*),GFP_KERNEL); 202 if (!areas[i]) { 203 goto fail_malloc_areas2; ··· 242 243 /* alloc everything */ 244 245 + rc = kmalloc(sizeof(debug_info_t), GFP_KERNEL); 246 if(!rc) 247 goto fail_malloc_rc; 248 rc->active_entries = kcalloc(nr_areas, sizeof(int), GFP_KERNEL); ··· 634 rc = -ENOMEM; 635 goto out; 636 } 637 + p_info = kmalloc(sizeof(file_private_info_t), 638 GFP_KERNEL); 639 if(!p_info){ 640 if(debug_info_snapshot)
+1 -1
arch/s390/kernel/s390_ext.c
··· 37 ext_int_info_t *p; 38 int index; 39 40 - p = (ext_int_info_t *) kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC); 41 if (p == NULL) 42 return -ENOMEM; 43 p->code = code;
··· 37 ext_int_info_t *p; 38 int index; 39 40 + p = kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC); 41 if (p == NULL) 42 return -ENOMEM; 43 p->code = code;
+2 -2
arch/sparc/kernel/irq.c
··· 425 } 426 427 if (action == NULL) 428 - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), 429 GFP_ATOMIC); 430 431 if (!action) { ··· 528 } 529 530 if (action == NULL) 531 - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), 532 GFP_ATOMIC); 533 534 if (!action) {
··· 425 } 426 427 if (action == NULL) 428 + action = kmalloc(sizeof(struct irqaction), 429 GFP_ATOMIC); 430 431 if (!action) { ··· 528 } 529 530 if (action == NULL) 531 + action = kmalloc(sizeof(struct irqaction), 532 GFP_ATOMIC); 533 534 if (!action) {
+1 -1
arch/sparc/kernel/sun4d_irq.c
··· 327 } 328 329 if (action == NULL) 330 - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), 331 GFP_ATOMIC); 332 333 if (!action) {
··· 327 } 328 329 if (action == NULL) 330 + action = kmalloc(sizeof(struct irqaction), 331 GFP_ATOMIC); 332 333 if (!action) {
+2 -2
arch/sparc64/kernel/sys_sunos32.c
··· 1055 break; 1056 case 2: 1057 rval = -EFAULT; 1058 - kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, 1059 GFP_KERNEL); 1060 if (!kmbuf) 1061 break; ··· 1078 break; 1079 case 3: 1080 rval = -EFAULT; 1081 - kmbuf = (struct msgbuf *)kmalloc(sizeof(struct msgbuf) + arg3, 1082 GFP_KERNEL); 1083 if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2, 1084 kmbuf, arg3))
··· 1055 break; 1056 case 2: 1057 rval = -EFAULT; 1058 + kmbuf = kmalloc(sizeof(struct msgbuf) + arg3, 1059 GFP_KERNEL); 1060 if (!kmbuf) 1061 break; ··· 1078 break; 1079 case 3: 1080 rval = -EFAULT; 1081 + kmbuf = kmalloc(sizeof(struct msgbuf) + arg3, 1082 GFP_KERNEL); 1083 if (!kmbuf || sunos_msgbuf_get((struct msgbuf32 __user *)(unsigned long)arg2, 1084 kmbuf, arg3))
+2 -2
arch/um/sys-i386/ldt.c
··· 166 struct ptrace_ldt ptrace_ldt = (struct ptrace_ldt) { 167 .func = 0, 168 .bytecount = bytecount, 169 - .ptr = (void *)kmalloc(bytecount, GFP_KERNEL)}; 170 u32 cpu; 171 172 if(ptrace_ldt.ptr == NULL) ··· 426 host_ldt_entries = dummy_list; 427 else { 428 size = (size + 1) * sizeof(dummy_list[0]); 429 - host_ldt_entries = (short *)kmalloc(size, GFP_KERNEL); 430 if(host_ldt_entries == NULL) { 431 printk("ldt_get_host_info: couldn't allocate host ldt list\n"); 432 goto out_free;
··· 166 struct ptrace_ldt ptrace_ldt = (struct ptrace_ldt) { 167 .func = 0, 168 .bytecount = bytecount, 169 + .ptr = kmalloc(bytecount, GFP_KERNEL)}; 170 u32 cpu; 171 172 if(ptrace_ldt.ptr == NULL) ··· 426 host_ldt_entries = dummy_list; 427 else { 428 size = (size + 1) * sizeof(dummy_list[0]); 429 + host_ldt_entries = kmalloc(size, GFP_KERNEL); 430 if(host_ldt_entries == NULL) { 431 printk("ldt_get_host_info: couldn't allocate host ldt list\n"); 432 goto out_free;
+2 -2
drivers/acorn/block/fd1772.c
··· 1549 #ifdef TRACKBUFFER 1550 BufferDrive = BufferSide = BufferTrack = -1; 1551 /* Atari uses 512 - I want to eventually cope with 1K sectors */ 1552 - DMABuffer = (char *)kmalloc((FD1772_MAX_SECTORS+1)*512,GFP_KERNEL); 1553 TrackBuffer = DMABuffer + 512; 1554 #else 1555 /* Allocate memory for the DMAbuffer - on the Atari this takes it 1556 out of some special memory... */ 1557 - DMABuffer = (char *) kmalloc(2048); /* Copes with pretty large sectors */ 1558 #endif 1559 err = -ENOMEM; 1560 if (!DMAbuffer)
··· 1549 #ifdef TRACKBUFFER 1550 BufferDrive = BufferSide = BufferTrack = -1; 1551 /* Atari uses 512 - I want to eventually cope with 1K sectors */ 1552 + DMABuffer = kmalloc((FD1772_MAX_SECTORS+1)*512,GFP_KERNEL); 1553 TrackBuffer = DMABuffer + 512; 1554 #else 1555 /* Allocate memory for the DMAbuffer - on the Atari this takes it 1556 out of some special memory... */ 1557 + DMABuffer = kmalloc(2048); /* Copes with pretty large sectors */ 1558 #endif 1559 err = -ENOMEM; 1560 if (!DMAbuffer)
+2 -2
drivers/atm/eni.c
··· 1832 /* initialize memory management */ 1833 buffer_mem = eni_dev->mem - (buf - eni_dev->ram); 1834 eni_dev->free_list_size = buffer_mem/MID_MIN_BUF_SIZE/2; 1835 - eni_dev->free_list = (struct eni_free *) kmalloc( 1836 sizeof(struct eni_free)*(eni_dev->free_list_size+1),GFP_KERNEL); 1837 if (!eni_dev->free_list) { 1838 printk(KERN_ERR DEV_LABEL "(itf %d): couldn't get free page\n", ··· 2232 goto out0; 2233 } 2234 2235 - eni_dev = (struct eni_dev *) kmalloc(sizeof(struct eni_dev),GFP_KERNEL); 2236 if (!eni_dev) goto out0; 2237 if (!cpu_zeroes) { 2238 cpu_zeroes = pci_alloc_consistent(pci_dev,ENI_ZEROES_SIZE,
··· 1832 /* initialize memory management */ 1833 buffer_mem = eni_dev->mem - (buf - eni_dev->ram); 1834 eni_dev->free_list_size = buffer_mem/MID_MIN_BUF_SIZE/2; 1835 + eni_dev->free_list = kmalloc( 1836 sizeof(struct eni_free)*(eni_dev->free_list_size+1),GFP_KERNEL); 1837 if (!eni_dev->free_list) { 1838 printk(KERN_ERR DEV_LABEL "(itf %d): couldn't get free page\n", ··· 2232 goto out0; 2233 } 2234 2235 + eni_dev = kmalloc(sizeof(struct eni_dev),GFP_KERNEL); 2236 if (!eni_dev) goto out0; 2237 if (!cpu_zeroes) { 2238 cpu_zeroes = pci_alloc_consistent(pci_dev,ENI_ZEROES_SIZE,
+1 -1
drivers/atm/he.c
··· 2351 2352 cid = he_mkcid(he_dev, vpi, vci); 2353 2354 - he_vcc = (struct he_vcc *) kmalloc(sizeof(struct he_vcc), GFP_ATOMIC); 2355 if (he_vcc == NULL) { 2356 hprintk("unable to allocate he_vcc during open\n"); 2357 return -ENOMEM;
··· 2351 2352 cid = he_mkcid(he_dev, vpi, vci); 2353 2354 + he_vcc = kmalloc(sizeof(struct he_vcc), GFP_ATOMIC); 2355 if (he_vcc == NULL) { 2356 hprintk("unable to allocate he_vcc during open\n"); 2357 return -ENOMEM;
+1 -1
drivers/atm/lanai.c
··· 2602 struct atm_dev *atmdev; 2603 int result; 2604 2605 - lanai = (struct lanai_dev *) kmalloc(sizeof(*lanai), GFP_KERNEL); 2606 if (lanai == NULL) { 2607 printk(KERN_ERR DEV_LABEL 2608 ": couldn't allocate dev_data structure!\n");
··· 2602 struct atm_dev *atmdev; 2603 int result; 2604 2605 + lanai = kmalloc(sizeof(*lanai), GFP_KERNEL); 2606 if (lanai == NULL) { 2607 printk(KERN_ERR DEV_LABEL 2608 ": couldn't allocate dev_data structure!\n");
+2 -2
drivers/atm/nicstar.c
··· 997 if (size != VBR_SCQSIZE && size != CBR_SCQSIZE) 998 return NULL; 999 1000 - scq = (scq_info *) kmalloc(sizeof(scq_info), GFP_KERNEL); 1001 if (scq == NULL) 1002 return NULL; 1003 scq->org = kmalloc(2 * size, GFP_KERNEL); ··· 1006 kfree(scq); 1007 return NULL; 1008 } 1009 - scq->skb = (struct sk_buff **) kmalloc(sizeof(struct sk_buff *) * 1010 (size / NS_SCQE_SIZE), GFP_KERNEL); 1011 if (scq->skb == NULL) 1012 {
··· 997 if (size != VBR_SCQSIZE && size != CBR_SCQSIZE) 998 return NULL; 999 1000 + scq = kmalloc(sizeof(scq_info), GFP_KERNEL); 1001 if (scq == NULL) 1002 return NULL; 1003 scq->org = kmalloc(2 * size, GFP_KERNEL); ··· 1006 kfree(scq); 1007 return NULL; 1008 } 1009 + scq->skb = kmalloc(sizeof(struct sk_buff *) * 1010 (size / NS_SCQE_SIZE), GFP_KERNEL); 1011 if (scq->skb == NULL) 1012 {
+2 -2
drivers/atm/zatm.c
··· 996 997 DPRINTK("start_tx\n"); 998 zatm_dev = ZATM_DEV(dev); 999 - zatm_dev->tx_map = (struct atm_vcc **) kmalloc(sizeof(struct atm_vcc *)* 1000 zatm_dev->chans,GFP_KERNEL); 1001 if (!zatm_dev->tx_map) return -ENOMEM; 1002 zatm_dev->tx_bw = ATM_OC3_PCR; ··· 1591 struct zatm_dev *zatm_dev; 1592 int ret = -ENOMEM; 1593 1594 - zatm_dev = (struct zatm_dev *) kmalloc(sizeof(*zatm_dev), GFP_KERNEL); 1595 if (!zatm_dev) { 1596 printk(KERN_EMERG "%s: memory shortage\n", DEV_LABEL); 1597 goto out;
··· 996 997 DPRINTK("start_tx\n"); 998 zatm_dev = ZATM_DEV(dev); 999 + zatm_dev->tx_map = kmalloc(sizeof(struct atm_vcc *)* 1000 zatm_dev->chans,GFP_KERNEL); 1001 if (!zatm_dev->tx_map) return -ENOMEM; 1002 zatm_dev->tx_bw = ATM_OC3_PCR; ··· 1591 struct zatm_dev *zatm_dev; 1592 int ret = -ENOMEM; 1593 1594 + zatm_dev = kmalloc(sizeof(*zatm_dev), GFP_KERNEL); 1595 if (!zatm_dev) { 1596 printk(KERN_EMERG "%s: memory shortage\n", DEV_LABEL); 1597 goto out;
+1 -1
drivers/base/dmapool.c
··· 173 mapsize = (mapsize + BITS_PER_LONG - 1) / BITS_PER_LONG; 174 mapsize *= sizeof (long); 175 176 - page = (struct dma_page *) kmalloc (mapsize + sizeof *page, mem_flags); 177 if (!page) 178 return NULL; 179 page->vaddr = dma_alloc_coherent (pool->dev,
··· 173 mapsize = (mapsize + BITS_PER_LONG - 1) / BITS_PER_LONG; 174 mapsize *= sizeof (long); 175 176 + page = kmalloc(mapsize + sizeof *page, mem_flags); 177 if (!page) 178 return NULL; 179 page->vaddr = dma_alloc_coherent (pool->dev,
+1 -1
drivers/block/cciss.c
··· 1039 status = -ENOMEM; 1040 goto cleanup1; 1041 } 1042 - buff_size = (int *)kmalloc(MAXSGENTRIES * sizeof(int), 1043 GFP_KERNEL); 1044 if (!buff_size) { 1045 status = -ENOMEM;
··· 1039 status = -ENOMEM; 1040 goto cleanup1; 1041 } 1042 + buff_size = kmalloc(MAXSGENTRIES * sizeof(int), 1043 GFP_KERNEL); 1044 if (!buff_size) { 1045 status = -ENOMEM;
+5 -5
drivers/block/cpqarray.c
··· 1625 " processing\n"); 1626 /* Command does not return anything, but idasend command needs a 1627 buffer */ 1628 - id_ctlr_buf = (id_ctlr_t *)kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); 1629 if(id_ctlr_buf==NULL) 1630 { 1631 printk(KERN_WARNING "cpqarray: Out of memory. " ··· 1660 1661 info_p->log_drv_map = 0; 1662 1663 - id_ldrive = (id_log_drv_t *)kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); 1664 if(id_ldrive == NULL) 1665 { 1666 printk( KERN_ERR "cpqarray: out of memory.\n"); 1667 return; 1668 } 1669 1670 - id_ctlr_buf = (id_ctlr_t *)kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); 1671 if(id_ctlr_buf == NULL) 1672 { 1673 kfree(id_ldrive); ··· 1675 return; 1676 } 1677 1678 - id_lstatus_buf = (sense_log_drv_stat_t *)kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); 1679 if(id_lstatus_buf == NULL) 1680 { 1681 kfree(id_ctlr_buf); ··· 1684 return; 1685 } 1686 1687 - sense_config_buf = (config_t *)kmalloc(sizeof(config_t), GFP_KERNEL); 1688 if(sense_config_buf == NULL) 1689 { 1690 kfree(id_lstatus_buf);
··· 1625 " processing\n"); 1626 /* Command does not return anything, but idasend command needs a 1627 buffer */ 1628 + id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); 1629 if(id_ctlr_buf==NULL) 1630 { 1631 printk(KERN_WARNING "cpqarray: Out of memory. " ··· 1660 1661 info_p->log_drv_map = 0; 1662 1663 + id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL); 1664 if(id_ldrive == NULL) 1665 { 1666 printk( KERN_ERR "cpqarray: out of memory.\n"); 1667 return; 1668 } 1669 1670 + id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL); 1671 if(id_ctlr_buf == NULL) 1672 { 1673 kfree(id_ldrive); ··· 1675 return; 1676 } 1677 1678 + id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL); 1679 if(id_lstatus_buf == NULL) 1680 { 1681 kfree(id_ctlr_buf); ··· 1684 return; 1685 } 1686 1687 + sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL); 1688 if(sense_config_buf == NULL) 1689 { 1690 kfree(id_lstatus_buf);
+4 -4
drivers/cdrom/cdrom.c
··· 1810 1811 size = sizeof(s->disckey.value) + 4; 1812 1813 - if ((buf = (u_char *) kmalloc(size, GFP_KERNEL)) == NULL) 1814 return -ENOMEM; 1815 1816 init_cdrom_command(&cgc, buf, size, CGC_DATA_READ); ··· 1861 1862 size = sizeof(s->manufact.value) + 4; 1863 1864 - if ((buf = (u_char *) kmalloc(size, GFP_KERNEL)) == NULL) 1865 return -ENOMEM; 1866 1867 init_cdrom_command(&cgc, buf, size, CGC_DATA_READ); ··· 2849 /* FIXME: we need upper bound checking, too!! */ 2850 if (lba < 0) 2851 return -EINVAL; 2852 - cgc.buffer = (char *) kmalloc(blocksize, GFP_KERNEL); 2853 if (cgc.buffer == NULL) 2854 return -ENOMEM; 2855 memset(&sense, 0, sizeof(sense)); ··· 3031 int size = sizeof(dvd_struct); 3032 if (!CDROM_CAN(CDC_DVD)) 3033 return -ENOSYS; 3034 - if ((s = (dvd_struct *) kmalloc(size, GFP_KERNEL)) == NULL) 3035 return -ENOMEM; 3036 cdinfo(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); 3037 if (copy_from_user(s, (dvd_struct __user *)arg, size)) {
··· 1810 1811 size = sizeof(s->disckey.value) + 4; 1812 1813 + if ((buf = kmalloc(size, GFP_KERNEL)) == NULL) 1814 return -ENOMEM; 1815 1816 init_cdrom_command(&cgc, buf, size, CGC_DATA_READ); ··· 1861 1862 size = sizeof(s->manufact.value) + 4; 1863 1864 + if ((buf = kmalloc(size, GFP_KERNEL)) == NULL) 1865 return -ENOMEM; 1866 1867 init_cdrom_command(&cgc, buf, size, CGC_DATA_READ); ··· 2849 /* FIXME: we need upper bound checking, too!! */ 2850 if (lba < 0) 2851 return -EINVAL; 2852 + cgc.buffer = kmalloc(blocksize, GFP_KERNEL); 2853 if (cgc.buffer == NULL) 2854 return -ENOMEM; 2855 memset(&sense, 0, sizeof(sense)); ··· 3031 int size = sizeof(dvd_struct); 3032 if (!CDROM_CAN(CDC_DVD)) 3033 return -ENOSYS; 3034 + if ((s = kmalloc(size, GFP_KERNEL)) == NULL) 3035 return -ENOMEM; 3036 cdinfo(CD_DO_IOCTL, "entering DVD_READ_STRUCT\n"); 3037 if (copy_from_user(s, (dvd_struct __user *)arg, size)) {
+1 -1
drivers/cdrom/cm206.c
··· 1420 return -EIO; 1421 } 1422 printk(" adapter at 0x%x", cm206_base); 1423 - cd = (struct cm206_struct *) kmalloc(size, GFP_KERNEL); 1424 if (!cd) 1425 goto out_base; 1426 /* Now we have found the adaptor card, try to reset it. As we have
··· 1420 return -EIO; 1421 } 1422 printk(" adapter at 0x%x", cm206_base); 1423 + cd = kmalloc(size, GFP_KERNEL); 1424 if (!cd) 1425 goto out_base; 1426 /* Now we have found the adaptor card, try to reset it. As we have
+1 -1
drivers/char/consolemap.c
··· 443 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 444 if (p && p->readonly) return -EIO; 445 if (!p || --p->refcount) { 446 - q = (struct uni_pagedir *)kmalloc(sizeof(*p), GFP_KERNEL); 447 if (!q) { 448 if (p) p->refcount++; 449 return -ENOMEM;
··· 443 p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; 444 if (p && p->readonly) return -EIO; 445 if (!p || --p->refcount) { 446 + q = kmalloc(sizeof(*p), GFP_KERNEL); 447 if (!q) { 448 if (p) p->refcount++; 449 return -ENOMEM;
+1 -1
drivers/char/lcd.c
··· 459 (&display, (struct lcd_display *) arg, 460 sizeof(struct lcd_display))) 461 return -EFAULT; 462 - rom = (unsigned char *) kmalloc((128), GFP_ATOMIC); 463 if (rom == NULL) { 464 printk(KERN_ERR LCD "kmalloc() failed in %s\n", 465 __FUNCTION__);
··· 459 (&display, (struct lcd_display *) arg, 460 sizeof(struct lcd_display))) 461 return -EFAULT; 462 + rom = kmalloc((128), GFP_ATOMIC); 463 if (rom == NULL) { 464 printk(KERN_ERR LCD "kmalloc() failed in %s\n", 465 __FUNCTION__);
+1 -1
drivers/char/lp.c
··· 525 return -EIO; 526 } 527 } 528 - lp_table[minor].lp_buffer = (char *) kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); 529 if (!lp_table[minor].lp_buffer) { 530 LP_F(minor) &= ~LP_BUSY; 531 return -ENOMEM;
··· 525 return -EIO; 526 } 527 } 528 + lp_table[minor].lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL); 529 if (!lp_table[minor].lp_buffer) { 530 LP_F(minor) &= ~LP_BUSY; 531 return -ENOMEM;
+1 -1
drivers/char/rio/riocmd.c
··· 556 { 557 struct CmdBlk *CmdBlkP; 558 559 - CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); 560 if (CmdBlkP) 561 memset(CmdBlkP, 0, sizeof(struct CmdBlk)); 562 return CmdBlkP;
··· 556 { 557 struct CmdBlk *CmdBlkP; 558 559 + CmdBlkP = kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); 560 if (CmdBlkP) 561 memset(CmdBlkP, 0, sizeof(struct CmdBlk)); 562 return CmdBlkP;
+1 -1
drivers/char/synclink.c
··· 4332 { 4333 struct mgsl_struct *info; 4334 4335 - info = (struct mgsl_struct *)kmalloc(sizeof(struct mgsl_struct), 4336 GFP_KERNEL); 4337 4338 if (!info) {
··· 4332 { 4333 struct mgsl_struct *info; 4334 4335 + info = kmalloc(sizeof(struct mgsl_struct), 4336 GFP_KERNEL); 4337 4338 if (!info) {
+2 -2
drivers/char/synclinkmp.c
··· 2730 return 0; 2731 2732 if (!info->tx_buf) { 2733 - info->tx_buf = (unsigned char *)kmalloc(info->max_frame_size, GFP_KERNEL); 2734 if (!info->tx_buf) { 2735 printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", 2736 __FILE__,__LINE__,info->device_name); ··· 3798 { 3799 SLMP_INFO *info; 3800 3801 - info = (SLMP_INFO *)kmalloc(sizeof(SLMP_INFO), 3802 GFP_KERNEL); 3803 3804 if (!info) {
··· 2730 return 0; 2731 2732 if (!info->tx_buf) { 2733 + info->tx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); 2734 if (!info->tx_buf) { 2735 printk(KERN_ERR"%s(%d):%s can't allocate transmit buffer\n", 2736 __FILE__,__LINE__,info->device_name); ··· 3798 { 3799 SLMP_INFO *info; 3800 3801 + info = kmalloc(sizeof(SLMP_INFO), 3802 GFP_KERNEL); 3803 3804 if (!info) {
+1 -1
drivers/char/vt.c
··· 784 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) 785 return 0; 786 787 - newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER); 788 if (!newscreen) 789 return -ENOMEM; 790
··· 784 if (new_cols == vc->vc_cols && new_rows == vc->vc_rows) 785 return 0; 786 787 + newscreen = kmalloc(new_screen_size, GFP_USER); 788 if (!newscreen) 789 return -ENOMEM; 790
+2 -2
drivers/char/vt_ioctl.c
··· 129 !capable(CAP_SYS_RESOURCE)) 130 return -EPERM; 131 132 - key_map = (ushort *) kmalloc(sizeof(plain_map), 133 GFP_KERNEL); 134 if (!key_map) 135 return -ENOMEM; ··· 259 sz = 256; 260 while (sz < funcbufsize - funcbufleft + delta) 261 sz <<= 1; 262 - fnw = (char *) kmalloc(sz, GFP_KERNEL); 263 if(!fnw) { 264 ret = -ENOMEM; 265 goto reterr;
··· 129 !capable(CAP_SYS_RESOURCE)) 130 return -EPERM; 131 132 + key_map = kmalloc(sizeof(plain_map), 133 GFP_KERNEL); 134 if (!key_map) 135 return -ENOMEM; ··· 259 sz = 256; 260 while (sz < funcbufsize - funcbufleft + delta) 261 sz <<= 1; 262 + fnw = kmalloc(sz, GFP_KERNEL); 263 if(!fnw) { 264 ret = -ENOMEM; 265 goto reterr;
+5 -5
drivers/fc4/fc.c
··· 266 printk ("FC: Bad magic from REPORT_AL_MAP on %s - %08x\n", fc->name, p->magic); 267 fc->state = FC_STATE_OFFLINE; 268 } else { 269 - fc->posmap = (fcp_posmap *)kzalloc(sizeof(fcp_posmap)+p->len, GFP_KERNEL); 270 if (!fc->posmap) { 271 printk("FC: Not enough memory, offlining channel\n"); 272 fc->state = FC_STATE_OFFLINE; ··· 355 for (i = fc->can_queue; i < fc->scsi_bitmap_end; i++) 356 set_bit (i, fc->scsi_bitmap); 357 fc->scsi_free = fc->can_queue; 358 - fc->cmd_slots = (fcp_cmnd **)kzalloc(slots * sizeof(fcp_cmnd*), GFP_KERNEL); 359 fc->abort_count = 0; 360 } else { 361 fc->scsi_name[0] = 0; ··· 933 DECLARE_MUTEX_LOCKED(sem); 934 935 if (!fc->rst_pkt) { 936 - fc->rst_pkt = (struct scsi_cmnd *) kmalloc(sizeof(SCpnt), GFP_KERNEL); 937 if (!fc->rst_pkt) return FAILED; 938 939 fcmd = FCP_CMND(fc->rst_pkt); ··· 1107 logi *l; 1108 int status; 1109 1110 - l = (logi *)kzalloc(2 * sizeof(logi), GFP_KERNEL); 1111 if (!l) return -ENOMEM; 1112 l->code = LS_PLOGI; 1113 memcpy (&l->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn)); ··· 1141 prli *p; 1142 int status; 1143 1144 - p = (prli *)kzalloc(2 * sizeof(prli), GFP_KERNEL); 1145 if (!p) return -ENOMEM; 1146 p->code = LS_PRLI; 1147 p->params[0] = 0x08002000;
··· 266 printk ("FC: Bad magic from REPORT_AL_MAP on %s - %08x\n", fc->name, p->magic); 267 fc->state = FC_STATE_OFFLINE; 268 } else { 269 + fc->posmap = kzalloc(sizeof(fcp_posmap)+p->len, GFP_KERNEL); 270 if (!fc->posmap) { 271 printk("FC: Not enough memory, offlining channel\n"); 272 fc->state = FC_STATE_OFFLINE; ··· 355 for (i = fc->can_queue; i < fc->scsi_bitmap_end; i++) 356 set_bit (i, fc->scsi_bitmap); 357 fc->scsi_free = fc->can_queue; 358 + fc->cmd_slots = kzalloc(slots * sizeof(fcp_cmnd*), GFP_KERNEL); 359 fc->abort_count = 0; 360 } else { 361 fc->scsi_name[0] = 0; ··· 933 DECLARE_MUTEX_LOCKED(sem); 934 935 if (!fc->rst_pkt) { 936 + fc->rst_pkt = kmalloc(sizeof(SCpnt), GFP_KERNEL); 937 if (!fc->rst_pkt) return FAILED; 938 939 fcmd = FCP_CMND(fc->rst_pkt); ··· 1107 logi *l; 1108 int status; 1109 1110 + l = kzalloc(2 * sizeof(logi), GFP_KERNEL); 1111 if (!l) return -ENOMEM; 1112 l->code = LS_PLOGI; 1113 memcpy (&l->nport_wwn, &fc->wwn_nport, sizeof(fc_wwn)); ··· 1141 prli *p; 1142 int status; 1143 1144 + p = kzalloc(2 * sizeof(prli), GFP_KERNEL); 1145 if (!p) return -ENOMEM; 1146 p->code = LS_PRLI; 1147 p->params[0] = 0x08002000;
+1 -1
drivers/ide/ide-floppy.c
··· 2147 printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name); 2148 goto failed; 2149 } 2150 - if ((floppy = (idefloppy_floppy_t *) kzalloc (sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) { 2151 printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name); 2152 goto failed; 2153 }
··· 2147 printk("ide-floppy: passing drive %s to ide-scsi emulation.\n", drive->name); 2148 goto failed; 2149 } 2150 + if ((floppy = kzalloc(sizeof (idefloppy_floppy_t), GFP_KERNEL)) == NULL) { 2151 printk (KERN_ERR "ide-floppy: %s: Can't allocate a floppy structure\n", drive->name); 2152 goto failed; 2153 }
+4 -4
drivers/ide/ide-tape.c
··· 2573 int pages = tape->pages_per_stage; 2574 char *b_data = NULL; 2575 2576 - if ((stage = (idetape_stage_t *) kmalloc (sizeof (idetape_stage_t),GFP_KERNEL)) == NULL) 2577 return NULL; 2578 stage->next = NULL; 2579 2580 - bh = stage->bh = (struct idetape_bh *)kmalloc(sizeof(struct idetape_bh), GFP_KERNEL); 2581 if (bh == NULL) 2582 goto abort; 2583 bh->b_reqnext = NULL; ··· 2607 continue; 2608 } 2609 prev_bh = bh; 2610 - if ((bh = (struct idetape_bh *)kmalloc(sizeof(struct idetape_bh), GFP_KERNEL)) == NULL) { 2611 free_page((unsigned long) b_data); 2612 goto abort; 2613 } ··· 4860 printk(KERN_WARNING "ide-tape: Use drive %s with ide-scsi emulation and osst.\n", drive->name); 4861 printk(KERN_WARNING "ide-tape: OnStream support will be removed soon from ide-tape!\n"); 4862 } 4863 - tape = (idetape_tape_t *) kzalloc (sizeof (idetape_tape_t), GFP_KERNEL); 4864 if (tape == NULL) { 4865 printk(KERN_ERR "ide-tape: %s: Can't allocate a tape structure\n", drive->name); 4866 goto failed;
··· 2573 int pages = tape->pages_per_stage; 2574 char *b_data = NULL; 2575 2576 + if ((stage = kmalloc(sizeof (idetape_stage_t),GFP_KERNEL)) == NULL) 2577 return NULL; 2578 stage->next = NULL; 2579 2580 + bh = stage->bh = kmalloc(sizeof(struct idetape_bh), GFP_KERNEL); 2581 if (bh == NULL) 2582 goto abort; 2583 bh->b_reqnext = NULL; ··· 2607 continue; 2608 } 2609 prev_bh = bh; 2610 + if ((bh = kmalloc(sizeof(struct idetape_bh), GFP_KERNEL)) == NULL) { 2611 free_page((unsigned long) b_data); 2612 goto abort; 2613 } ··· 4860 printk(KERN_WARNING "ide-tape: Use drive %s with ide-scsi emulation and osst.\n", drive->name); 4861 printk(KERN_WARNING "ide-tape: OnStream support will be removed soon from ide-tape!\n"); 4862 } 4863 + tape = kzalloc(sizeof (idetape_tape_t), GFP_KERNEL); 4864 if (tape == NULL) { 4865 printk(KERN_ERR "ide-tape: %s: Can't allocate a tape structure\n", drive->name); 4866 goto failed;
+1 -1
drivers/isdn/act2000/act2000_isa.c
··· 408 p = cblock.buffer; 409 if (!access_ok(VERIFY_READ, p, length)) 410 return -EFAULT; 411 - buf = (u_char *) kmalloc(1024, GFP_KERNEL); 412 if (!buf) 413 return -ENOMEM; 414 timeout = 0;
··· 408 p = cblock.buffer; 409 if (!access_ok(VERIFY_READ, p, length)) 410 return -EFAULT; 411 + buf = kmalloc(1024, GFP_KERNEL); 412 if (!buf) 413 return -ENOMEM; 414 timeout = 0;
+1 -1
drivers/isdn/capi/capidrv.c
··· 2013 strcpy(card->name, id); 2014 card->contrnr = contr; 2015 card->nbchan = profp->nbchannel; 2016 - card->bchans = (capidrv_bchan *) kmalloc(sizeof(capidrv_bchan) * card->nbchan, GFP_ATOMIC); 2017 if (!card->bchans) { 2018 printk(KERN_WARNING 2019 "capidrv: (%s) Could not allocate bchan-structs.\n", id);
··· 2013 strcpy(card->name, id); 2014 card->contrnr = contr; 2015 card->nbchan = profp->nbchannel; 2016 + card->bchans = kmalloc(sizeof(capidrv_bchan) * card->nbchan, GFP_ATOMIC); 2017 if (!card->bchans) { 2018 printk(KERN_WARNING 2019 "capidrv: (%s) Could not allocate bchan-structs.\n", id);
+1 -1
drivers/isdn/divert/divert_procfs.c
··· 45 return; 46 if (!*cp) 47 return; 48 - if (!(ib = (struct divert_info *) kmalloc(sizeof(struct divert_info) + strlen(cp), GFP_ATOMIC))) 49 return; /* no memory */ 50 strcpy(ib->info_start, cp); /* set output string */ 51 ib->next = NULL;
··· 45 return; 46 if (!*cp) 47 return; 48 + if (!(ib = kmalloc(sizeof(struct divert_info) + strlen(cp), GFP_ATOMIC))) 49 return; /* no memory */ 50 strcpy(ib->info_start, cp); /* set output string */ 51 ib->next = NULL;
+3 -3
drivers/isdn/divert/isdn_divert.c
··· 153 *ielenp = p - ielenp - 1; /* set total IE length */ 154 155 /* allocate mem for information struct */ 156 - if (!(cs = (struct call_struc *) kmalloc(sizeof(struct call_struc), GFP_ATOMIC))) 157 return(-ENOMEM); /* no memory */ 158 init_timer(&cs->timer); 159 cs->info[0] = '\0'; ··· 276 { struct deflect_struc *ds,*ds1=NULL; 277 unsigned long flags; 278 279 - if (!(ds = (struct deflect_struc *) kmalloc(sizeof(struct deflect_struc), 280 GFP_KERNEL))) 281 return(-ENOMEM); /* no memory */ 282 ··· 451 if (dv->rule.action == DEFLECT_PROCEED) 452 if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime))) 453 return(0); /* no external deflection needed */ 454 - if (!(cs = (struct call_struc *) kmalloc(sizeof(struct call_struc), GFP_ATOMIC))) 455 return(0); /* no memory */ 456 init_timer(&cs->timer); 457 cs->info[0] = '\0';
··· 153 *ielenp = p - ielenp - 1; /* set total IE length */ 154 155 /* allocate mem for information struct */ 156 + if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC))) 157 return(-ENOMEM); /* no memory */ 158 init_timer(&cs->timer); 159 cs->info[0] = '\0'; ··· 276 { struct deflect_struc *ds,*ds1=NULL; 277 unsigned long flags; 278 279 + if (!(ds = kmalloc(sizeof(struct deflect_struc), 280 GFP_KERNEL))) 281 return(-ENOMEM); /* no memory */ 282 ··· 451 if (dv->rule.action == DEFLECT_PROCEED) 452 if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime))) 453 return(0); /* no external deflection needed */ 454 + if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC))) 455 return(0); /* no memory */ 456 init_timer(&cs->timer); 457 cs->info[0] = '\0';
+1 -1
drivers/isdn/hysdn/hysdn_procconf.c
··· 275 } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { 276 /* read access -> output card info data */ 277 278 - if (!(tmp = (char *) kmalloc(INFO_OUT_LEN * 2 + 2, GFP_KERNEL))) { 279 unlock_kernel(); 280 return (-EFAULT); /* out of memory */ 281 }
··· 275 } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) { 276 /* read access -> output card info data */ 277 278 + if (!(tmp = kmalloc(INFO_OUT_LEN * 2 + 2, GFP_KERNEL))) { 279 unlock_kernel(); 280 return (-EFAULT); /* out of memory */ 281 }
+1 -1
drivers/isdn/hysdn/hysdn_proclog.c
··· 111 if (pd->if_used <= 0) 112 return; /* no open file for read */ 113 114 - if (!(ib = (struct log_data *) kmalloc(sizeof(struct log_data) + strlen(cp), GFP_ATOMIC))) 115 return; /* no memory */ 116 strcpy(ib->log_start, cp); /* set output string */ 117 ib->next = NULL;
··· 111 if (pd->if_used <= 0) 112 return; /* no open file for read */ 113 114 + if (!(ib = kmalloc(sizeof(struct log_data) + strlen(cp), GFP_ATOMIC))) 115 return; /* no memory */ 116 strcpy(ib->log_start, cp); /* set output string */ 117 ib->next = NULL;
+3 -3
drivers/isdn/i4l/isdn_audio.c
··· 328 isdn_audio_adpcm_init(adpcm_state * s, int nbits) 329 { 330 if (!s) 331 - s = (adpcm_state *) kmalloc(sizeof(adpcm_state), GFP_ATOMIC); 332 if (s) { 333 s->a = 0; 334 s->d = 5; ··· 343 isdn_audio_dtmf_init(dtmf_state * s) 344 { 345 if (!s) 346 - s = (dtmf_state *) kmalloc(sizeof(dtmf_state), GFP_ATOMIC); 347 if (s) { 348 s->idx = 0; 349 s->last = ' '; ··· 621 isdn_audio_silence_init(silence_state * s) 622 { 623 if (!s) 624 - s = (silence_state *) kmalloc(sizeof(silence_state), GFP_ATOMIC); 625 if (s) { 626 s->idx = 0; 627 s->state = 0;
··· 328 isdn_audio_adpcm_init(adpcm_state * s, int nbits) 329 { 330 if (!s) 331 + s = kmalloc(sizeof(adpcm_state), GFP_ATOMIC); 332 if (s) { 333 s->a = 0; 334 s->d = 5; ··· 343 isdn_audio_dtmf_init(dtmf_state * s) 344 { 345 if (!s) 346 + s = kmalloc(sizeof(dtmf_state), GFP_ATOMIC); 347 if (s) { 348 s->idx = 0; 349 s->last = ' '; ··· 621 isdn_audio_silence_init(silence_state * s) 622 { 623 if (!s) 624 + s = kmalloc(sizeof(silence_state), GFP_ATOMIC); 625 if (s) { 626 s->idx = 0; 627 s->state = 0;
+1 -1
drivers/isdn/i4l/isdn_net.c
··· 2948 isdn_net_phone *n; 2949 2950 if (p) { 2951 - if (!(n = (isdn_net_phone *) kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) 2952 return -ENOMEM; 2953 strcpy(n->num, phone->phone); 2954 n->next = p->local->phone[phone->outgoing & 1];
··· 2948 isdn_net_phone *n; 2949 2950 if (p) { 2951 + if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) 2952 return -ENOMEM; 2953 strcpy(n->num, phone->phone); 2954 n->next = p->local->phone[phone->outgoing & 1];
+1 -1
drivers/isdn/i4l/isdn_ppp.c
··· 717 printk(KERN_DEBUG "ippp: device not activated.\n"); 718 return 0; 719 } 720 - nbuf = (unsigned char *) kmalloc(len + 4, GFP_ATOMIC); 721 if (!nbuf) { 722 printk(KERN_WARNING "ippp: Can't alloc buf\n"); 723 return 0;
··· 717 printk(KERN_DEBUG "ippp: device not activated.\n"); 718 return 0; 719 } 720 + nbuf = kmalloc(len + 4, GFP_ATOMIC); 721 if (!nbuf) { 722 printk(KERN_WARNING "ippp: Can't alloc buf\n"); 723 return 0;
+1 -1
drivers/isdn/pcbit/layer2.c
··· 100 dev_kfree_skb(skb); 101 return -1; 102 } 103 - if ((frame = (struct frame_buf *) kmalloc(sizeof(struct frame_buf), 104 GFP_ATOMIC)) == NULL) { 105 printk(KERN_WARNING "pcbit_2_write: kmalloc failed\n"); 106 dev_kfree_skb(skb);
··· 100 dev_kfree_skb(skb); 101 return -1; 102 } 103 + if ((frame = kmalloc(sizeof(struct frame_buf), 104 GFP_ATOMIC)) == NULL) { 105 printk(KERN_WARNING "pcbit_2_write: kmalloc failed\n"); 106 dev_kfree_skb(skb);
+1 -1
drivers/macintosh/adb.c
··· 828 if (!access_ok(VERIFY_READ, buf, count)) 829 return -EFAULT; 830 831 - req = (struct adb_request *) kmalloc(sizeof(struct adb_request), 832 GFP_KERNEL); 833 if (req == NULL) 834 return -ENOMEM;
··· 828 if (!access_ok(VERIFY_READ, buf, count)) 829 return -EFAULT; 830 831 + req = kmalloc(sizeof(struct adb_request), 832 GFP_KERNEL); 833 if (req == NULL) 834 return -ENOMEM;
+1 -1
drivers/macintosh/apm_emu.c
··· 321 { 322 struct apm_user * as; 323 324 - as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL); 325 if (as == NULL) { 326 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", 327 sizeof(*as));
··· 321 { 322 struct apm_user * as; 323 324 + as = kmalloc(sizeof(*as), GFP_KERNEL); 325 if (as == NULL) { 326 printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", 327 sizeof(*as));
+1 -1
drivers/macintosh/via-pmu68k.c
··· 847 n_pbook_pci_saves = npci; 848 if (npci == 0) 849 return; 850 - ps = (struct pci_save *) kmalloc(npci * sizeof(*ps), GFP_KERNEL); 851 pbook_pci_saves = ps; 852 if (ps == NULL) 853 return;
··· 847 n_pbook_pci_saves = npci; 848 if (npci == 0) 849 return; 850 + ps = kmalloc(npci * sizeof(*ps), GFP_KERNEL); 851 pbook_pci_saves = ps; 852 if (ps == NULL) 853 return;
+1 -1
drivers/media/dvb/bt8xx/dst_ca.c
··· 480 struct ca_msg *hw_buffer; 481 int result = 0; 482 483 - if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { 484 dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); 485 return -ENOMEM; 486 }
··· 480 struct ca_msg *hw_buffer; 481 int result = 0; 482 483 + if ((hw_buffer = kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { 484 dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure"); 485 return -ENOMEM; 486 }
+1 -1
drivers/media/dvb/bt8xx/dvb-bt8xx.c
··· 657 658 case BTTV_BOARD_TWINHAN_DST: 659 /* DST is not a frontend driver !!! */ 660 - state = (struct dst_state *) kmalloc(sizeof (struct dst_state), GFP_KERNEL); 661 if (!state) { 662 printk("dvb_bt8xx: No memory\n"); 663 break;
··· 657 658 case BTTV_BOARD_TWINHAN_DST: 659 /* DST is not a frontend driver !!! */ 660 + state = kmalloc(sizeof (struct dst_state), GFP_KERNEL); 661 if (!state) { 662 printk("dvb_bt8xx: No memory\n"); 663 break;
+2 -2
drivers/media/dvb/ttusb-dec/ttusbdecfe.c
··· 195 struct ttusbdecfe_state* state = NULL; 196 197 /* allocate memory for the internal state */ 198 - state = (struct ttusbdecfe_state*) kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); 199 if (state == NULL) 200 return NULL; 201 ··· 215 struct ttusbdecfe_state* state = NULL; 216 217 /* allocate memory for the internal state */ 218 - state = (struct ttusbdecfe_state*) kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); 219 if (state == NULL) 220 return NULL; 221
··· 195 struct ttusbdecfe_state* state = NULL; 196 197 /* allocate memory for the internal state */ 198 + state = kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); 199 if (state == NULL) 200 return NULL; 201 ··· 215 struct ttusbdecfe_state* state = NULL; 216 217 /* allocate memory for the internal state */ 218 + state = kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); 219 if (state == NULL) 220 return NULL; 221
+2 -2
drivers/media/video/dabusb.c
··· 218 pipesize, packets, transfer_buffer_length); 219 220 while (buffers < (s->total_buffer_size << 10)) { 221 - b = (pbuff_t) kzalloc (sizeof (buff_t), GFP_KERNEL); 222 if (!b) { 223 err("kzalloc(sizeof(buff_t))==NULL"); 224 goto err; ··· 659 switch (cmd) { 660 661 case IOCTL_DAB_BULK: 662 - pbulk = (pbulk_transfer_t) kmalloc (sizeof (bulk_transfer_t), GFP_KERNEL); 663 664 if (!pbulk) { 665 ret = -ENOMEM;
··· 218 pipesize, packets, transfer_buffer_length); 219 220 while (buffers < (s->total_buffer_size << 10)) { 221 + b = kzalloc(sizeof (buff_t), GFP_KERNEL); 222 if (!b) { 223 err("kzalloc(sizeof(buff_t))==NULL"); 224 goto err; ··· 659 switch (cmd) { 660 661 case IOCTL_DAB_BULK: 662 + pbulk = kmalloc(sizeof (bulk_transfer_t), GFP_KERNEL); 663 664 if (!pbulk) { 665 ret = -ENOMEM;
+1 -1
drivers/media/video/planb.c
··· 138 + MAX_LNUM 139 #endif /* PLANB_GSCANLINE */ 140 ); 141 - if ((pb->rawbuf = (unsigned char**) kmalloc (npage 142 * sizeof(unsigned long), GFP_KERNEL)) == 0) 143 return -ENOMEM; 144 for (i = 0; i < npage; i++) {
··· 138 + MAX_LNUM 139 #endif /* PLANB_GSCANLINE */ 140 ); 141 + if ((pb->rawbuf = kmalloc(npage 142 * sizeof(unsigned long), GFP_KERNEL)) == 0) 143 return -ENOMEM; 144 for (i = 0; i < npage; i++) {
+1 -1
drivers/media/video/usbvideo/usbvideo.c
··· 690 } 691 692 base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo); 693 - cams = (struct usbvideo *) kzalloc(base_size, GFP_KERNEL); 694 if (cams == NULL) { 695 err("Failed to allocate %d. bytes for usbvideo struct", base_size); 696 return -ENOMEM;
··· 690 } 691 692 base_size = num_cams * sizeof(struct uvd) + sizeof(struct usbvideo); 693 + cams = kzalloc(base_size, GFP_KERNEL); 694 if (cams == NULL) { 695 err("Failed to allocate %d. bytes for usbvideo struct", base_size); 696 return -ENOMEM;
+1 -1
drivers/media/video/videocodec.c
··· 346 size); 347 348 kfree(videocodec_buf); 349 - videocodec_buf = (char *) kmalloc(size, GFP_KERNEL); 350 351 i = 0; 352 i += scnprintf(videocodec_buf + i, size - 1,
··· 346 size); 347 348 kfree(videocodec_buf); 349 + videocodec_buf = kmalloc(size, GFP_KERNEL); 350 351 i = 0; 352 i += scnprintf(videocodec_buf + i, size - 1,
+2 -2
drivers/message/i2o/i2o_config.c
··· 186 if (!dev) 187 return -ENXIO; 188 189 - ops = (u8 *) kmalloc(kcmd.oplen, GFP_KERNEL); 190 if (!ops) 191 return -ENOMEM; 192 ··· 199 * It's possible to have a _very_ large table 200 * and that the user asks for all of it at once... 201 */ 202 - res = (u8 *) kmalloc(65536, GFP_KERNEL); 203 if (!res) { 204 kfree(ops); 205 return -ENOMEM;
··· 186 if (!dev) 187 return -ENXIO; 188 189 + ops = kmalloc(kcmd.oplen, GFP_KERNEL); 190 if (!ops) 191 return -ENOMEM; 192 ··· 199 * It's possible to have a _very_ large table 200 * and that the user asks for all of it at once... 201 */ 202 + res = kmalloc(65536, GFP_KERNEL); 203 if (!res) { 204 kfree(ops); 205 return -ENOMEM;
+1 -1
drivers/mtd/devices/mtd_dataflash.c
··· 459 struct mtd_info *device; 460 struct flash_platform_data *pdata = spi->dev.platform_data; 461 462 - priv = (struct dataflash *) kzalloc(sizeof *priv, GFP_KERNEL); 463 if (!priv) 464 return -ENOMEM; 465
··· 459 struct mtd_info *device; 460 struct flash_platform_data *pdata = spi->dev.platform_data; 461 462 + priv = kzalloc(sizeof *priv, GFP_KERNEL); 463 if (!priv) 464 return -ENOMEM; 465
+1 -1
drivers/net/appletalk/ipddp.c
··· 186 */ 187 static int ipddp_create(struct ipddp_route *new_rt) 188 { 189 - struct ipddp_route *rt =(struct ipddp_route*) kmalloc(sizeof(*rt), GFP_KERNEL); 190 191 if (rt == NULL) 192 return -ENOMEM;
··· 186 */ 187 static int ipddp_create(struct ipddp_route *new_rt) 188 { 189 + struct ipddp_route *rt = kmalloc(sizeof(*rt), GFP_KERNEL); 190 191 if (rt == NULL) 192 return -ENOMEM;
+1 -1
drivers/net/bsd_comp.c
··· 395 * Allocate the main control structure for this instance. 396 */ 397 maxmaxcode = MAXCODE(bits); 398 - db = (struct bsd_db *) kmalloc (sizeof (struct bsd_db), 399 GFP_KERNEL); 400 if (!db) 401 {
··· 395 * Allocate the main control structure for this instance. 396 */ 397 maxmaxcode = MAXCODE(bits); 398 + db = kmalloc(sizeof (struct bsd_db), 399 GFP_KERNEL); 400 if (!db) 401 {
+1 -1
drivers/net/irda/donauboe.c
··· 1603 irda_qos_bits_to_value (&self->qos); 1604 1605 /* Allocate twice the size to guarantee alignment */ 1606 - self->ringbuf = (void *) kmalloc (OBOE_RING_LEN << 1, GFP_KERNEL); 1607 if (!self->ringbuf) 1608 { 1609 printk (KERN_ERR DRIVER_NAME ": can't allocate DMA buffers\n");
··· 1603 irda_qos_bits_to_value (&self->qos); 1604 1605 /* Allocate twice the size to guarantee alignment */ 1606 + self->ringbuf = kmalloc(OBOE_RING_LEN << 1, GFP_KERNEL); 1607 if (!self->ringbuf) 1608 { 1609 printk (KERN_ERR DRIVER_NAME ": can't allocate DMA buffers\n");
+1 -1
drivers/net/irda/irda-usb.c
··· 1747 /* Don't change this buffer size and allocation without doing 1748 * some heavy and complete testing. Don't ask why :-( 1749 * Jean II */ 1750 - self->speed_buff = (char *) kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); 1751 if (self->speed_buff == NULL) 1752 goto err_out_3; 1753
··· 1747 /* Don't change this buffer size and allocation without doing 1748 * some heavy and complete testing. Don't ask why :-( 1749 * Jean II */ 1750 + self->speed_buff = kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); 1751 if (self->speed_buff == NULL) 1752 goto err_out_3; 1753
+1 -1
drivers/net/irda/irport.c
··· 164 165 /* Allocate memory if needed */ 166 if (self->tx_buff.truesize > 0) { 167 - self->tx_buff.head = (__u8 *) kmalloc(self->tx_buff.truesize, 168 GFP_KERNEL); 169 if (self->tx_buff.head == NULL) { 170 IRDA_ERROR("%s(), can't allocate memory for "
··· 164 165 /* Allocate memory if needed */ 166 if (self->tx_buff.truesize > 0) { 167 + self->tx_buff.head = kmalloc(self->tx_buff.truesize, 168 GFP_KERNEL); 169 if (self->tx_buff.head == NULL) { 170 IRDA_ERROR("%s(), can't allocate memory for "
+2 -2
drivers/net/lp486e.c
··· 884 885 dev->trans_start = jiffies; 886 887 - tx_cmd = (struct tx_cmd *) kmalloc ((sizeof (struct tx_cmd) + sizeof (struct i596_tbd)), GFP_ATOMIC); 888 if (tx_cmd == NULL) { 889 printk(KERN_WARNING "%s: i596_xmit Memory squeeze, dropping packet.\n", dev->name); 890 lp->stats.tx_dropped++; ··· 1266 if (dev->mc_count > 0) { 1267 struct dev_mc_list *dmi; 1268 char *cp; 1269 - cmd = (struct i596_cmd *)kmalloc(sizeof(struct i596_cmd)+2+dev->mc_count*6, GFP_ATOMIC); 1270 if (cmd == NULL) { 1271 printk (KERN_ERR "%s: set_multicast Memory squeeze.\n", dev->name); 1272 return;
··· 884 885 dev->trans_start = jiffies; 886 887 + tx_cmd = kmalloc((sizeof (struct tx_cmd) + sizeof (struct i596_tbd)), GFP_ATOMIC); 888 if (tx_cmd == NULL) { 889 printk(KERN_WARNING "%s: i596_xmit Memory squeeze, dropping packet.\n", dev->name); 890 lp->stats.tx_dropped++; ··· 1266 if (dev->mc_count > 0) { 1267 struct dev_mc_list *dmi; 1268 char *cp; 1269 + cmd = kmalloc(sizeof(struct i596_cmd)+2+dev->mc_count*6, GFP_ATOMIC); 1270 if (cmd == NULL) { 1271 printk (KERN_ERR "%s: set_multicast Memory squeeze.\n", dev->name); 1272 return;
+2 -2
drivers/net/ppp_deflate.c
··· 121 if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) 122 return NULL; 123 124 - state = (struct ppp_deflate_state *) kmalloc(sizeof(*state), 125 GFP_KERNEL); 126 if (state == NULL) 127 return NULL; ··· 341 if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) 342 return NULL; 343 344 - state = (struct ppp_deflate_state *) kmalloc(sizeof(*state), GFP_KERNEL); 345 if (state == NULL) 346 return NULL; 347
··· 121 if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) 122 return NULL; 123 124 + state = kmalloc(sizeof(*state), 125 GFP_KERNEL); 126 if (state == NULL) 127 return NULL; ··· 341 if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE) 342 return NULL; 343 344 + state = kmalloc(sizeof(*state), GFP_KERNEL); 345 if (state == NULL) 346 return NULL; 347
+1 -1
drivers/net/ppp_mppe.c
··· 200 || options[0] != CI_MPPE || options[1] != CILEN_MPPE) 201 goto out; 202 203 - state = (struct ppp_mppe_state *) kmalloc(sizeof(*state), GFP_KERNEL); 204 if (state == NULL) 205 goto out; 206
··· 200 || options[0] != CI_MPPE || options[1] != CILEN_MPPE) 201 goto out; 202 203 + state = kmalloc(sizeof(*state), GFP_KERNEL); 204 if (state == NULL) 205 goto out; 206
+3 -3
drivers/net/slip.c
··· 229 if (len < 576 * 2) 230 len = 576 * 2; 231 232 - xbuff = (unsigned char *) kmalloc (len + 4, GFP_ATOMIC); 233 - rbuff = (unsigned char *) kmalloc (len + 4, GFP_ATOMIC); 234 #ifdef SL_INCLUDE_CSLIP 235 - cbuff = (unsigned char *) kmalloc (len + 4, GFP_ATOMIC); 236 #endif 237 238
··· 229 if (len < 576 * 2) 230 len = 576 * 2; 231 232 + xbuff = kmalloc(len + 4, GFP_ATOMIC); 233 + rbuff = kmalloc(len + 4, GFP_ATOMIC); 234 #ifdef SL_INCLUDE_CSLIP 235 + cbuff = kmalloc(len + 4, GFP_ATOMIC); 236 #endif 237 238
+1 -1
drivers/net/wan/hostess_sv11.c
··· 231 return NULL; 232 } 233 234 - sv=(struct sv11_device *)kmalloc(sizeof(struct sv11_device), GFP_KERNEL); 235 if(!sv) 236 goto fail3; 237
··· 231 return NULL; 232 } 233 234 + sv = kmalloc(sizeof(struct sv11_device), GFP_KERNEL); 235 if(!sv) 236 goto fail3; 237
+1 -1
drivers/net/wan/pc300_drv.c
··· 3455 if ((err = pci_enable_device(pdev)) < 0) 3456 return err; 3457 3458 - card = (pc300_t *) kmalloc(sizeof(pc300_t), GFP_KERNEL); 3459 if (card == NULL) { 3460 printk("PC300 found at RAM 0x%016llx, " 3461 "but could not allocate card structure.\n",
··· 3455 if ((err = pci_enable_device(pdev)) < 0) 3456 return err; 3457 3458 + card = kmalloc(sizeof(pc300_t), GFP_KERNEL); 3459 if (card == NULL) { 3460 printk("PC300 found at RAM 0x%016llx, " 3461 "but could not allocate card structure.\n",
+1 -1
drivers/net/wan/pc300_tty.c
··· 784 continue; 785 } 786 787 - new = (st_cpc_rx_buf *)kmalloc(rx_len + sizeof(st_cpc_rx_buf), GFP_ATOMIC); 788 if (new == 0) { 789 cpc_tty_rx_disc_frame(pc300chan); 790 continue;
··· 784 continue; 785 } 786 787 + new = kmalloc(rx_len + sizeof(st_cpc_rx_buf), GFP_ATOMIC); 788 if (new == 0) { 789 cpc_tty_rx_disc_frame(pc300chan); 790 continue;
+4 -4
drivers/net/wan/x25_asy.c
··· 123 unsigned char *xbuff, *rbuff; 124 int len = 2* newmtu; 125 126 - xbuff = (unsigned char *) kmalloc (len + 4, GFP_ATOMIC); 127 - rbuff = (unsigned char *) kmalloc (len + 4, GFP_ATOMIC); 128 129 if (xbuff == NULL || rbuff == NULL) 130 { ··· 465 466 len = dev->mtu * 2; 467 468 - sl->rbuff = (unsigned char *) kmalloc(len + 4, GFP_KERNEL); 469 if (sl->rbuff == NULL) { 470 goto norbuff; 471 } 472 - sl->xbuff = (unsigned char *) kmalloc(len + 4, GFP_KERNEL); 473 if (sl->xbuff == NULL) { 474 goto noxbuff; 475 }
··· 123 unsigned char *xbuff, *rbuff; 124 int len = 2* newmtu; 125 126 + xbuff = kmalloc(len + 4, GFP_ATOMIC); 127 + rbuff = kmalloc(len + 4, GFP_ATOMIC); 128 129 if (xbuff == NULL || rbuff == NULL) 130 { ··· 465 466 len = dev->mtu * 2; 467 468 + sl->rbuff = kmalloc(len + 4, GFP_KERNEL); 469 if (sl->rbuff == NULL) { 470 goto norbuff; 471 } 472 + sl->xbuff = kmalloc(len + 4, GFP_KERNEL); 473 if (sl->xbuff == NULL) { 474 goto noxbuff; 475 }
+1 -1
drivers/net/wireless/hostap/hostap_ap.c
··· 1253 return NULL; 1254 } 1255 1256 - tmpbuf = (char *) kmalloc(WLAN_AUTH_CHALLENGE_LEN, GFP_ATOMIC); 1257 if (tmpbuf == NULL) { 1258 PDEBUG(DEBUG_AP, "AP: kmalloc failed for challenge\n"); 1259 return NULL;
··· 1253 return NULL; 1254 } 1255 1256 + tmpbuf = kmalloc(WLAN_AUTH_CHALLENGE_LEN, GFP_ATOMIC); 1257 if (tmpbuf == NULL) { 1258 PDEBUG(DEBUG_AP, "AP: kmalloc failed for challenge\n"); 1259 return NULL;
+1 -1
drivers/net/wireless/hostap/hostap_download.c
··· 201 0x7f0002 /* Intel PRO/Wireless 2011B (PCI) */, 202 }; 203 204 - buf = (u8 *) kmalloc(PRISM2_PDA_SIZE, GFP_KERNEL); 205 if (buf == NULL) 206 return NULL; 207
··· 201 0x7f0002 /* Intel PRO/Wireless 2011B (PCI) */, 202 }; 203 204 + buf = kmalloc(PRISM2_PDA_SIZE, GFP_KERNEL); 205 if (buf == NULL) 206 return NULL; 207
+1 -1
drivers/net/wireless/hostap/hostap_hw.c
··· 2252 if (txdesc->sw_support) { 2253 len = le16_to_cpu(txdesc->data_len); 2254 if (len < PRISM2_DATA_MAXLEN) { 2255 - *payload = (char *) kmalloc(len, GFP_ATOMIC); 2256 if (*payload == NULL || 2257 hfa384x_from_bap(dev, BAP0, *payload, len)) { 2258 PDEBUG(DEBUG_EXTRA, "%s: could not read TX "
··· 2252 if (txdesc->sw_support) { 2253 len = le16_to_cpu(txdesc->data_len); 2254 if (len < PRISM2_DATA_MAXLEN) { 2255 + *payload = kmalloc(len, GFP_ATOMIC); 2256 if (*payload == NULL || 2257 hfa384x_from_bap(dev, BAP0, *payload, len)) { 2258 PDEBUG(DEBUG_EXTRA, "%s: could not read TX "
+1 -1
drivers/net/wireless/hostap/hostap_ioctl.c
··· 3829 p->length > PRISM2_HOSTAPD_MAX_BUF_SIZE || !p->pointer) 3830 return -EINVAL; 3831 3832 - param = (struct prism2_hostapd_param *) kmalloc(p->length, GFP_KERNEL); 3833 if (param == NULL) 3834 return -ENOMEM; 3835
··· 3829 p->length > PRISM2_HOSTAPD_MAX_BUF_SIZE || !p->pointer) 3830 return -EINVAL; 3831 3832 + param = kmalloc(p->length, GFP_KERNEL); 3833 if (param == NULL) 3834 return -ENOMEM; 3835
+1 -1
drivers/net/wireless/hostap/hostap_main.c
··· 250 unsigned long flags; 251 struct hostap_tx_callback_info *entry; 252 253 - entry = (struct hostap_tx_callback_info *) kmalloc(sizeof(*entry), 254 GFP_ATOMIC); 255 if (entry == NULL) 256 return 0;
··· 250 unsigned long flags; 251 struct hostap_tx_callback_info *entry; 252 253 + entry = kmalloc(sizeof(*entry), 254 GFP_ATOMIC); 255 if (entry == NULL) 256 return 0;
+1 -1
drivers/net/wireless/ipw2100.c
··· 2246 if (priv->snapshot[0]) 2247 return 1; 2248 for (i = 0; i < 0x30; i++) { 2249 - priv->snapshot[i] = (u8 *) kmalloc(0x1000, GFP_ATOMIC); 2250 if (!priv->snapshot[i]) { 2251 IPW_DEBUG_INFO("%s: Error allocating snapshot " 2252 "buffer %d\n", priv->net_dev->name, i);
··· 2246 if (priv->snapshot[0]) 2247 return 1; 2248 for (i = 0; i < 0x30; i++) { 2249 + priv->snapshot[i] = kmalloc(0x1000, GFP_ATOMIC); 2250 if (!priv->snapshot[i]) { 2251 IPW_DEBUG_INFO("%s: Error allocating snapshot " 2252 "buffer %d\n", priv->net_dev->name, i);
+1 -1
drivers/net/wireless/prism54/isl_ioctl.c
··· 2775 p->length > PRISM2_HOSTAPD_MAX_BUF_SIZE || !p->pointer) 2776 return -EINVAL; 2777 2778 - param = (struct prism2_hostapd_param *) kmalloc(p->length, GFP_KERNEL); 2779 if (param == NULL) 2780 return -ENOMEM; 2781
··· 2775 p->length > PRISM2_HOSTAPD_MAX_BUF_SIZE || !p->pointer) 2776 return -EINVAL; 2777 2778 + param = kmalloc(p->length, GFP_KERNEL); 2779 if (param == NULL) 2780 return -ENOMEM; 2781
+1 -1
drivers/net/wireless/wavelan_cs.c
··· 603 if(lp->wavepoint_table.num_wavepoints==MAX_WAVEPOINTS) 604 return NULL; 605 606 - new_wavepoint=(wavepoint_history *) kmalloc(sizeof(wavepoint_history),GFP_ATOMIC); 607 if(new_wavepoint==NULL) 608 return NULL; 609
··· 603 if(lp->wavepoint_table.num_wavepoints==MAX_WAVEPOINTS) 604 return NULL; 605 606 + new_wavepoint = kmalloc(sizeof(wavepoint_history),GFP_ATOMIC); 607 if(new_wavepoint==NULL) 608 return NULL; 609
+1 -1
drivers/net/wireless/zd1211rw/zd_chip.c
··· 101 102 /* Allocate a single memory block for values and addresses. */ 103 count16 = 2*count; 104 - a16 = (zd_addr_t *)kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), 105 GFP_NOFS); 106 if (!a16) { 107 dev_dbg_f(zd_chip_dev(chip),
··· 101 102 /* Allocate a single memory block for values and addresses. */ 103 count16 = 2*count; 104 + a16 = kmalloc(count16 * (sizeof(zd_addr_t) + sizeof(u16)), 105 GFP_NOFS); 106 if (!a16) { 107 dev_dbg_f(zd_chip_dev(chip),
+1 -1
drivers/parisc/iosapic.c
··· 874 return NULL; 875 } 876 877 - isi = (struct iosapic_info *)kzalloc(sizeof(struct iosapic_info), GFP_KERNEL); 878 if (!isi) { 879 BUG(); 880 return NULL;
··· 874 return NULL; 875 } 876 877 + isi = kzalloc(sizeof(struct iosapic_info), GFP_KERNEL); 878 if (!isi) { 879 BUG(); 880 return NULL;
+4 -4
drivers/pci/hotplug/cpqphp_nvram.c
··· 520 return 2; 521 522 while (nummem--) { 523 - mem_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); 524 525 if (!mem_node) 526 break; ··· 548 } 549 550 while (numpmem--) { 551 - p_mem_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); 552 553 if (!p_mem_node) 554 break; ··· 576 } 577 578 while (numio--) { 579 - io_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); 580 581 if (!io_node) 582 break; ··· 604 } 605 606 while (numbus--) { 607 - bus_node = (struct pci_resource*) kmalloc(sizeof(struct pci_resource), GFP_KERNEL); 608 609 if (!bus_node) 610 break;
··· 520 return 2; 521 522 while (nummem--) { 523 + mem_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); 524 525 if (!mem_node) 526 break; ··· 548 } 549 550 while (numpmem--) { 551 + p_mem_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); 552 553 if (!p_mem_node) 554 break; ··· 576 } 577 578 while (numio--) { 579 + io_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); 580 581 if (!io_node) 582 break; ··· 604 } 605 606 while (numbus--) { 607 + bus_node = kmalloc(sizeof(struct pci_resource), GFP_KERNEL); 608 609 if (!bus_node) 610 break;
+1 -1
drivers/pci/hotplug/pciehp_hpc.c
··· 1320 DBG_ENTER_ROUTINE 1321 1322 spin_lock_init(&list_lock); 1323 - php_ctlr = (struct php_ctlr_state_s *) kmalloc(sizeof(struct php_ctlr_state_s), GFP_KERNEL); 1324 1325 if (!php_ctlr) { /* allocate controller state data */ 1326 err("%s: HPC controller memory allocation error!\n", __FUNCTION__);
··· 1320 DBG_ENTER_ROUTINE 1321 1322 spin_lock_init(&list_lock); 1323 + php_ctlr = kmalloc(sizeof(struct php_ctlr_state_s), GFP_KERNEL); 1324 1325 if (!php_ctlr) { /* allocate controller state data */ 1326 err("%s: HPC controller memory allocation error!\n", __FUNCTION__);
+1 -1
drivers/pci/pcie/aer/aerdrv.c
··· 148 { 149 struct aer_rpc *rpc; 150 151 - if (!(rpc = (struct aer_rpc *)kmalloc(sizeof(struct aer_rpc), 152 GFP_KERNEL))) 153 return NULL; 154
··· 148 { 149 struct aer_rpc *rpc; 150 151 + if (!(rpc = kmalloc(sizeof(struct aer_rpc), 152 GFP_KERNEL))) 153 return NULL; 154
+1 -1
drivers/pnp/pnpbios/core.c
··· 109 if (!current->fs->root) { 110 return -EAGAIN; 111 } 112 - if (!(envp = (char **) kcalloc (20, sizeof (char *), GFP_KERNEL))) { 113 return -ENOMEM; 114 } 115 if (!(buf = kzalloc(256, GFP_KERNEL))) {
··· 109 if (!current->fs->root) { 110 return -EAGAIN; 111 } 112 + if (!(envp = kcalloc(20, sizeof (char *), GFP_KERNEL))) { 113 return -ENOMEM; 114 } 115 if (!(buf = kzalloc(256, GFP_KERNEL))) {
+1 -1
drivers/s390/char/con3215.c
··· 688 raw->cdev = cdev; 689 raw->inbuf = (char *) raw + sizeof(struct raw3215_info); 690 memset(raw, 0, sizeof(struct raw3215_info)); 691 - raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE, 692 GFP_KERNEL|GFP_DMA); 693 if (raw->buffer == NULL) { 694 spin_lock(&raw3215_device_lock);
··· 688 raw->cdev = cdev; 689 raw->inbuf = (char *) raw + sizeof(struct raw3215_info); 690 memset(raw, 0, sizeof(struct raw3215_info)); 691 + raw->buffer = kmalloc(RAW3215_BUFFER_SIZE, 692 GFP_KERNEL|GFP_DMA); 693 if (raw->buffer == NULL) { 694 spin_lock(&raw3215_device_lock);
+1 -1
drivers/s390/char/keyboard.c
··· 377 if (!(key_map = kbd->key_maps[tmp.kb_table])) { 378 int j; 379 380 - key_map = (ushort *) kmalloc(sizeof(plain_map), 381 GFP_KERNEL); 382 if (!key_map) 383 return -ENOMEM;
··· 377 if (!(key_map = kbd->key_maps[tmp.kb_table])) { 378 int j; 379 380 + key_map = kmalloc(sizeof(plain_map), 381 GFP_KERNEL); 382 if (!key_map) 383 return -ENOMEM;
+1 -1
drivers/s390/char/sclp_cpi.c
··· 127 struct cpi_sccb *sccb; 128 struct cpi_evbuf *evb; 129 130 - req = (struct sclp_req *) kmalloc(sizeof(struct sclp_req), GFP_KERNEL); 131 if (req == NULL) 132 return ERR_PTR(-ENOMEM); 133 sccb = (struct cpi_sccb *) __get_free_page(GFP_KERNEL | GFP_DMA);
··· 127 struct cpi_sccb *sccb; 128 struct cpi_evbuf *evb; 129 130 + req = kmalloc(sizeof(struct sclp_req), GFP_KERNEL); 131 if (req == NULL) 132 return ERR_PTR(-ENOMEM); 133 sccb = (struct cpi_sccb *) __get_free_page(GFP_KERNEL | GFP_DMA);
+2 -2
drivers/s390/crypto/zcrypt_cex2a.c
··· 295 struct completion work; 296 int rc; 297 298 - ap_msg.message = (void *) kmalloc(CEX2A_MAX_MESSAGE_SIZE, GFP_KERNEL); 299 if (!ap_msg.message) 300 return -ENOMEM; 301 ap_msg.psmid = (((unsigned long long) current->pid) << 32) + ··· 337 struct completion work; 338 int rc; 339 340 - ap_msg.message = (void *) kmalloc(CEX2A_MAX_MESSAGE_SIZE, GFP_KERNEL); 341 if (!ap_msg.message) 342 return -ENOMEM; 343 ap_msg.psmid = (((unsigned long long) current->pid) << 32) +
··· 295 struct completion work; 296 int rc; 297 298 + ap_msg.message = kmalloc(CEX2A_MAX_MESSAGE_SIZE, GFP_KERNEL); 299 if (!ap_msg.message) 300 return -ENOMEM; 301 ap_msg.psmid = (((unsigned long long) current->pid) << 32) + ··· 337 struct completion work; 338 int rc; 339 340 + ap_msg.message = kmalloc(CEX2A_MAX_MESSAGE_SIZE, GFP_KERNEL); 341 if (!ap_msg.message) 342 return -ENOMEM; 343 ap_msg.psmid = (((unsigned long long) current->pid) << 32) +
+2 -2
drivers/s390/crypto/zcrypt_pcica.c
··· 279 struct completion work; 280 int rc; 281 282 - ap_msg.message = (void *) kmalloc(PCICA_MAX_MESSAGE_SIZE, GFP_KERNEL); 283 if (!ap_msg.message) 284 return -ENOMEM; 285 ap_msg.psmid = (((unsigned long long) current->pid) << 32) + ··· 321 struct completion work; 322 int rc; 323 324 - ap_msg.message = (void *) kmalloc(PCICA_MAX_MESSAGE_SIZE, GFP_KERNEL); 325 if (!ap_msg.message) 326 return -ENOMEM; 327 ap_msg.psmid = (((unsigned long long) current->pid) << 32) +
··· 279 struct completion work; 280 int rc; 281 282 + ap_msg.message = kmalloc(PCICA_MAX_MESSAGE_SIZE, GFP_KERNEL); 283 if (!ap_msg.message) 284 return -ENOMEM; 285 ap_msg.psmid = (((unsigned long long) current->pid) << 32) + ··· 321 struct completion work; 322 int rc; 323 324 + ap_msg.message = kmalloc(PCICA_MAX_MESSAGE_SIZE, GFP_KERNEL); 325 if (!ap_msg.message) 326 return -ENOMEM; 327 ap_msg.psmid = (((unsigned long long) current->pid) << 32) +
+1 -1
drivers/s390/crypto/zcrypt_pcixcc.c
··· 717 }; 718 int rc; 719 720 - ap_msg.message = (void *) kmalloc(PCIXCC_MAX_XCRB_MESSAGE_SIZE, GFP_KERNEL); 721 if (!ap_msg.message) 722 return -ENOMEM; 723 ap_msg.psmid = (((unsigned long long) current->pid) << 32) +
··· 717 }; 718 int rc; 719 720 + ap_msg.message = kmalloc(PCIXCC_MAX_XCRB_MESSAGE_SIZE, GFP_KERNEL); 721 if (!ap_msg.message) 722 return -ENOMEM; 723 ap_msg.psmid = (((unsigned long long) current->pid) << 32) +
+3 -3
drivers/s390/net/ctcmain.c
··· 1646 return -1; 1647 } 1648 memset(ch, 0, sizeof (struct channel)); 1649 - if ((ch->ccw = (struct ccw1 *) kmalloc(8*sizeof(struct ccw1), 1650 GFP_KERNEL | GFP_DMA)) == NULL) { 1651 kfree(ch); 1652 ctc_pr_warn("ctc: Out of memory in add_channel\n"); ··· 1693 return -1; 1694 } 1695 fsm_newstate(ch->fsm, CH_STATE_IDLE); 1696 - if ((ch->irb = (struct irb *) kmalloc(sizeof (struct irb), 1697 GFP_KERNEL)) == NULL) { 1698 ctc_pr_warn("ctc: Out of memory in add_channel\n"); 1699 kfree_fsm(ch->fsm); ··· 2535 DBF_TEXT(trace, 4, __FUNCTION__); 2536 if (!priv) 2537 return; 2538 - sbuf = (char *)kmalloc(2048, GFP_KERNEL); 2539 if (sbuf == NULL) 2540 return; 2541 p = sbuf;
··· 1646 return -1; 1647 } 1648 memset(ch, 0, sizeof (struct channel)); 1649 + if ((ch->ccw = kmalloc(8*sizeof(struct ccw1), 1650 GFP_KERNEL | GFP_DMA)) == NULL) { 1651 kfree(ch); 1652 ctc_pr_warn("ctc: Out of memory in add_channel\n"); ··· 1693 return -1; 1694 } 1695 fsm_newstate(ch->fsm, CH_STATE_IDLE); 1696 + if ((ch->irb = kmalloc(sizeof (struct irb), 1697 GFP_KERNEL)) == NULL) { 1698 ctc_pr_warn("ctc: Out of memory in add_channel\n"); 1699 kfree_fsm(ch->fsm); ··· 2535 DBF_TEXT(trace, 4, __FUNCTION__); 2536 if (!priv) 2537 return; 2538 + sbuf = kmalloc(2048, GFP_KERNEL); 2539 if (sbuf == NULL) 2540 return; 2541 p = sbuf;
+1 -1
drivers/s390/net/iucv.c
··· 772 } 773 774 /* Allocate handler entry */ 775 - new_handler = (handler *)kmalloc(sizeof(handler), GFP_ATOMIC); 776 if (new_handler == NULL) { 777 printk(KERN_WARNING "%s: storage allocation for new handler " 778 "failed.\n", __FUNCTION__);
··· 772 } 773 774 /* Allocate handler entry */ 775 + new_handler = kmalloc(sizeof(handler), GFP_ATOMIC); 776 if (new_handler == NULL) { 777 printk(KERN_WARNING "%s: storage allocation for new handler " 778 "failed.\n", __FUNCTION__);
+1 -1
drivers/s390/scsi/zfcp_aux.c
··· 237 return 0; 238 239 len = strlen(devstr) + 1; 240 - str = (char *) kmalloc(len, GFP_KERNEL); 241 if (!str) 242 goto err_out; 243 memcpy(str, devstr, len);
··· 237 return 0; 238 239 len = strlen(devstr) + 1; 240 + str = kmalloc(len, GFP_KERNEL); 241 if (!str) 242 goto err_out; 243 memcpy(str, devstr, len);
+1 -1
drivers/sbus/char/vfc_dev.c
··· 659 if (!cards) 660 return -ENODEV; 661 662 - vfc_dev_lst = (struct vfc_dev **)kmalloc(sizeof(struct vfc_dev *) * 663 (cards+1), 664 GFP_KERNEL); 665 if (vfc_dev_lst == NULL)
··· 659 if (!cards) 660 return -ENODEV; 661 662 + vfc_dev_lst = kmalloc(sizeof(struct vfc_dev *) * 663 (cards+1), 664 GFP_KERNEL); 665 if (vfc_dev_lst == NULL)
+1 -1
drivers/scsi/aacraid/aachba.c
··· 288 289 if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) 290 maximum_num_containers = MAXIMUM_NUM_CONTAINERS; 291 - fsa_dev_ptr = (struct fsa_dev_info *) kmalloc( 292 sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL); 293 if (!fsa_dev_ptr) { 294 aac_fib_free(fibptr);
··· 288 289 if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) 290 maximum_num_containers = MAXIMUM_NUM_CONTAINERS; 291 + fsa_dev_ptr = kmalloc( 292 sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL); 293 if (!fsa_dev_ptr) { 294 aac_fib_free(fibptr);
+1 -1
drivers/scsi/aacraid/comminit.c
··· 386 * Ok now init the communication subsystem 387 */ 388 389 - dev->queues = (struct aac_queue_block *) kmalloc(sizeof(struct aac_queue_block), GFP_KERNEL); 390 if (dev->queues == NULL) { 391 printk(KERN_ERR "Error could not allocate comm region.\n"); 392 return NULL;
··· 386 * Ok now init the communication subsystem 387 */ 388 389 + dev->queues = kmalloc(sizeof(struct aac_queue_block), GFP_KERNEL); 390 if (dev->queues == NULL) { 391 printk(KERN_ERR "Error could not allocate comm region.\n"); 392 return NULL;
+1 -1
drivers/scsi/aha1542.c
··· 699 #endif 700 int i; 701 ccb[mbo].op = 2; /* SCSI Initiator Command w/scatter-gather */ 702 - SCpnt->host_scribble = (unsigned char *) kmalloc(512, GFP_KERNEL | GFP_DMA); 703 sgpnt = (struct scatterlist *) SCpnt->request_buffer; 704 cptr = (struct chain *) SCpnt->host_scribble; 705 if (cptr == NULL) {
··· 699 #endif 700 int i; 701 ccb[mbo].op = 2; /* SCSI Initiator Command w/scatter-gather */ 702 + SCpnt->host_scribble = kmalloc(512, GFP_KERNEL | GFP_DMA); 703 sgpnt = (struct scatterlist *) SCpnt->request_buffer; 704 cptr = (struct chain *) SCpnt->host_scribble; 705 if (cptr == NULL) {
+1 -1
drivers/scsi/aic7xxx_old.c
··· 2565 } 2566 } 2567 scb_count = min( (i-1), p->scb_data->maxscbs - p->scb_data->numscbs); 2568 - scb_ap = (struct aic7xxx_scb *)kmalloc(sizeof (struct aic7xxx_scb) * scb_count 2569 + sizeof(struct aic7xxx_scb_dma), GFP_ATOMIC); 2570 if (scb_ap == NULL) 2571 return(0);
··· 2565 } 2566 } 2567 scb_count = min( (i-1), p->scb_data->maxscbs - p->scb_data->numscbs); 2568 + scb_ap = kmalloc(sizeof (struct aic7xxx_scb) * scb_count 2569 + sizeof(struct aic7xxx_scb_dma), GFP_ATOMIC); 2570 if (scb_ap == NULL) 2571 return(0);
+1 -1
drivers/scsi/dc395x.c
··· 4319 4320 dprintkdbg(DBG_1, "Allocate %i pages for SG tables\n", pages); 4321 while (pages--) { 4322 - ptr = (struct SGentry *)kmalloc(PAGE_SIZE, GFP_KERNEL); 4323 if (!ptr) { 4324 adapter_sg_tables_free(acb); 4325 return 1;
··· 4319 4320 dprintkdbg(DBG_1, "Allocate %i pages for SG tables\n", pages); 4321 while (pages--) { 4322 + ptr = kmalloc(PAGE_SIZE, GFP_KERNEL); 4323 if (!ptr) { 4324 adapter_sg_tables_free(acb); 4325 return 1;
+5 -5
drivers/scsi/dpt_i2o.c
··· 297 s32 rcode; 298 299 memset(msg, 0, sizeof(msg)); 300 - buf = (u8*)kmalloc(80,GFP_KERNEL|ADDR32); 301 if(!buf){ 302 printk(KERN_ERR"%s: Could not allocate buffer\n",pHba->name); 303 return; ··· 1311 schedule_timeout_uninterruptible(1); 1312 } while (m == EMPTY_QUEUE); 1313 1314 - status = (u8*)kmalloc(4, GFP_KERNEL|ADDR32); 1315 if(status == NULL) { 1316 adpt_send_nop(pHba, m); 1317 printk(KERN_ERR"IOP reset failed - no free memory.\n"); ··· 1444 } 1445 continue; 1446 } 1447 - d = (struct i2o_device *)kmalloc(sizeof(struct i2o_device), GFP_KERNEL); 1448 if(d==NULL) 1449 { 1450 printk(KERN_CRIT"%s: Out of memory for I2O device data.\n",pHba->name); ··· 2425 pDev = pDev->next_lun; 2426 } 2427 if(!pDev ) { // Something new add it 2428 - d = (struct i2o_device *)kmalloc(sizeof(struct i2o_device), GFP_KERNEL); 2429 if(d==NULL) 2430 { 2431 printk(KERN_CRIT "Out of memory for I2O device data.\n"); ··· 2728 2729 kfree(pHba->reply_pool); 2730 2731 - pHba->reply_pool = (u32*)kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32); 2732 if(!pHba->reply_pool){ 2733 printk(KERN_ERR"%s: Could not allocate reply pool\n",pHba->name); 2734 return -1;
··· 297 s32 rcode; 298 299 memset(msg, 0, sizeof(msg)); 300 + buf = kmalloc(80,GFP_KERNEL|ADDR32); 301 if(!buf){ 302 printk(KERN_ERR"%s: Could not allocate buffer\n",pHba->name); 303 return; ··· 1311 schedule_timeout_uninterruptible(1); 1312 } while (m == EMPTY_QUEUE); 1313 1314 + status = kmalloc(4, GFP_KERNEL|ADDR32); 1315 if(status == NULL) { 1316 adpt_send_nop(pHba, m); 1317 printk(KERN_ERR"IOP reset failed - no free memory.\n"); ··· 1444 } 1445 continue; 1446 } 1447 + d = kmalloc(sizeof(struct i2o_device), GFP_KERNEL); 1448 if(d==NULL) 1449 { 1450 printk(KERN_CRIT"%s: Out of memory for I2O device data.\n",pHba->name); ··· 2425 pDev = pDev->next_lun; 2426 } 2427 if(!pDev ) { // Something new add it 2428 + d = kmalloc(sizeof(struct i2o_device), GFP_KERNEL); 2429 if(d==NULL) 2430 { 2431 printk(KERN_CRIT "Out of memory for I2O device data.\n"); ··· 2728 2729 kfree(pHba->reply_pool); 2730 2731 + pHba->reply_pool = kmalloc(pHba->reply_fifo_size * REPLY_FRAME_SIZE * 4, GFP_KERNEL|ADDR32); 2732 if(!pHba->reply_pool){ 2733 printk(KERN_ERR"%s: Could not allocate reply pool\n",pHba->name); 2734 return -1;
+1 -1
drivers/scsi/initio.c
··· 2828 2829 for (; tul_num_scb >= MAX_TARGETS + 3; tul_num_scb--) { 2830 i = tul_num_ch * tul_num_scb * sizeof(SCB); 2831 - if ((tul_scb = (SCB *) kmalloc(i, GFP_ATOMIC | GFP_DMA)) != NULL) 2832 break; 2833 } 2834 if (tul_scb == NULL) {
··· 2828 2829 for (; tul_num_scb >= MAX_TARGETS + 3; tul_num_scb--) { 2830 i = tul_num_ch * tul_num_scb * sizeof(SCB); 2831 + if ((tul_scb = kmalloc(i, GFP_ATOMIC | GFP_DMA)) != NULL) 2832 break; 2833 } 2834 if (tul_scb == NULL) {
+1 -1
drivers/scsi/osst.c
··· 5777 dev_num = i; 5778 5779 /* allocate a struct osst_tape for this device */ 5780 - tpnt = (struct osst_tape *)kmalloc(sizeof(struct osst_tape), GFP_ATOMIC); 5781 if (tpnt == NULL) { 5782 write_unlock(&os_scsi_tapes_lock); 5783 printk(KERN_ERR "osst :E: Can't allocate device descriptor, device not attached.\n");
··· 5777 dev_num = i; 5778 5779 /* allocate a struct osst_tape for this device */ 5780 + tpnt = kmalloc(sizeof(struct osst_tape), GFP_ATOMIC); 5781 if (tpnt == NULL) { 5782 write_unlock(&os_scsi_tapes_lock); 5783 printk(KERN_ERR "osst :E: Can't allocate device descriptor, device not attached.\n");
+1 -1
drivers/scsi/pluto.c
··· 117 #endif 118 return 0; 119 } 120 - fcs = (struct ctrl_inquiry *) kmalloc (sizeof (struct ctrl_inquiry) * fcscount, GFP_DMA); 121 if (!fcs) { 122 printk ("PLUTO: Not enough memory to probe\n"); 123 return 0;
··· 117 #endif 118 return 0; 119 } 120 + fcs = kmalloc(sizeof (struct ctrl_inquiry) * fcscount, GFP_DMA); 121 if (!fcs) { 122 printk ("PLUTO: Not enough memory to probe\n"); 123 return 0;
+1 -1
drivers/scsi/sr_ioctl.c
··· 546 if (!xa_test) 547 return 0; 548 549 - raw_sector = (unsigned char *) kmalloc(2048, GFP_KERNEL | SR_GFP_DMA(cd)); 550 if (!raw_sector) 551 return -ENOMEM; 552 if (0 == sr_read_sector(cd, cd->ms_offset + 16,
··· 546 if (!xa_test) 547 return 0; 548 549 + raw_sector = kmalloc(2048, GFP_KERNEL | SR_GFP_DMA(cd)); 550 if (!raw_sector) 551 return -ENOMEM; 552 if (0 == sr_read_sector(cd, cd->ms_offset + 16,
+2 -2
drivers/scsi/sr_vendor.c
··· 117 density = (blocklength > 2048) ? 0x81 : 0x83; 118 #endif 119 120 - buffer = (unsigned char *) kmalloc(512, GFP_KERNEL | GFP_DMA); 121 if (!buffer) 122 return -ENOMEM; 123 ··· 164 if (cd->cdi.mask & CDC_MULTI_SESSION) 165 return 0; 166 167 - buffer = (unsigned char *) kmalloc(512, GFP_KERNEL | GFP_DMA); 168 if (!buffer) 169 return -ENOMEM; 170
··· 117 density = (blocklength > 2048) ? 0x81 : 0x83; 118 #endif 119 120 + buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); 121 if (!buffer) 122 return -ENOMEM; 123 ··· 164 if (cd->cdi.mask & CDC_MULTI_SESSION) 165 return 0; 166 167 + buffer = kmalloc(512, GFP_KERNEL | GFP_DMA); 168 if (!buffer) 169 return -ENOMEM; 170
+1 -1
drivers/usb/gadget/serial.c
··· 2195 if (size == 0) 2196 return NULL; 2197 2198 - gb = (struct gs_buf *)kmalloc(sizeof(struct gs_buf), kmalloc_flags); 2199 if (gb == NULL) 2200 return NULL; 2201
··· 2195 if (size == 0) 2196 return NULL; 2197 2198 + gb = kmalloc(sizeof(struct gs_buf), kmalloc_flags); 2199 if (gb == NULL) 2200 return NULL; 2201
+1 -1
drivers/usb/host/hc_crisv10.c
··· 365 /* Adds an urb_entry last in the list for this epid. */ 366 static inline void urb_list_add(struct urb *urb, int epid) 367 { 368 - urb_entry_t *urb_entry = (urb_entry_t *)kmalloc(sizeof(urb_entry_t), KMALLOC_FLAG); 369 assert(urb_entry); 370 371 urb_entry->urb = urb;
··· 365 /* Adds an urb_entry last in the list for this epid. */ 366 static inline void urb_list_add(struct urb *urb, int epid) 367 { 368 + urb_entry_t *urb_entry = kmalloc(sizeof(urb_entry_t), KMALLOC_FLAG); 369 assert(urb_entry); 370 371 urb_entry->urb = urb;
+2 -2
drivers/usb/misc/auerswald.c
··· 766 bep->bufp = kmalloc (bufsize, GFP_KERNEL); 767 if (!bep->bufp) 768 goto bl_fail; 769 - bep->dr = (struct usb_ctrlrequest *) kmalloc (sizeof (struct usb_ctrlrequest), GFP_KERNEL); 770 if (!bep->dr) 771 goto bl_fail; 772 bep->urbp = usb_alloc_urb (0, GFP_KERNEL); ··· 1969 info("device is a %s", cp->dev_desc); 1970 1971 /* get the maximum allowed control transfer length */ 1972 - pbuf = (__le16 *) kmalloc (2, GFP_KERNEL); /* use an allocated buffer because of urb target */ 1973 if (!pbuf) { 1974 err( "out of memory"); 1975 goto pfail;
··· 766 bep->bufp = kmalloc (bufsize, GFP_KERNEL); 767 if (!bep->bufp) 768 goto bl_fail; 769 + bep->dr = kmalloc(sizeof (struct usb_ctrlrequest), GFP_KERNEL); 770 if (!bep->dr) 771 goto bl_fail; 772 bep->urbp = usb_alloc_urb (0, GFP_KERNEL); ··· 1969 info("device is a %s", cp->dev_desc); 1970 1971 /* get the maximum allowed control transfer length */ 1972 + pbuf = kmalloc(2, GFP_KERNEL); /* use an allocated buffer because of urb target */ 1973 if (!pbuf) { 1974 err( "out of memory"); 1975 goto pfail;
+1 -1
drivers/usb/serial/cypress_m8.c
··· 1493 if (size == 0) 1494 return NULL; 1495 1496 - cb = (struct cypress_buf *)kmalloc(sizeof(struct cypress_buf), GFP_KERNEL); 1497 if (cb == NULL) 1498 return NULL; 1499
··· 1493 if (size == 0) 1494 return NULL; 1495 1496 + cb = kmalloc(sizeof(struct cypress_buf), GFP_KERNEL); 1497 if (cb == NULL) 1498 return NULL; 1499
+2 -2
drivers/usb/serial/digi_acceleport.c
··· 1681 for( i=0; i<serial->type->num_ports+1; i++ ) { 1682 1683 /* allocate port private structure */ 1684 - priv = (struct digi_port *)kmalloc( sizeof(struct digi_port), 1685 GFP_KERNEL ); 1686 if( priv == (struct digi_port *)0 ) { 1687 while( --i >= 0 ) ··· 1714 } 1715 1716 /* allocate serial private structure */ 1717 - serial_priv = (struct digi_serial *)kmalloc( sizeof(struct digi_serial), 1718 GFP_KERNEL ); 1719 if( serial_priv == (struct digi_serial *)0 ) { 1720 for( i=0; i<serial->type->num_ports+1; i++ )
··· 1681 for( i=0; i<serial->type->num_ports+1; i++ ) { 1682 1683 /* allocate port private structure */ 1684 + priv = kmalloc( sizeof(struct digi_port), 1685 GFP_KERNEL ); 1686 if( priv == (struct digi_port *)0 ) { 1687 while( --i >= 0 ) ··· 1714 } 1715 1716 /* allocate serial private structure */ 1717 + serial_priv = kmalloc( sizeof(struct digi_serial), 1718 GFP_KERNEL ); 1719 if( serial_priv == (struct digi_serial *)0 ) { 1720 for( i=0; i<serial->type->num_ports+1; i++ )
+1 -1
drivers/usb/serial/io_ti.c
··· 2811 if (size == 0) 2812 return NULL; 2813 2814 - eb = (struct edge_buf *)kmalloc(sizeof(struct edge_buf), GFP_KERNEL); 2815 if (eb == NULL) 2816 return NULL; 2817
··· 2811 if (size == 0) 2812 return NULL; 2813 2814 + eb = kmalloc(sizeof(struct edge_buf), GFP_KERNEL); 2815 if (eb == NULL) 2816 return NULL; 2817
+1 -1
drivers/usb/serial/ipaq.c
··· 595 596 bytes_in = 0; 597 bytes_out = 0; 598 - priv = (struct ipaq_private *)kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); 599 if (priv == NULL) { 600 err("%s - Out of memory", __FUNCTION__); 601 return -ENOMEM;
··· 595 596 bytes_in = 0; 597 bytes_out = 0; 598 + priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); 599 if (priv == NULL) { 600 err("%s - Out of memory", __FUNCTION__); 601 return -ENOMEM;
+2 -2
drivers/usb/serial/kobil_sct.c
··· 269 } 270 271 // allocate memory for write_urb transfer buffer 272 - port->write_urb->transfer_buffer = (unsigned char *) kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); 273 if (! port->write_urb->transfer_buffer) { 274 kfree(transfer_buffer); 275 usb_free_urb(port->write_urb); ··· 696 return 0; 697 698 case TCFLSH: // 0x540B 699 - transfer_buffer = (unsigned char *) kmalloc(transfer_buffer_length, GFP_KERNEL); 700 if (! transfer_buffer) { 701 return -ENOBUFS; 702 }
··· 269 } 270 271 // allocate memory for write_urb transfer buffer 272 + port->write_urb->transfer_buffer = kmalloc(write_urb_transfer_buffer_length, GFP_KERNEL); 273 if (! port->write_urb->transfer_buffer) { 274 kfree(transfer_buffer); 275 usb_free_urb(port->write_urb); ··· 696 return 0; 697 698 case TCFLSH: // 0x540B 699 + transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL); 700 if (! transfer_buffer) { 701 return -ENOBUFS; 702 }
+1 -1
drivers/usb/serial/pl2303.c
··· 159 if (size == 0) 160 return NULL; 161 162 - pb = (struct pl2303_buf *)kmalloc(sizeof(struct pl2303_buf), GFP_KERNEL); 163 if (pb == NULL) 164 return NULL; 165
··· 159 if (size == 0) 160 return NULL; 161 162 + pb = kmalloc(sizeof(struct pl2303_buf), GFP_KERNEL); 163 if (pb == NULL) 164 return NULL; 165
+1 -1
drivers/usb/serial/ti_usb_3410_5052.c
··· 1710 { 1711 struct circ_buf *cb; 1712 1713 - cb = (struct circ_buf *)kmalloc(sizeof(struct circ_buf), GFP_KERNEL); 1714 if (cb == NULL) 1715 return NULL; 1716
··· 1710 { 1711 struct circ_buf *cb; 1712 1713 + cb = kmalloc(sizeof(struct circ_buf), GFP_KERNEL); 1714 if (cb == NULL) 1715 return NULL; 1716
+2 -2
drivers/usb/serial/whiteheat.c
··· 416 for (i = 0; i < serial->num_ports; i++) { 417 port = serial->port[i]; 418 419 - info = (struct whiteheat_private *)kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); 420 if (info == NULL) { 421 err("%s: Out of memory for port structures\n", serial->type->description); 422 goto no_private; ··· 487 usb_set_serial_port_data(port, info); 488 } 489 490 - command_info = (struct whiteheat_command_private *)kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL); 491 if (command_info == NULL) { 492 err("%s: Out of memory for port structures\n", serial->type->description); 493 goto no_command_private;
··· 416 for (i = 0; i < serial->num_ports; i++) { 417 port = serial->port[i]; 418 419 + info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); 420 if (info == NULL) { 421 err("%s: Out of memory for port structures\n", serial->type->description); 422 goto no_private; ··· 487 usb_set_serial_port_data(port, info); 488 } 489 490 + command_info = kmalloc(sizeof(struct whiteheat_command_private), GFP_KERNEL); 491 if (command_info == NULL) { 492 err("%s: Out of memory for port structures\n", serial->type->description); 493 goto no_command_private;
+1 -1
drivers/usb/storage/sddr09.c
··· 646 return result; 647 } 648 649 - buf = (unsigned char *) kmalloc(bulklen, GFP_NOIO); 650 if (!buf) 651 return -ENOMEM; 652
··· 646 return result; 647 } 648 649 + buf = kmalloc(bulklen, GFP_NOIO); 650 if (!buf) 651 return -ENOMEM; 652
+1 -1
drivers/video/amba-clcd.c
··· 447 goto out; 448 } 449 450 - fb = (struct clcd_fb *) kmalloc(sizeof(struct clcd_fb), GFP_KERNEL); 451 if (!fb) { 452 printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n"); 453 ret = -ENOMEM;
··· 447 goto out; 448 } 449 450 + fb = kmalloc(sizeof(struct clcd_fb), GFP_KERNEL); 451 if (!fb) { 452 printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n"); 453 ret = -ENOMEM;
+1 -1
drivers/video/matrox/i2c-matroxfb.c
··· 146 unsigned long flags; 147 struct matroxfb_dh_maven_info* m2info; 148 149 - m2info = (struct matroxfb_dh_maven_info*)kmalloc(sizeof(*m2info), GFP_KERNEL); 150 if (!m2info) 151 return NULL; 152
··· 146 unsigned long flags; 147 struct matroxfb_dh_maven_info* m2info; 148 149 + m2info = kmalloc(sizeof(*m2info), GFP_KERNEL); 150 if (!m2info) 151 return NULL; 152
+1 -1
drivers/video/matrox/matroxfb_base.c
··· 2028 } 2029 2030 #ifdef CONFIG_FB_MATROX_MULTIHEAD 2031 - minfo = (struct matrox_fb_info*)kmalloc(sizeof(*minfo), GFP_KERNEL); 2032 if (!minfo) 2033 return -1; 2034 #else
··· 2028 } 2029 2030 #ifdef CONFIG_FB_MATROX_MULTIHEAD 2031 + minfo = kmalloc(sizeof(*minfo), GFP_KERNEL); 2032 if (!minfo) 2033 return -1; 2034 #else
+1 -1
drivers/video/matrox/matroxfb_crtc2.c
··· 694 /* hardware is CRTC2 incapable... */ 695 if (!ACCESS_FBINFO(devflags.crtc2)) 696 return NULL; 697 - m2info = (struct matroxfb_dh_fb_info*)kmalloc(sizeof(*m2info), GFP_KERNEL); 698 if (!m2info) { 699 printk(KERN_ERR "matroxfb_crtc2: Not enough memory for CRTC2 control structs\n"); 700 return NULL;
··· 694 /* hardware is CRTC2 incapable... */ 695 if (!ACCESS_FBINFO(devflags.crtc2)) 696 return NULL; 697 + m2info = kmalloc(sizeof(*m2info), GFP_KERNEL); 698 if (!m2info) { 699 printk(KERN_ERR "matroxfb_crtc2: Not enough memory for CRTC2 control structs\n"); 700 return NULL;
+1 -1
fs/autofs4/inode.c
··· 313 struct autofs_sb_info *sbi; 314 struct autofs_info *ino; 315 316 - sbi = (struct autofs_sb_info *) kmalloc(sizeof(*sbi), GFP_KERNEL); 317 if ( !sbi ) 318 goto fail_unlock; 319 DPRINTK("starting up, sbi = %p",sbi);
··· 313 struct autofs_sb_info *sbi; 314 struct autofs_info *ino; 315 316 + sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); 317 if ( !sbi ) 318 goto fail_unlock; 319 DPRINTK("starting up, sbi = %p",sbi);
+1 -1
fs/befs/btree.c
··· 260 goto error; 261 } 262 263 - this_node = (befs_btree_node *) kmalloc(sizeof (befs_btree_node), 264 GFP_NOFS); 265 if (!this_node) { 266 befs_error(sb, "befs_btree_find() failed to allocate %u "
··· 260 goto error; 261 } 262 263 + this_node = kmalloc(sizeof (befs_btree_node), 264 GFP_NOFS); 265 if (!this_node) { 266 befs_error(sb, "befs_btree_find() failed to allocate %u "
+3 -3
fs/befs/debug.c
··· 28 befs_error(const struct super_block *sb, const char *fmt, ...) 29 { 30 va_list args; 31 - char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL); 32 if (err_buf == NULL) { 33 printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); 34 return; ··· 46 befs_warning(const struct super_block *sb, const char *fmt, ...) 47 { 48 va_list args; 49 - char *err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL); 50 if (err_buf == NULL) { 51 printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); 52 return; ··· 70 char *err_buf = NULL; 71 72 if (BEFS_SB(sb)->mount_opts.debug) { 73 - err_buf = (char *) kmalloc(ERRBUFSIZE, GFP_KERNEL); 74 if (err_buf == NULL) { 75 printk(KERN_ERR "could not allocate %d bytes\n", 76 ERRBUFSIZE);
··· 28 befs_error(const struct super_block *sb, const char *fmt, ...) 29 { 30 va_list args; 31 + char *err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); 32 if (err_buf == NULL) { 33 printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); 34 return; ··· 46 befs_warning(const struct super_block *sb, const char *fmt, ...) 47 { 48 va_list args; 49 + char *err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); 50 if (err_buf == NULL) { 51 printk(KERN_ERR "could not allocate %d bytes\n", ERRBUFSIZE); 52 return; ··· 70 char *err_buf = NULL; 71 72 if (BEFS_SB(sb)->mount_opts.debug) { 73 + err_buf = kmalloc(ERRBUFSIZE, GFP_KERNEL); 74 if (err_buf == NULL) { 75 printk(KERN_ERR "could not allocate %d bytes\n", 76 ERRBUFSIZE);
+1 -1
fs/binfmt_misc.c
··· 311 312 err = -ENOMEM; 313 memsize = sizeof(Node) + count + 8; 314 - e = (Node *) kmalloc(memsize, GFP_USER); 315 if (!e) 316 goto out; 317
··· 311 312 err = -ENOMEM; 313 memsize = sizeof(Node) + count + 8; 314 + e = kmalloc(memsize, GFP_USER); 315 if (!e) 316 goto out; 317
+1 -1
fs/cifs/cifssmb.c
··· 4876 } else { 4877 /* Add file to outstanding requests */ 4878 /* BB change to kmem cache alloc */ 4879 - dnotify_req = (struct dir_notify_req *) kmalloc( 4880 sizeof(struct dir_notify_req), 4881 GFP_KERNEL); 4882 if(dnotify_req) {
··· 4876 } else { 4877 /* Add file to outstanding requests */ 4878 /* BB change to kmem cache alloc */ 4879 + dnotify_req = kmalloc( 4880 sizeof(struct dir_notify_req), 4881 GFP_KERNEL); 4882 if(dnotify_req) {
+2 -2
fs/jffs/inode-v23.c
··· 818 819 D1({ 820 int len = dentry->d_name.len; 821 - char *_name = (char *) kmalloc(len + 1, GFP_KERNEL); 822 memcpy(_name, dentry->d_name.name, len); 823 _name[len] = '\0'; 824 printk("***jffs_mkdir(): dir = 0x%p, name = \"%s\", " ··· 964 D1({ 965 int len = dentry->d_name.len; 966 const char *name = dentry->d_name.name; 967 - char *_name = (char *) kmalloc(len + 1, GFP_KERNEL); 968 memcpy(_name, name, len); 969 _name[len] = '\0'; 970 printk("***jffs_remove(): file = \"%s\", ino = %ld\n", _name, dentry->d_inode->i_ino);
··· 818 819 D1({ 820 int len = dentry->d_name.len; 821 + char *_name = kmalloc(len + 1, GFP_KERNEL); 822 memcpy(_name, dentry->d_name.name, len); 823 _name[len] = '\0'; 824 printk("***jffs_mkdir(): dir = 0x%p, name = \"%s\", " ··· 964 D1({ 965 int len = dentry->d_name.len; 966 const char *name = dentry->d_name.name; 967 + char *_name = kmalloc(len + 1, GFP_KERNEL); 968 memcpy(_name, name, len); 969 _name[len] = '\0'; 970 printk("***jffs_remove(): file = \"%s\", ino = %ld\n", _name, dentry->d_inode->i_ino);
+7 -7
fs/jffs/intrep.c
··· 436 int i, length; 437 438 /* Allocate read buffer */ 439 - read_buf = (__u8 *) kmalloc (sizeof(__u8) * 4096, GFP_KERNEL); 440 if (!read_buf) { 441 printk(KERN_NOTICE "kmalloc failed in jffs_checksum_flash()\n"); 442 return -ENOMEM; ··· 744 745 746 /* Allocate read buffers */ 747 - read_buf1 = (__u8 *) kmalloc (sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); 748 if (!read_buf1) 749 return -ENOMEM; 750 751 - read_buf2 = (__u8 *) kmalloc (sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); 752 if (!read_buf2) { 753 kfree(read_buf1); 754 return -ENOMEM; ··· 876 } 877 878 /* Allocate read buffer */ 879 - read_buf = (__u8 *) kmalloc (sizeof(__u8) * 4096, GFP_KERNEL); 880 if (!read_buf) { 881 flash_safe_release(fmc->mtd); 882 return -ENOMEM; ··· 1463 kfree(f->name); 1464 DJM(no_name--); 1465 } 1466 - if (!(f->name = (char *) kmalloc(raw_inode->nsize + 1, 1467 GFP_KERNEL))) { 1468 return -ENOMEM; 1469 } ··· 1737 printk("jffs_find_child(): Found \"%s\".\n", f->name); 1738 } 1739 else { 1740 - char *copy = (char *) kmalloc(len + 1, GFP_KERNEL); 1741 if (copy) { 1742 memcpy(copy, name, len); 1743 copy[len] = '\0'; ··· 2627 return; 2628 } 2629 2630 - if (!(space = (char *) kmalloc(indent + 1, GFP_KERNEL))) { 2631 printk("jffs_print_tree(): Out of memory!\n"); 2632 return; 2633 }
··· 436 int i, length; 437 438 /* Allocate read buffer */ 439 + read_buf = kmalloc(sizeof(__u8) * 4096, GFP_KERNEL); 440 if (!read_buf) { 441 printk(KERN_NOTICE "kmalloc failed in jffs_checksum_flash()\n"); 442 return -ENOMEM; ··· 744 745 746 /* Allocate read buffers */ 747 + read_buf1 = kmalloc(sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); 748 if (!read_buf1) 749 return -ENOMEM; 750 751 + read_buf2 = kmalloc(sizeof(__u8) * READ_AHEAD_BYTES, GFP_KERNEL); 752 if (!read_buf2) { 753 kfree(read_buf1); 754 return -ENOMEM; ··· 876 } 877 878 /* Allocate read buffer */ 879 + read_buf = kmalloc(sizeof(__u8) * 4096, GFP_KERNEL); 880 if (!read_buf) { 881 flash_safe_release(fmc->mtd); 882 return -ENOMEM; ··· 1463 kfree(f->name); 1464 DJM(no_name--); 1465 } 1466 + if (!(f->name = kmalloc(raw_inode->nsize + 1, 1467 GFP_KERNEL))) { 1468 return -ENOMEM; 1469 } ··· 1737 printk("jffs_find_child(): Found \"%s\".\n", f->name); 1738 } 1739 else { 1740 + char *copy = kmalloc(len + 1, GFP_KERNEL); 1741 if (copy) { 1742 memcpy(copy, name, len); 1743 copy[len] = '\0'; ··· 2627 return; 2628 } 2629 2630 + if (!(space = kmalloc(indent + 1, GFP_KERNEL))) { 2631 printk("jffs_print_tree(): Out of memory!\n"); 2632 return; 2633 }
+2 -2
fs/jfs/jfs_dtree.c
··· 3777 struct component_name lkey; 3778 struct component_name rkey; 3779 3780 - lkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), 3781 GFP_KERNEL); 3782 if (lkey.name == NULL) 3783 return -ENOMEM; 3784 3785 - rkey.name = (wchar_t *) kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), 3786 GFP_KERNEL); 3787 if (rkey.name == NULL) { 3788 kfree(lkey.name);
··· 3777 struct component_name lkey; 3778 struct component_name rkey; 3779 3780 + lkey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), 3781 GFP_KERNEL); 3782 if (lkey.name == NULL) 3783 return -ENOMEM; 3784 3785 + rkey.name = kmalloc((JFS_NAME_MAX + 1) * sizeof(wchar_t), 3786 GFP_KERNEL); 3787 if (rkey.name == NULL) { 3788 kfree(lkey.name);
+1 -1
fs/jfs/jfs_imap.c
··· 120 * allocate/initialize the in-memory inode map control structure 121 */ 122 /* allocate the in-memory inode map control structure. */ 123 - imap = (struct inomap *) kmalloc(sizeof(struct inomap), GFP_KERNEL); 124 if (imap == NULL) { 125 jfs_err("diMount: kmalloc returned NULL!"); 126 return -ENOMEM;
··· 120 * allocate/initialize the in-memory inode map control structure 121 */ 122 /* allocate the in-memory inode map control structure. */ 123 + imap = kmalloc(sizeof(struct inomap), GFP_KERNEL); 124 if (imap == NULL) { 125 jfs_err("diMount: kmalloc returned NULL!"); 126 return -ENOMEM;
+1 -1
fs/lockd/svcshare.c
··· 39 return nlm_lck_denied; 40 } 41 42 - share = (struct nlm_share *) kmalloc(sizeof(*share) + oh->len, 43 GFP_KERNEL); 44 if (share == NULL) 45 return nlm_lck_denied_nolocks;
··· 39 return nlm_lck_denied; 40 } 41 42 + share = kmalloc(sizeof(*share) + oh->len, 43 GFP_KERNEL); 44 if (share == NULL) 45 return nlm_lck_denied_nolocks;
+1 -1
fs/nfs/nfs4proc.c
··· 1877 struct nfs_server *server = NFS_SERVER(dir->d_inode); 1878 struct unlink_desc *up; 1879 1880 - up = (struct unlink_desc *) kmalloc(sizeof(*up), GFP_KERNEL); 1881 if (!up) 1882 return -ENOMEM; 1883
··· 1877 struct nfs_server *server = NFS_SERVER(dir->d_inode); 1878 struct unlink_desc *up; 1879 1880 + up = kmalloc(sizeof(*up), GFP_KERNEL); 1881 if (!up) 1882 return -ENOMEM; 1883
+1 -1
fs/reiserfs/xattr_acl.c
··· 135 int n; 136 137 *size = reiserfs_acl_size(acl->a_count); 138 - ext_acl = (reiserfs_acl_header *) kmalloc(sizeof(reiserfs_acl_header) + 139 acl->a_count * 140 sizeof(reiserfs_acl_entry), 141 GFP_NOFS);
··· 135 int n; 136 137 *size = reiserfs_acl_size(acl->a_count); 138 + ext_acl = kmalloc(sizeof(reiserfs_acl_header) + 139 acl->a_count * 140 sizeof(reiserfs_acl_entry), 141 GFP_NOFS);
+1 -1
include/asm-avr32/pgalloc.h
··· 28 static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) 29 { 30 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); 31 - pgd_t *pgd = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL); 32 33 if (pgd) 34 memset(pgd, 0, pgd_size);
··· 28 static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) 29 { 30 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); 31 + pgd_t *pgd = kmalloc(pgd_size, GFP_KERNEL); 32 33 if (pgd) 34 memset(pgd, 0, pgd_size);
+1 -1
include/asm-sh64/pgalloc.h
··· 41 static inline pgd_t *get_pgd_slow(void) 42 { 43 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); 44 - pgd_t *ret = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL); 45 return ret; 46 } 47
··· 41 static inline pgd_t *get_pgd_slow(void) 42 { 43 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); 44 + pgd_t *ret = kmalloc(pgd_size, GFP_KERNEL); 45 return ret; 46 } 47
+1 -1
include/linux/coda_linux.h
··· 64 65 #define CODA_ALLOC(ptr, cast, size) do { \ 66 if (size < PAGE_SIZE) \ 67 - ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \ 68 else \ 69 ptr = (cast)vmalloc((unsigned long) size); \ 70 if (!ptr) \
··· 64 65 #define CODA_ALLOC(ptr, cast, size) do { \ 66 if (size < PAGE_SIZE) \ 67 + ptr = kmalloc((unsigned long) size, GFP_KERNEL); \ 68 else \ 69 ptr = (cast)vmalloc((unsigned long) size); \ 70 if (!ptr) \
+2 -2
ipc/msgutil.c
··· 36 if (alen > DATALEN_MSG) 37 alen = DATALEN_MSG; 38 39 - msg = (struct msg_msg *)kmalloc(sizeof(*msg) + alen, GFP_KERNEL); 40 if (msg == NULL) 41 return ERR_PTR(-ENOMEM); 42 ··· 56 alen = len; 57 if (alen > DATALEN_SEG) 58 alen = DATALEN_SEG; 59 - seg = (struct msg_msgseg *)kmalloc(sizeof(*seg) + alen, 60 GFP_KERNEL); 61 if (seg == NULL) { 62 err = -ENOMEM;
··· 36 if (alen > DATALEN_MSG) 37 alen = DATALEN_MSG; 38 39 + msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL); 40 if (msg == NULL) 41 return ERR_PTR(-ENOMEM); 42 ··· 56 alen = len; 57 if (alen > DATALEN_SEG) 58 alen = DATALEN_SEG; 59 + seg = kmalloc(sizeof(*seg) + alen, 60 GFP_KERNEL); 61 if (seg == NULL) { 62 err = -ENOMEM;
+1 -1
net/tipc/config.c
··· 208 209 if (mng.link_subscriptions > 64) 210 break; 211 - sub = (struct subscr_data *)kmalloc(sizeof(*sub), 212 GFP_ATOMIC); 213 if (sub == NULL) { 214 warn("Memory squeeze; dropped remote link subscription\n");
··· 208 209 if (mng.link_subscriptions > 64) 210 break; 211 + sub = kmalloc(sizeof(*sub), 212 GFP_ATOMIC); 213 if (sub == NULL) { 214 warn("Memory squeeze; dropped remote link subscription\n");
+1 -1
sound/core/oss/mixer_oss.c
··· 1023 } 1024 up_read(&mixer->card->controls_rwsem); 1025 if (slot.present != 0) { 1026 - pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL); 1027 if (! pslot) 1028 return -ENOMEM; 1029 *pslot = slot;
··· 1023 } 1024 up_read(&mixer->card->controls_rwsem); 1025 if (slot.present != 0) { 1026 + pslot = kmalloc(sizeof(slot), GFP_KERNEL); 1027 if (! pslot) 1028 return -ENOMEM; 1029 *pslot = slot;
+1 -1
sound/oss/ad1848.c
··· 1992 devc->audio_flags |= DMA_DUPLEX; 1993 } 1994 1995 - portc = (ad1848_port_info *) kmalloc(sizeof(ad1848_port_info), GFP_KERNEL); 1996 if(portc==NULL) { 1997 release_region(devc->base, 4); 1998 return -1;
··· 1992 devc->audio_flags |= DMA_DUPLEX; 1993 } 1994 1995 + portc = kmalloc(sizeof(ad1848_port_info), GFP_KERNEL); 1996 if(portc==NULL) { 1997 release_region(devc->base, 4); 1998 return -1;
+1 -1
sound/oss/cs4232.c
··· 408 { 409 struct address_info *isapnpcfg; 410 411 - isapnpcfg=(struct address_info*)kmalloc(sizeof(*isapnpcfg),GFP_KERNEL); 412 if (!isapnpcfg) 413 return -ENOMEM; 414
··· 408 { 409 struct address_info *isapnpcfg; 410 411 + isapnpcfg = kmalloc(sizeof(*isapnpcfg),GFP_KERNEL); 412 if (!isapnpcfg) 413 return -ENOMEM; 414
+3 -3
sound/oss/emu10k1/audio.c
··· 1139 1140 match: 1141 1142 - wave_dev = (struct emu10k1_wavedevice *) kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL); 1143 1144 if (wave_dev == NULL) { 1145 ERROR(); ··· 1155 /* Recording */ 1156 struct wiinst *wiinst; 1157 1158 - if ((wiinst = (struct wiinst *) kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) { 1159 ERROR(); 1160 kfree(wave_dev); 1161 return -ENOMEM; ··· 1211 struct woinst *woinst; 1212 int i; 1213 1214 - if ((woinst = (struct woinst *) kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) { 1215 ERROR(); 1216 kfree(wave_dev); 1217 return -ENOMEM;
··· 1139 1140 match: 1141 1142 + wave_dev = kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL); 1143 1144 if (wave_dev == NULL) { 1145 ERROR(); ··· 1155 /* Recording */ 1156 struct wiinst *wiinst; 1157 1158 + if ((wiinst = kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) { 1159 ERROR(); 1160 kfree(wave_dev); 1161 return -ENOMEM; ··· 1211 struct woinst *woinst; 1212 int i; 1213 1214 + if ((woinst = kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) { 1215 ERROR(); 1216 kfree(wave_dev); 1217 return -ENOMEM;
+1 -1
sound/oss/emu10k1/cardmi.c
··· 157 midihdr->flags |= MIDIBUF_INQUEUE; /* set */ 158 midihdr->flags &= ~MIDIBUF_DONE; /* clear */ 159 160 - if ((midiq = (struct midi_queue *) kmalloc(sizeof(struct midi_queue), GFP_ATOMIC)) == NULL) { 161 /* Message lost */ 162 return -1; 163 }
··· 157 midihdr->flags |= MIDIBUF_INQUEUE; /* set */ 158 midihdr->flags &= ~MIDIBUF_DONE; /* clear */ 159 160 + if ((midiq = kmalloc(sizeof(struct midi_queue), GFP_ATOMIC)) == NULL) { 161 /* Message lost */ 162 return -1; 163 }
+1 -1
sound/oss/emu10k1/cardmo.c
··· 117 midihdr->flags |= MIDIBUF_INQUEUE; 118 midihdr->flags &= ~MIDIBUF_DONE; 119 120 - if ((midiq = (struct midi_queue *) kmalloc(sizeof(struct midi_queue), GFP_KERNEL)) == NULL) { 121 /* Message lost */ 122 return -1; 123 }
··· 117 midihdr->flags |= MIDIBUF_INQUEUE; 118 midihdr->flags &= ~MIDIBUF_DONE; 119 120 + if ((midiq = kmalloc(sizeof(struct midi_queue), GFP_KERNEL)) == NULL) { 121 /* Message lost */ 122 return -1; 123 }
+5 -5
sound/oss/emu10k1/midi.c
··· 58 { 59 struct midi_hdr *midihdr; 60 61 - if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) { 62 ERROR(); 63 return -EINVAL; 64 } ··· 128 mutex_lock(&card->open_sem); 129 } 130 131 - if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) 132 return -EINVAL; 133 134 midi_dev->card = card; ··· 328 if (!access_ok(VERIFY_READ, buffer, count)) 329 return -EFAULT; 330 331 - if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) 332 return -EINVAL; 333 334 midihdr->bufferlength = count; ··· 490 491 DPF(2, "emu10k1_seq_midi_open()\n"); 492 493 - if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) 494 return -EINVAL; 495 496 midi_dev->card = card; ··· 540 541 card = midi_devs[dev]->devc; 542 543 - if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) 544 return -EINVAL; 545 546 midihdr->bufferlength = 1;
··· 58 { 59 struct midi_hdr *midihdr; 60 61 + if ((midihdr = kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) { 62 ERROR(); 63 return -EINVAL; 64 } ··· 128 mutex_lock(&card->open_sem); 129 } 130 131 + if ((midi_dev = kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) 132 return -EINVAL; 133 134 midi_dev->card = card; ··· 328 if (!access_ok(VERIFY_READ, buffer, count)) 329 return -EFAULT; 330 331 + if ((midihdr = kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) 332 return -EINVAL; 333 334 midihdr->bufferlength = count; ··· 490 491 DPF(2, "emu10k1_seq_midi_open()\n"); 492 493 + if ((midi_dev = kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) 494 return -EINVAL; 495 496 midi_dev->card = card; ··· 540 541 card = midi_devs[dev]->devc; 542 543 + if ((midihdr = kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) 544 return -EINVAL; 545 546 midihdr->bufferlength = 1;
+1 -1
sound/oss/emu10k1/mixer.c
··· 194 195 case SOUND_MIXER_PRIVATE3: 196 197 - ctl = (struct mixer_private_ioctl *) kmalloc(sizeof(struct mixer_private_ioctl), GFP_KERNEL); 198 if (ctl == NULL) 199 return -ENOMEM; 200
··· 194 195 case SOUND_MIXER_PRIVATE3: 196 197 + ctl = kmalloc(sizeof(struct mixer_private_ioctl), GFP_KERNEL); 198 if (ctl == NULL) 199 return -ENOMEM; 200
+1 -1
sound/oss/hal2.c
··· 1435 int ret = 0; 1436 struct hal2_card *hal2; 1437 1438 - hal2 = (struct hal2_card *) kmalloc(sizeof(struct hal2_card), GFP_KERNEL); 1439 if (!hal2) 1440 return -ENOMEM; 1441 memset(hal2, 0, sizeof(struct hal2_card));
··· 1435 int ret = 0; 1436 struct hal2_card *hal2; 1437 1438 + hal2 = kmalloc(sizeof(struct hal2_card), GFP_KERNEL); 1439 if (!hal2) 1440 return -ENOMEM; 1441 memset(hal2, 0, sizeof(struct hal2_card));
+1 -1
sound/oss/mpu401.c
··· 1023 devc->capabilities |= MPU_CAP_INTLG; /* Supports intelligent mode */ 1024 1025 1026 - mpu401_synth_operations[m] = (struct synth_operations *)kmalloc(sizeof(struct synth_operations), GFP_KERNEL); 1027 1028 if (mpu401_synth_operations[m] == NULL) 1029 {
··· 1023 devc->capabilities |= MPU_CAP_INTLG; /* Supports intelligent mode */ 1024 1025 1026 + mpu401_synth_operations[m] = kmalloc(sizeof(struct synth_operations), GFP_KERNEL); 1027 1028 if (mpu401_synth_operations[m] == NULL) 1029 {
+1 -1
sound/oss/opl3.c
··· 166 return 0; 167 } 168 169 - devc = (struct opl_devinfo *)kmalloc(sizeof(*devc), GFP_KERNEL); 170 171 if (devc == NULL) 172 {
··· 166 return 0; 167 } 168 169 + devc = kmalloc(sizeof(*devc), GFP_KERNEL); 170 171 if (devc == NULL) 172 {
+1 -1
sound/oss/sb_common.c
··· 625 */ 626 627 628 - detected_devc = (sb_devc *)kmalloc(sizeof(sb_devc), GFP_KERNEL); 629 if (detected_devc == NULL) 630 { 631 printk(KERN_ERR "sb: Can't allocate memory for device information\n");
··· 625 */ 626 627 628 + detected_devc = kmalloc(sizeof(sb_devc), GFP_KERNEL); 629 if (detected_devc == NULL) 630 { 631 printk(KERN_ERR "sb: Can't allocate memory for device information\n");
+2 -2
sound/oss/sb_midi.c
··· 173 return; 174 } 175 std_midi_synth.midi_dev = devc->my_mididev = dev; 176 - midi_devs[dev] = (struct midi_operations *)kmalloc(sizeof(struct midi_operations), GFP_KERNEL); 177 if (midi_devs[dev] == NULL) 178 { 179 printk(KERN_WARNING "Sound Blaster: failed to allocate MIDI memory.\n"); ··· 189 midi_devs[dev]->devc = devc; 190 191 192 - midi_devs[dev]->converter = (struct synth_operations *)kmalloc(sizeof(struct synth_operations), GFP_KERNEL); 193 if (midi_devs[dev]->converter == NULL) 194 { 195 printk(KERN_WARNING "Sound Blaster: failed to allocate MIDI memory.\n");
··· 173 return; 174 } 175 std_midi_synth.midi_dev = devc->my_mididev = dev; 176 + midi_devs[dev] = kmalloc(sizeof(struct midi_operations), GFP_KERNEL); 177 if (midi_devs[dev] == NULL) 178 { 179 printk(KERN_WARNING "Sound Blaster: failed to allocate MIDI memory.\n"); ··· 189 midi_devs[dev]->devc = devc; 190 191 192 + midi_devs[dev]->converter = kmalloc(sizeof(struct synth_operations), GFP_KERNEL); 193 if (midi_devs[dev]->converter == NULL) 194 { 195 printk(KERN_WARNING "Sound Blaster: failed to allocate MIDI memory.\n");
+1 -1
sound/oss/sb_mixer.c
··· 734 if (m == -1) 735 return 0; 736 737 - mixer_devs[m] = (struct mixer_operations *)kmalloc(sizeof(struct mixer_operations), GFP_KERNEL); 738 if (mixer_devs[m] == NULL) 739 { 740 printk(KERN_ERR "sb_mixer: Can't allocate memory\n");
··· 734 if (m == -1) 735 return 0; 736 737 + mixer_devs[m] = kmalloc(sizeof(struct mixer_operations), GFP_KERNEL); 738 if (mixer_devs[m] == NULL) 739 { 740 printk(KERN_ERR "sb_mixer: Can't allocate memory\n");
+1 -1
sound/oss/v_midi.c
··· 183 return; 184 } 185 186 - m=(struct vmidi_memory *)kmalloc(sizeof(struct vmidi_memory), GFP_KERNEL); 187 if (m == NULL) 188 { 189 printk(KERN_WARNING "Loopback MIDI: Failed to allocate memory\n");
··· 183 return; 184 } 185 186 + m = kmalloc(sizeof(struct vmidi_memory), GFP_KERNEL); 187 if (m == NULL) 188 { 189 printk(KERN_WARNING "Loopback MIDI: Failed to allocate memory\n");
+1 -1
sound/oss/waveartist.c
··· 1267 conf_printf2(dev_name, devc->hw.io_base, devc->hw.irq, 1268 devc->hw.dma, devc->hw.dma2); 1269 1270 - portc = (wavnc_port_info *)kmalloc(sizeof(wavnc_port_info), GFP_KERNEL); 1271 if (portc == NULL) 1272 goto nomem; 1273
··· 1267 conf_printf2(dev_name, devc->hw.io_base, devc->hw.irq, 1268 devc->hw.dma, devc->hw.dma2); 1269 1270 + portc = kmalloc(sizeof(wavnc_port_info), GFP_KERNEL); 1271 if (portc == NULL) 1272 goto nomem; 1273