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

treewide: kzalloc() -> kcalloc()

The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:

kzalloc(a * b, gfp)

with:
kcalloc(a * b, gfp)

as well as handling cases of:

kzalloc(a * b * c, gfp)

with:

kzalloc(array3_size(a, b, c), gfp)

as it's slightly less ugly than:

kzalloc_array(array_size(a, b), c, gfp)

This does, however, attempt to ignore constant size factors like:

kzalloc(4 * 1024, gfp)

though any constants defined via macros get caught up in the conversion.

Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.

The Coccinelle script used for this was:

// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@

(
kzalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kzalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)

// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@

(
kzalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)

// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@

(
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)

// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@

- kzalloc
+ kcalloc
(
- SIZE * COUNT
+ COUNT, SIZE
, ...)

// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@

(
kzalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)

// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@

(
kzalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)

// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@

(
kzalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)

// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@

(
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)

// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@

(
kzalloc(sizeof(THING) * C2, ...)
|
kzalloc(sizeof(TYPE) * C2, ...)
|
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * E2
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- E1 * E2
+ E1, E2
, ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>

+1177 -977
+1 -1
arch/arm/mach-footbridge/dc21285.c
··· 252 252 if (nr || !footbridge_cfn_mode()) 253 253 return 0; 254 254 255 - res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL); 255 + res = kcalloc(2, sizeof(struct resource), GFP_KERNEL); 256 256 if (!res) { 257 257 printk("out of memory for root bus resources"); 258 258 return 0;
+1 -1
arch/arm/mach-ixp4xx/common-pci.c
··· 421 421 if (nr >= 1) 422 422 return 0; 423 423 424 - res = kzalloc(sizeof(*res) * 2, GFP_KERNEL); 424 + res = kcalloc(2, sizeof(*res), GFP_KERNEL); 425 425 if (res == NULL) { 426 426 /* 427 427 * If we're out of memory this early, something is wrong,
+1 -1
arch/arm/mach-omap1/mcbsp.c
··· 389 389 { 390 390 int i; 391 391 392 - omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *), 392 + omap_mcbsp_devices = kcalloc(size, sizeof(struct platform_device *), 393 393 GFP_KERNEL); 394 394 if (!omap_mcbsp_devices) { 395 395 printk(KERN_ERR "Could not register McBSP devices\n");
+1 -1
arch/arm/mach-omap2/hsmmc.c
··· 35 35 { 36 36 char *hc_name; 37 37 38 - hc_name = kzalloc(sizeof(char) * (HSMMC_NAME_LEN + 1), GFP_KERNEL); 38 + hc_name = kzalloc(HSMMC_NAME_LEN + 1, GFP_KERNEL); 39 39 if (!hc_name) { 40 40 kfree(hc_name); 41 41 return -ENOMEM;
+2 -2
arch/arm/mach-omap2/omap_device.c
··· 155 155 if (!omap_hwmod_parse_module_range(NULL, node, &res)) 156 156 return -ENODEV; 157 157 158 - hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL); 158 + hwmods = kcalloc(oh_cnt, sizeof(struct omap_hwmod *), GFP_KERNEL); 159 159 if (!hwmods) { 160 160 ret = -ENOMEM; 161 161 goto odbfd_exit; ··· 405 405 goto error; 406 406 } 407 407 408 - res = kzalloc(sizeof(*res) * 2, GFP_KERNEL); 408 + res = kcalloc(2, sizeof(*res), GFP_KERNEL); 409 409 if (!res) 410 410 return -ENOMEM; 411 411
+5 -4
arch/arm/mach-omap2/prm_common.c
··· 285 285 286 286 prcm_irq_setup = irq_setup; 287 287 288 - prcm_irq_chips = kzalloc(sizeof(void *) * nr_regs, GFP_KERNEL); 289 - prcm_irq_setup->saved_mask = kzalloc(sizeof(u32) * nr_regs, GFP_KERNEL); 290 - prcm_irq_setup->priority_mask = kzalloc(sizeof(u32) * nr_regs, 291 - GFP_KERNEL); 288 + prcm_irq_chips = kcalloc(nr_regs, sizeof(void *), GFP_KERNEL); 289 + prcm_irq_setup->saved_mask = kcalloc(nr_regs, sizeof(u32), 290 + GFP_KERNEL); 291 + prcm_irq_setup->priority_mask = kcalloc(nr_regs, sizeof(u32), 292 + GFP_KERNEL); 292 293 293 294 if (!prcm_irq_chips || !prcm_irq_setup->saved_mask || 294 295 !prcm_irq_setup->priority_mask)
+1 -1
arch/arm/mach-vexpress/spc.c
··· 403 403 uint32_t data = 0, off, ret, idx; 404 404 struct ve_spc_opp *opps; 405 405 406 - opps = kzalloc(sizeof(*opps) * MAX_OPPS, GFP_KERNEL); 406 + opps = kcalloc(MAX_OPPS, sizeof(*opps), GFP_KERNEL); 407 407 if (!opps) 408 408 return -ENOMEM; 409 409
+2 -2
arch/arm/mm/dma-mapping.c
··· 2162 2162 goto err; 2163 2163 2164 2164 mapping->bitmap_size = bitmap_size; 2165 - mapping->bitmaps = kzalloc(extensions * sizeof(unsigned long *), 2166 - GFP_KERNEL); 2165 + mapping->bitmaps = kcalloc(extensions, sizeof(unsigned long *), 2166 + GFP_KERNEL); 2167 2167 if (!mapping->bitmaps) 2168 2168 goto err2; 2169 2169
+2 -2
arch/arm64/kernel/armv8_deprecated.c
··· 234 234 struct insn_emulation *insn; 235 235 struct ctl_table *insns_sysctl, *sysctl; 236 236 237 - insns_sysctl = kzalloc(sizeof(*sysctl) * (nr_insn_emulated + 1), 238 - GFP_KERNEL); 237 + insns_sysctl = kcalloc(nr_insn_emulated + 1, sizeof(*sysctl), 238 + GFP_KERNEL); 239 239 240 240 raw_spin_lock_irqsave(&insn_emulation_lock, flags); 241 241 list_for_each_entry(insn, &insn_emulation, node) {
+1 -1
arch/arm64/mm/context.c
··· 263 263 */ 264 264 WARN_ON(NUM_USER_ASIDS - 1 <= num_possible_cpus()); 265 265 atomic64_set(&asid_generation, ASID_FIRST_VERSION); 266 - asid_map = kzalloc(BITS_TO_LONGS(NUM_USER_ASIDS) * sizeof(*asid_map), 266 + asid_map = kcalloc(BITS_TO_LONGS(NUM_USER_ASIDS), sizeof(*asid_map), 267 267 GFP_KERNEL); 268 268 if (!asid_map) 269 269 panic("Failed to allocate bitmap for %lu ASIDs\n",
+3 -3
arch/ia64/kernel/topology.c
··· 85 85 } 86 86 #endif 87 87 88 - sysfs_cpus = kzalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL); 88 + sysfs_cpus = kcalloc(NR_CPUS, sizeof(struct ia64_cpu), GFP_KERNEL); 89 89 if (!sysfs_cpus) 90 90 panic("kzalloc in topology_init failed - NR_CPUS too big?"); 91 91 ··· 319 319 return -1; 320 320 } 321 321 322 - this_cache=kzalloc(sizeof(struct cache_info)*unique_caches, 323 - GFP_KERNEL); 322 + this_cache=kcalloc(unique_caches, sizeof(struct cache_info), 323 + GFP_KERNEL); 324 324 if (this_cache == NULL) 325 325 return -ENOMEM; 326 326
+1 -1
arch/ia64/sn/kernel/io_common.c
··· 132 132 printk_once(KERN_WARNING 133 133 "PROM version < 4.50 -- implementing old PROM flush WAR\n"); 134 134 135 - war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL); 135 + war_list = kcalloc(DEV_PER_WIDGET, sizeof(*war_list), GFP_KERNEL); 136 136 BUG_ON(!war_list); 137 137 138 138 SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
+1 -1
arch/ia64/sn/pci/pcibr/pcibr_provider.c
··· 184 184 /* Setup the PMU ATE map */ 185 185 soft->pbi_int_ate_resource.lowest_free_index = 0; 186 186 soft->pbi_int_ate_resource.ate = 187 - kzalloc(soft->pbi_int_ate_size * sizeof(u64), GFP_KERNEL); 187 + kcalloc(soft->pbi_int_ate_size, sizeof(u64), GFP_KERNEL); 188 188 189 189 if (!soft->pbi_int_ate_resource.ate) { 190 190 kfree(soft);
+1 -1
arch/mips/alchemy/common/clock.c
··· 985 985 return -ENODEV; 986 986 } 987 987 988 - a = kzalloc((sizeof(*a)) * 6, GFP_KERNEL); 988 + a = kcalloc(6, sizeof(*a), GFP_KERNEL); 989 989 if (!a) 990 990 return -ENOMEM; 991 991
+1 -1
arch/mips/alchemy/common/dbdma.c
··· 1050 1050 { 1051 1051 int ret; 1052 1052 1053 - dbdev_tab = kzalloc(sizeof(dbdev_tab_t) * DBDEV_TAB_SIZE, GFP_KERNEL); 1053 + dbdev_tab = kcalloc(DBDEV_TAB_SIZE, sizeof(dbdev_tab_t), GFP_KERNEL); 1054 1054 if (!dbdev_tab) 1055 1055 return -ENOMEM; 1056 1056
+2 -2
arch/mips/alchemy/common/platform.c
··· 115 115 uartclk = clk_get_rate(clk); 116 116 clk_put(clk); 117 117 118 - ports = kzalloc(s * (c + 1), GFP_KERNEL); 118 + ports = kcalloc(s, (c + 1), GFP_KERNEL); 119 119 if (!ports) { 120 120 printk(KERN_INFO "Alchemy: no memory for UART data\n"); 121 121 return; ··· 198 198 199 199 static int __init _new_usbres(struct resource **r, struct platform_device **d) 200 200 { 201 - *r = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL); 201 + *r = kcalloc(2, sizeof(struct resource), GFP_KERNEL); 202 202 if (!*r) 203 203 return -ENOMEM; 204 204 *d = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
+2 -2
arch/mips/alchemy/devboards/platform.c
··· 103 103 if (stschg_irq) 104 104 cnt++; 105 105 106 - sr = kzalloc(sizeof(struct resource) * cnt, GFP_KERNEL); 106 + sr = kcalloc(cnt, sizeof(struct resource), GFP_KERNEL); 107 107 if (!sr) 108 108 return -ENOMEM; 109 109 ··· 178 178 return -EINVAL; 179 179 180 180 ret = -ENOMEM; 181 - parts = kzalloc(sizeof(struct mtd_partition) * 5, GFP_KERNEL); 181 + parts = kcalloc(5, sizeof(struct mtd_partition), GFP_KERNEL); 182 182 if (!parts) 183 183 goto out; 184 184
+1 -1
arch/mips/bmips/dma.c
··· 94 94 goto out_bad; 95 95 96 96 /* add a dummy (zero) entry at the end as a sentinel */ 97 - bmips_dma_ranges = kzalloc(sizeof(struct bmips_dma_range) * (len + 1), 97 + bmips_dma_ranges = kcalloc(len + 1, sizeof(struct bmips_dma_range), 98 98 GFP_KERNEL); 99 99 if (!bmips_dma_ranges) 100 100 goto out_bad;
+1 -1
arch/mips/txx9/rbtx4939/setup.c
··· 219 219 "nand-disk", 220 220 }; 221 221 222 - leds_data = kzalloc(sizeof(*leds_data) * RBTX4939_MAX_7SEGLEDS, 222 + leds_data = kcalloc(RBTX4939_MAX_7SEGLEDS, sizeof(*leds_data), 223 223 GFP_KERNEL); 224 224 if (!leds_data) 225 225 return -ENOMEM;
+2 -2
arch/powerpc/kernel/vdso.c
··· 791 791 792 792 #ifdef CONFIG_VDSO32 793 793 /* Make sure pages are in the correct state */ 794 - vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 2), 794 + vdso32_pagelist = kcalloc(vdso32_pages + 2, sizeof(struct page *), 795 795 GFP_KERNEL); 796 796 BUG_ON(vdso32_pagelist == NULL); 797 797 for (i = 0; i < vdso32_pages; i++) { ··· 805 805 #endif 806 806 807 807 #ifdef CONFIG_PPC64 808 - vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 2), 808 + vdso64_pagelist = kcalloc(vdso64_pages + 2, sizeof(struct page *), 809 809 GFP_KERNEL); 810 810 BUG_ON(vdso64_pagelist == NULL); 811 811 for (i = 0; i < vdso64_pages; i++) {
+1 -1
arch/powerpc/mm/numa.c
··· 1316 1316 if (!weight) 1317 1317 return 0; 1318 1318 1319 - updates = kzalloc(weight * (sizeof(*updates)), GFP_KERNEL); 1319 + updates = kcalloc(weight, sizeof(*updates), GFP_KERNEL); 1320 1320 if (!updates) 1321 1321 return 0; 1322 1322
+1 -1
arch/powerpc/net/bpf_jit_comp.c
··· 566 566 if (!bpf_jit_enable) 567 567 return; 568 568 569 - addrs = kzalloc((flen+1) * sizeof(*addrs), GFP_KERNEL); 569 + addrs = kcalloc(flen + 1, sizeof(*addrs), GFP_KERNEL); 570 570 if (addrs == NULL) 571 571 return; 572 572
+1 -1
arch/powerpc/net/bpf_jit_comp64.c
··· 949 949 goto skip_init_ctx; 950 950 } 951 951 952 - addrs = kzalloc((flen+1) * sizeof(*addrs), GFP_KERNEL); 952 + addrs = kcalloc(flen + 1, sizeof(*addrs), GFP_KERNEL); 953 953 if (addrs == NULL) { 954 954 fp = org_fp; 955 955 goto out_addrs;
+2 -2
arch/powerpc/oprofile/cell/spu_profiler.c
··· 210 210 timer.function = profile_spus; 211 211 212 212 /* Allocate arrays for collecting SPU PC samples */ 213 - samples = kzalloc(SPUS_PER_NODE * 214 - TRACE_ARRAY_SIZE * sizeof(u32), GFP_KERNEL); 213 + samples = kcalloc(SPUS_PER_NODE * TRACE_ARRAY_SIZE, sizeof(u32), 214 + GFP_KERNEL); 215 215 216 216 if (!samples) 217 217 return -ENOMEM;
+1 -1
arch/powerpc/platforms/4xx/pci.c
··· 1449 1449 count = ppc4xx_pciex_hwops->core_init(np); 1450 1450 if (count > 0) { 1451 1451 ppc4xx_pciex_ports = 1452 - kzalloc(count * sizeof(struct ppc4xx_pciex_port), 1452 + kcalloc(count, sizeof(struct ppc4xx_pciex_port), 1453 1453 GFP_KERNEL); 1454 1454 if (ppc4xx_pciex_ports) { 1455 1455 ppc4xx_pciex_port_count = count;
+4 -4
arch/powerpc/platforms/powernv/opal-sysparam.c
··· 198 198 goto out_param_buf; 199 199 } 200 200 201 - id = kzalloc(sizeof(*id) * count, GFP_KERNEL); 201 + id = kcalloc(count, sizeof(*id), GFP_KERNEL); 202 202 if (!id) { 203 203 pr_err("SYSPARAM: Failed to allocate memory to read parameter " 204 204 "id\n"); 205 205 goto out_param_buf; 206 206 } 207 207 208 - size = kzalloc(sizeof(*size) * count, GFP_KERNEL); 208 + size = kcalloc(count, sizeof(*size), GFP_KERNEL); 209 209 if (!size) { 210 210 pr_err("SYSPARAM: Failed to allocate memory to read parameter " 211 211 "size\n"); 212 212 goto out_free_id; 213 213 } 214 214 215 - perm = kzalloc(sizeof(*perm) * count, GFP_KERNEL); 215 + perm = kcalloc(count, sizeof(*perm), GFP_KERNEL); 216 216 if (!perm) { 217 217 pr_err("SYSPARAM: Failed to allocate memory to read supported " 218 218 "action on the parameter"); ··· 235 235 goto out_free_perm; 236 236 } 237 237 238 - attr = kzalloc(sizeof(*attr) * count, GFP_KERNEL); 238 + attr = kcalloc(count, sizeof(*attr), GFP_KERNEL); 239 239 if (!attr) { 240 240 pr_err("SYSPARAM: Failed to allocate memory for parameter " 241 241 "attributes\n");
+2 -2
arch/powerpc/sysdev/mpic.c
··· 544 544 printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n"); 545 545 546 546 /* Allocate fixups array */ 547 - mpic->fixups = kzalloc(128 * sizeof(*mpic->fixups), GFP_KERNEL); 547 + mpic->fixups = kcalloc(128, sizeof(*mpic->fixups), GFP_KERNEL); 548 548 BUG_ON(mpic->fixups == NULL); 549 549 550 550 /* Init spinlock */ ··· 1324 1324 if (psrc) { 1325 1325 /* Allocate a bitmap with one bit per interrupt */ 1326 1326 unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1); 1327 - mpic->protected = kzalloc(mapsize*sizeof(long), GFP_KERNEL); 1327 + mpic->protected = kcalloc(mapsize, sizeof(long), GFP_KERNEL); 1328 1328 BUG_ON(mpic->protected == NULL); 1329 1329 for (i = 0; i < psize/sizeof(u32); i++) { 1330 1330 if (psrc[i] > intvec_top)
+1 -1
arch/powerpc/sysdev/xive/native.c
··· 489 489 if (rc == 0) 490 490 return true; 491 491 492 - xive_provision_chips = kzalloc(4 * xive_provision_chip_count, 492 + xive_provision_chips = kcalloc(4, xive_provision_chip_count, 493 493 GFP_KERNEL); 494 494 if (WARN_ON(!xive_provision_chips)) 495 495 return false;
+1 -1
arch/s390/appldata/appldata_base.c
··· 391 391 if (ops->size > APPLDATA_MAX_REC_SIZE) 392 392 return -EINVAL; 393 393 394 - ops->ctl_table = kzalloc(4 * sizeof(struct ctl_table), GFP_KERNEL); 394 + ops->ctl_table = kcalloc(4, sizeof(struct ctl_table), GFP_KERNEL); 395 395 if (!ops->ctl_table) 396 396 return -ENOMEM; 397 397
+2 -2
arch/s390/kernel/vdso.c
··· 285 285 + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1; 286 286 287 287 /* Make sure pages are in the correct state */ 288 - vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 1), 288 + vdso32_pagelist = kcalloc(vdso32_pages + 1, sizeof(struct page *), 289 289 GFP_KERNEL); 290 290 BUG_ON(vdso32_pagelist == NULL); 291 291 for (i = 0; i < vdso32_pages - 1; i++) { ··· 303 303 + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1; 304 304 305 305 /* Make sure pages are in the correct state */ 306 - vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 1), 306 + vdso64_pagelist = kcalloc(vdso64_pages + 1, sizeof(struct page *), 307 307 GFP_KERNEL); 308 308 BUG_ON(vdso64_pagelist == NULL); 309 309 for (i = 0; i < vdso64_pages - 1; i++) {
+1 -1
arch/sh/drivers/dma/dmabrg.c
··· 154 154 unsigned long or; 155 155 int ret; 156 156 157 - dmabrg_handlers = kzalloc(10 * sizeof(struct dmabrg_handler), 157 + dmabrg_handlers = kcalloc(10, sizeof(struct dmabrg_handler), 158 158 GFP_KERNEL); 159 159 if (!dmabrg_handlers) 160 160 return -ENOMEM;
+1 -1
arch/sh/drivers/pci/pcie-sh7786.c
··· 561 561 if (unlikely(nr_ports == 0)) 562 562 return -ENODEV; 563 563 564 - sh7786_pcie_ports = kzalloc(nr_ports * sizeof(struct sh7786_pcie_port), 564 + sh7786_pcie_ports = kcalloc(nr_ports, sizeof(struct sh7786_pcie_port), 565 565 GFP_KERNEL); 566 566 if (unlikely(!sh7786_pcie_ports)) 567 567 return -ENOMEM;
+2 -1
arch/sparc/kernel/sys_sparc_64.c
··· 565 565 } 566 566 if (!current_thread_info()->utraps) { 567 567 current_thread_info()->utraps = 568 - kzalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL); 568 + kcalloc(UT_TRAP_INSTRUCTION_31 + 1, sizeof(long), 569 + GFP_KERNEL); 569 570 if (!current_thread_info()->utraps) 570 571 return -ENOMEM; 571 572 current_thread_info()->utraps[0] = 1;
+1 -1
arch/x86/events/amd/iommu.c
··· 387 387 while (amd_iommu_v2_event_descs[i].attr.attr.name) 388 388 i++; 389 389 390 - attrs = kzalloc(sizeof(struct attribute **) * (i + 1), GFP_KERNEL); 390 + attrs = kcalloc(i + 1, sizeof(struct attribute **), GFP_KERNEL); 391 391 if (!attrs) 392 392 return -ENOMEM; 393 393
+1 -1
arch/x86/events/intel/uncore.c
··· 868 868 size_t size; 869 869 int i, j; 870 870 871 - pmus = kzalloc(sizeof(*pmus) * type->num_boxes, GFP_KERNEL); 871 + pmus = kcalloc(type->num_boxes, sizeof(*pmus), GFP_KERNEL); 872 872 if (!pmus) 873 873 return -ENOMEM; 874 874
+1 -1
arch/x86/kernel/cpu/mcheck/mce.c
··· 1457 1457 int i; 1458 1458 u8 num_banks = mca_cfg.banks; 1459 1459 1460 - mce_banks = kzalloc(num_banks * sizeof(struct mce_bank), GFP_KERNEL); 1460 + mce_banks = kcalloc(num_banks, sizeof(struct mce_bank), GFP_KERNEL); 1461 1461 if (!mce_banks) 1462 1462 return -ENOMEM; 1463 1463
+1 -1
arch/x86/kernel/cpu/mcheck/mce_amd.c
··· 1384 1384 if (bp) 1385 1385 return 0; 1386 1386 1387 - bp = kzalloc(sizeof(struct threshold_bank *) * mca_cfg.banks, 1387 + bp = kcalloc(mca_cfg.banks, sizeof(struct threshold_bank *), 1388 1388 GFP_KERNEL); 1389 1389 if (!bp) 1390 1390 return -ENOMEM;
+1 -1
arch/x86/kernel/cpu/mtrr/if.c
··· 43 43 44 44 max = num_var_ranges; 45 45 if (fcount == NULL) { 46 - fcount = kzalloc(max * sizeof *fcount, GFP_KERNEL); 46 + fcount = kcalloc(max, sizeof(*fcount), GFP_KERNEL); 47 47 if (!fcount) 48 48 return -ENOMEM; 49 49 FILE_FCOUNT(file) = fcount;
+1 -1
arch/x86/kernel/hpet.c
··· 610 610 if (!hpet_domain) 611 611 return; 612 612 613 - hpet_devs = kzalloc(sizeof(struct hpet_dev) * num_timers, GFP_KERNEL); 613 + hpet_devs = kcalloc(num_timers, sizeof(struct hpet_dev), GFP_KERNEL); 614 614 if (!hpet_devs) 615 615 return; 616 616
+1 -1
arch/x86/pci/xen.c
··· 168 168 if (type == PCI_CAP_ID_MSI && nvec > 1) 169 169 return 1; 170 170 171 - v = kzalloc(sizeof(int) * max(1, nvec), GFP_KERNEL); 171 + v = kcalloc(max(1, nvec), sizeof(int), GFP_KERNEL); 172 172 if (!v) 173 173 return -ENOMEM; 174 174
+1 -1
arch/x86/platform/uv/uv_time.c
··· 158 158 { 159 159 int cpu; 160 160 161 - blade_info = kzalloc(uv_possible_blades * sizeof(void *), GFP_KERNEL); 161 + blade_info = kcalloc(uv_possible_blades, sizeof(void *), GFP_KERNEL); 162 162 if (!blade_info) 163 163 return -ENOMEM; 164 164
+2 -1
block/bio.c
··· 2091 2091 { 2092 2092 bio_slab_max = 2; 2093 2093 bio_slab_nr = 0; 2094 - bio_slabs = kzalloc(bio_slab_max * sizeof(struct bio_slab), GFP_KERNEL); 2094 + bio_slabs = kcalloc(bio_slab_max, sizeof(struct bio_slab), 2095 + GFP_KERNEL); 2095 2096 if (!bio_slabs) 2096 2097 panic("bio: can't allocate bios\n"); 2097 2098
+2 -2
block/blk-tag.c
··· 99 99 __func__, depth); 100 100 } 101 101 102 - tag_index = kzalloc(depth * sizeof(struct request *), GFP_ATOMIC); 102 + tag_index = kcalloc(depth, sizeof(struct request *), GFP_ATOMIC); 103 103 if (!tag_index) 104 104 goto fail; 105 105 106 106 nr_ulongs = ALIGN(depth, BITS_PER_LONG) / BITS_PER_LONG; 107 - tag_map = kzalloc(nr_ulongs * sizeof(unsigned long), GFP_ATOMIC); 107 + tag_map = kcalloc(nr_ulongs, sizeof(unsigned long), GFP_ATOMIC); 108 108 if (!tag_map) 109 109 goto fail; 110 110
+1 -1
drivers/acpi/acpi_platform.c
··· 82 82 if (count < 0) { 83 83 return NULL; 84 84 } else if (count > 0) { 85 - resources = kzalloc(count * sizeof(struct resource), 85 + resources = kcalloc(count, sizeof(struct resource), 86 86 GFP_KERNEL); 87 87 if (!resources) { 88 88 dev_err(&adev->dev, "No memory for resources\n");
+3 -3
drivers/acpi/sysfs.c
··· 857 857 num_gpes = acpi_current_gpe_count; 858 858 num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; 859 859 860 - all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), 860 + all_attrs = kcalloc(num_counters + 1, sizeof(struct attribute *), 861 861 GFP_KERNEL); 862 862 if (all_attrs == NULL) 863 863 return; 864 864 865 - all_counters = kzalloc(sizeof(struct event_counter) * (num_counters), 865 + all_counters = kcalloc(num_counters, sizeof(struct event_counter), 866 866 GFP_KERNEL); 867 867 if (all_counters == NULL) 868 868 goto fail; ··· 871 871 if (ACPI_FAILURE(status)) 872 872 goto fail; 873 873 874 - counter_attrs = kzalloc(sizeof(struct kobj_attribute) * (num_counters), 874 + counter_attrs = kcalloc(num_counters, sizeof(struct kobj_attribute), 875 875 GFP_KERNEL); 876 876 if (counter_attrs == NULL) 877 877 goto fail;
+2 -2
drivers/android/binder_alloc.c
··· 692 692 } 693 693 } 694 694 #endif 695 - alloc->pages = kzalloc(sizeof(alloc->pages[0]) * 696 - ((vma->vm_end - vma->vm_start) / PAGE_SIZE), 695 + alloc->pages = kcalloc((vma->vm_end - vma->vm_start) / PAGE_SIZE, 696 + sizeof(alloc->pages[0]), 697 697 GFP_KERNEL); 698 698 if (alloc->pages == NULL) { 699 699 ret = -ENOMEM;
+1 -1
drivers/ata/libata-core.c
··· 6987 6987 if (*p == ',') 6988 6988 size++; 6989 6989 6990 - ata_force_tbl = kzalloc(sizeof(ata_force_tbl[0]) * size, GFP_KERNEL); 6990 + ata_force_tbl = kcalloc(size, sizeof(ata_force_tbl[0]), GFP_KERNEL); 6991 6991 if (!ata_force_tbl) { 6992 6992 printk(KERN_WARNING "ata: failed to extend force table, " 6993 6993 "libata.force ignored\n");
+1 -1
drivers/ata/libata-pmp.c
··· 340 340 int i, err; 341 341 342 342 if (!pmp_link) { 343 - pmp_link = kzalloc(sizeof(pmp_link[0]) * SATA_PMP_MAX_PORTS, 343 + pmp_link = kcalloc(SATA_PMP_MAX_PORTS, sizeof(pmp_link[0]), 344 344 GFP_NOIO); 345 345 if (!pmp_link) 346 346 return -ENOMEM;
+2 -1
drivers/atm/fore200e.c
··· 2094 2094 DPRINTK(2, "rx buffers %d / %d are being allocated\n", scheme, magn); 2095 2095 2096 2096 /* allocate the array of receive buffers */ 2097 - buffer = bsq->buffer = kzalloc(nbr * sizeof(struct buffer), GFP_KERNEL); 2097 + buffer = bsq->buffer = kcalloc(nbr, sizeof(struct buffer), 2098 + GFP_KERNEL); 2098 2099 2099 2100 if (buffer == NULL) 2100 2101 return -ENOMEM;
+1 -1
drivers/atm/iphase.c
··· 1618 1618 skb_queue_head_init(&iadev->rx_dma_q); 1619 1619 iadev->rx_free_desc_qhead = NULL; 1620 1620 1621 - iadev->rx_open = kzalloc(4 * iadev->num_vc, GFP_KERNEL); 1621 + iadev->rx_open = kcalloc(4, iadev->num_vc, GFP_KERNEL); 1622 1622 if (!iadev->rx_open) { 1623 1623 printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n", 1624 1624 dev->number);
+2 -1
drivers/block/drbd/drbd_main.c
··· 511 511 { 512 512 unsigned int *resources_per_cpu, min_index = ~0; 513 513 514 - resources_per_cpu = kzalloc(nr_cpu_ids * sizeof(*resources_per_cpu), GFP_KERNEL); 514 + resources_per_cpu = kcalloc(nr_cpu_ids, sizeof(*resources_per_cpu), 515 + GFP_KERNEL); 515 516 if (resources_per_cpu) { 516 517 struct drbd_resource *resource; 517 518 unsigned int cpu, min = ~0;
+5 -4
drivers/block/null_blk.c
··· 1575 1575 struct nullb_cmd *cmd; 1576 1576 int i, tag_size; 1577 1577 1578 - nq->cmds = kzalloc(nq->queue_depth * sizeof(*cmd), GFP_KERNEL); 1578 + nq->cmds = kcalloc(nq->queue_depth, sizeof(*cmd), GFP_KERNEL); 1579 1579 if (!nq->cmds) 1580 1580 return -ENOMEM; 1581 1581 1582 1582 tag_size = ALIGN(nq->queue_depth, BITS_PER_LONG) / BITS_PER_LONG; 1583 - nq->tag_map = kzalloc(tag_size * sizeof(unsigned long), GFP_KERNEL); 1583 + nq->tag_map = kcalloc(tag_size, sizeof(unsigned long), GFP_KERNEL); 1584 1584 if (!nq->tag_map) { 1585 1585 kfree(nq->cmds); 1586 1586 return -ENOMEM; ··· 1598 1598 1599 1599 static int setup_queues(struct nullb *nullb) 1600 1600 { 1601 - nullb->queues = kzalloc(nullb->dev->submit_queues * 1602 - sizeof(struct nullb_queue), GFP_KERNEL); 1601 + nullb->queues = kcalloc(nullb->dev->submit_queues, 1602 + sizeof(struct nullb_queue), 1603 + GFP_KERNEL); 1603 1604 if (!nullb->queues) 1604 1605 return -ENOMEM; 1605 1606
+3 -2
drivers/block/ps3vram.c
··· 407 407 408 408 priv->cache.page_count = CACHE_PAGE_COUNT; 409 409 priv->cache.page_size = CACHE_PAGE_SIZE; 410 - priv->cache.tags = kzalloc(sizeof(struct ps3vram_tag) * 411 - CACHE_PAGE_COUNT, GFP_KERNEL); 410 + priv->cache.tags = kcalloc(CACHE_PAGE_COUNT, 411 + sizeof(struct ps3vram_tag), 412 + GFP_KERNEL); 412 413 if (!priv->cache.tags) 413 414 return -ENOMEM; 414 415
+2 -1
drivers/block/rsxx/core.c
··· 873 873 dev_info(CARD_TO_DEV(card), 874 874 "Failed reading the number of DMA targets\n"); 875 875 876 - card->ctrl = kzalloc(card->n_targets * sizeof(*card->ctrl), GFP_KERNEL); 876 + card->ctrl = kcalloc(card->n_targets, sizeof(*card->ctrl), 877 + GFP_KERNEL); 877 878 if (!card->ctrl) { 878 879 st = -ENOMEM; 879 880 goto failed_dma_setup;
+1 -1
drivers/block/rsxx/dma.c
··· 1038 1038 struct rsxx_dma *dma; 1039 1039 struct list_head *issued_dmas; 1040 1040 1041 - issued_dmas = kzalloc(sizeof(*issued_dmas) * card->n_targets, 1041 + issued_dmas = kcalloc(card->n_targets, sizeof(*issued_dmas), 1042 1042 GFP_KERNEL); 1043 1043 if (!issued_dmas) 1044 1044 return -ENOMEM;
+2 -1
drivers/block/xen-blkback/xenbus.c
··· 139 139 { 140 140 unsigned int r; 141 141 142 - blkif->rings = kzalloc(blkif->nr_rings * sizeof(struct xen_blkif_ring), GFP_KERNEL); 142 + blkif->rings = kcalloc(blkif->nr_rings, sizeof(struct xen_blkif_ring), 143 + GFP_KERNEL); 143 144 if (!blkif->rings) 144 145 return -ENOMEM; 145 146
+14 -9
drivers/block/xen-blkfront.c
··· 1906 1906 if (!info->nr_rings) 1907 1907 info->nr_rings = 1; 1908 1908 1909 - info->rinfo = kzalloc(sizeof(struct blkfront_ring_info) * info->nr_rings, GFP_KERNEL); 1909 + info->rinfo = kcalloc(info->nr_rings, 1910 + sizeof(struct blkfront_ring_info), 1911 + GFP_KERNEL); 1910 1912 if (!info->rinfo) { 1911 1913 xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure"); 1912 1914 return -ENOMEM; ··· 2218 2216 } 2219 2217 2220 2218 for (i = 0; i < BLK_RING_SIZE(info); i++) { 2221 - rinfo->shadow[i].grants_used = kzalloc( 2222 - sizeof(rinfo->shadow[i].grants_used[0]) * grants, 2223 - GFP_NOIO); 2224 - rinfo->shadow[i].sg = kzalloc(sizeof(rinfo->shadow[i].sg[0]) * psegs, GFP_NOIO); 2225 - if (info->max_indirect_segments) 2226 - rinfo->shadow[i].indirect_grants = kzalloc( 2227 - sizeof(rinfo->shadow[i].indirect_grants[0]) * 2228 - INDIRECT_GREFS(grants), 2219 + rinfo->shadow[i].grants_used = 2220 + kcalloc(grants, 2221 + sizeof(rinfo->shadow[i].grants_used[0]), 2229 2222 GFP_NOIO); 2223 + rinfo->shadow[i].sg = kcalloc(psegs, 2224 + sizeof(rinfo->shadow[i].sg[0]), 2225 + GFP_NOIO); 2226 + if (info->max_indirect_segments) 2227 + rinfo->shadow[i].indirect_grants = 2228 + kcalloc(INDIRECT_GREFS(grants), 2229 + sizeof(rinfo->shadow[i].indirect_grants[0]), 2230 + GFP_NOIO); 2230 2231 if ((rinfo->shadow[i].grants_used == NULL) || 2231 2232 (rinfo->shadow[i].sg == NULL) || 2232 2233 (info->max_indirect_segments &&
+2 -1
drivers/char/agp/amd-k7-agp.c
··· 85 85 int retval = 0; 86 86 int i; 87 87 88 - tables = kzalloc((nr_tables + 1) * sizeof(struct amd_page_map *),GFP_KERNEL); 88 + tables = kcalloc(nr_tables + 1, sizeof(struct amd_page_map *), 89 + GFP_KERNEL); 89 90 if (tables == NULL) 90 91 return -ENOMEM; 91 92
+2 -1
drivers/char/agp/ati-agp.c
··· 108 108 int retval = 0; 109 109 int i; 110 110 111 - tables = kzalloc((nr_tables + 1) * sizeof(struct ati_page_map *),GFP_KERNEL); 111 + tables = kcalloc(nr_tables + 1, sizeof(struct ati_page_map *), 112 + GFP_KERNEL); 112 113 if (tables == NULL) 113 114 return -ENOMEM; 114 115
+1 -1
drivers/char/agp/sworks-agp.c
··· 96 96 int retval = 0; 97 97 int i; 98 98 99 - tables = kzalloc((nr_tables + 1) * sizeof(struct serverworks_page_map *), 99 + tables = kcalloc(nr_tables + 1, sizeof(struct serverworks_page_map *), 100 100 GFP_KERNEL); 101 101 if (tables == NULL) 102 102 return -ENOMEM;
+2 -1
drivers/char/ipmi/ipmi_ssif.c
··· 1757 1757 list_for_each_entry(info, &ssif_infos, link) 1758 1758 count++; 1759 1759 1760 - address_list = kzalloc(sizeof(*address_list) * (count + 1), GFP_KERNEL); 1760 + address_list = kcalloc(count + 1, sizeof(*address_list), 1761 + GFP_KERNEL); 1761 1762 if (!address_list) 1762 1763 return NULL; 1763 1764
+1 -1
drivers/clk/renesas/clk-r8a7740.c
··· 161 161 } 162 162 163 163 cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 164 - clks = kzalloc(num_clks * sizeof(*clks), GFP_KERNEL); 164 + clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); 165 165 if (cpg == NULL || clks == NULL) { 166 166 /* We're leaking memory on purpose, there's no point in cleaning 167 167 * up as the system won't boot anyway.
+1 -1
drivers/clk/renesas/clk-r8a7779.c
··· 138 138 } 139 139 140 140 cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 141 - clks = kzalloc(CPG_NUM_CLOCKS * sizeof(*clks), GFP_KERNEL); 141 + clks = kcalloc(CPG_NUM_CLOCKS, sizeof(*clks), GFP_KERNEL); 142 142 if (cpg == NULL || clks == NULL) { 143 143 /* We're leaking memory on purpose, there's no point in cleaning 144 144 * up as the system won't boot anyway.
+1 -1
drivers/clk/renesas/clk-rcar-gen2.c
··· 417 417 } 418 418 419 419 cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 420 - clks = kzalloc(num_clks * sizeof(*clks), GFP_KERNEL); 420 + clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); 421 421 if (cpg == NULL || clks == NULL) { 422 422 /* We're leaking memory on purpose, there's no point in cleaning 423 423 * up as the system won't boot anyway.
+1 -1
drivers/clk/renesas/clk-rz.c
··· 97 97 return; 98 98 99 99 cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 100 - clks = kzalloc(num_clks * sizeof(*clks), GFP_KERNEL); 100 + clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL); 101 101 BUG_ON(!cpg || !clks); 102 102 103 103 cpg->data.clks = clks;
+1 -1
drivers/clk/st/clkgen-fsyn.c
··· 874 874 return; 875 875 876 876 clk_data->clk_num = QUADFS_MAX_CHAN; 877 - clk_data->clks = kzalloc(QUADFS_MAX_CHAN * sizeof(struct clk *), 877 + clk_data->clks = kcalloc(QUADFS_MAX_CHAN, sizeof(struct clk *), 878 878 GFP_KERNEL); 879 879 880 880 if (!clk_data->clks) {
+1 -1
drivers/clk/st/clkgen-pll.c
··· 738 738 return; 739 739 740 740 clk_data->clk_num = num_odfs; 741 - clk_data->clks = kzalloc(clk_data->clk_num * sizeof(struct clk *), 741 + clk_data->clks = kcalloc(clk_data->clk_num, sizeof(struct clk *), 742 742 GFP_KERNEL); 743 743 744 744 if (!clk_data->clks)
+1 -1
drivers/clk/sunxi/clk-usb.c
··· 122 122 if (!clk_data) 123 123 return; 124 124 125 - clk_data->clks = kzalloc((qty+1) * sizeof(struct clk *), GFP_KERNEL); 125 + clk_data->clks = kcalloc(qty + 1, sizeof(struct clk *), GFP_KERNEL); 126 126 if (!clk_data->clks) { 127 127 kfree(clk_data); 128 128 return;
+4 -3
drivers/clk/tegra/clk.c
··· 216 216 if (WARN_ON(banks > ARRAY_SIZE(periph_regs))) 217 217 return NULL; 218 218 219 - periph_clk_enb_refcnt = kzalloc(32 * banks * 220 - sizeof(*periph_clk_enb_refcnt), GFP_KERNEL); 219 + periph_clk_enb_refcnt = kcalloc(32 * banks, 220 + sizeof(*periph_clk_enb_refcnt), 221 + GFP_KERNEL); 221 222 if (!periph_clk_enb_refcnt) 222 223 return NULL; 223 224 224 225 periph_banks = banks; 225 226 226 - clks = kzalloc(num * sizeof(struct clk *), GFP_KERNEL); 227 + clks = kcalloc(num, sizeof(struct clk *), GFP_KERNEL); 227 228 if (!clks) 228 229 kfree(periph_clk_enb_refcnt); 229 230
+1 -1
drivers/clk/ti/apll.c
··· 206 206 goto cleanup; 207 207 } 208 208 209 - parent_names = kzalloc(sizeof(char *) * init->num_parents, GFP_KERNEL); 209 + parent_names = kcalloc(init->num_parents, sizeof(char *), GFP_KERNEL); 210 210 if (!parent_names) 211 211 goto cleanup; 212 212
+2 -2
drivers/clk/ti/divider.c
··· 366 366 367 367 num_dividers = i; 368 368 369 - tmp = kzalloc(sizeof(*tmp) * (valid_div + 1), GFP_KERNEL); 369 + tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL); 370 370 if (!tmp) 371 371 return -ENOMEM; 372 372 ··· 496 496 return ERR_PTR(-EINVAL); 497 497 } 498 498 499 - table = kzalloc(sizeof(*table) * (valid_div + 1), GFP_KERNEL); 499 + table = kcalloc(valid_div + 1, sizeof(*table), GFP_KERNEL); 500 500 501 501 if (!table) 502 502 return ERR_PTR(-ENOMEM);
+1 -1
drivers/clk/ti/dpll.c
··· 309 309 goto cleanup; 310 310 } 311 311 312 - parent_names = kzalloc(sizeof(char *) * init->num_parents, GFP_KERNEL); 312 + parent_names = kcalloc(init->num_parents, sizeof(char *), GFP_KERNEL); 313 313 if (!parent_names) 314 314 goto cleanup; 315 315
+1 -1
drivers/clocksource/sh_cmt.c
··· 1000 1000 1001 1001 /* Allocate and setup the channels. */ 1002 1002 cmt->num_channels = hweight8(cmt->hw_channels); 1003 - cmt->channels = kzalloc(cmt->num_channels * sizeof(*cmt->channels), 1003 + cmt->channels = kcalloc(cmt->num_channels, sizeof(*cmt->channels), 1004 1004 GFP_KERNEL); 1005 1005 if (cmt->channels == NULL) { 1006 1006 ret = -ENOMEM;
+1 -1
drivers/clocksource/sh_mtu2.c
··· 418 418 /* Allocate and setup the channels. */ 419 419 mtu->num_channels = 3; 420 420 421 - mtu->channels = kzalloc(sizeof(*mtu->channels) * mtu->num_channels, 421 + mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels), 422 422 GFP_KERNEL); 423 423 if (mtu->channels == NULL) { 424 424 ret = -ENOMEM;
+1 -1
drivers/clocksource/sh_tmu.c
··· 569 569 } 570 570 571 571 /* Allocate and setup the channels. */ 572 - tmu->channels = kzalloc(sizeof(*tmu->channels) * tmu->num_channels, 572 + tmu->channels = kcalloc(tmu->num_channels, sizeof(*tmu->channels), 573 573 GFP_KERNEL); 574 574 if (tmu->channels == NULL) { 575 575 ret = -ENOMEM;
+2 -2
drivers/cpufreq/acpi-cpufreq.c
··· 759 759 goto err_unreg; 760 760 } 761 761 762 - freq_table = kzalloc(sizeof(*freq_table) * 763 - (perf->state_count+1), GFP_KERNEL); 762 + freq_table = kcalloc(perf->state_count + 1, sizeof(*freq_table), 763 + GFP_KERNEL); 764 764 if (!freq_table) { 765 765 result = -ENOMEM; 766 766 goto err_unreg;
+1 -1
drivers/cpufreq/arm_big_little.c
··· 280 280 for (i = 0; i < MAX_CLUSTERS; i++) 281 281 count += get_table_count(freq_table[i]); 282 282 283 - table = kzalloc(sizeof(*table) * count, GFP_KERNEL); 283 + table = kcalloc(count, sizeof(*table), GFP_KERNEL); 284 284 if (!table) 285 285 return -ENOMEM; 286 286
+2 -1
drivers/cpufreq/cppc_cpufreq.c
··· 313 313 if (acpi_disabled) 314 314 return -ENODEV; 315 315 316 - all_cpu_data = kzalloc(sizeof(void *) * num_possible_cpus(), GFP_KERNEL); 316 + all_cpu_data = kcalloc(num_possible_cpus(), sizeof(void *), 317 + GFP_KERNEL); 317 318 if (!all_cpu_data) 318 319 return -ENOMEM; 319 320
+2 -2
drivers/cpufreq/ia64-acpi-cpufreq.c
··· 241 241 } 242 242 243 243 /* alloc freq_table */ 244 - freq_table = kzalloc(sizeof(*freq_table) * 245 - (data->acpi_data.state_count + 1), 244 + freq_table = kcalloc(data->acpi_data.state_count + 1, 245 + sizeof(*freq_table), 246 246 GFP_KERNEL); 247 247 if (!freq_table) { 248 248 result = -ENOMEM;
+2 -2
drivers/cpufreq/longhaul.c
··· 474 474 return -EINVAL; 475 475 } 476 476 477 - longhaul_table = kzalloc((numscales + 1) * sizeof(*longhaul_table), 478 - GFP_KERNEL); 477 + longhaul_table = kcalloc(numscales + 1, sizeof(*longhaul_table), 478 + GFP_KERNEL); 479 479 if (!longhaul_table) 480 480 return -ENOMEM; 481 481
+1 -1
drivers/cpufreq/pxa3xx-cpufreq.c
··· 93 93 struct cpufreq_frequency_table *table; 94 94 int i; 95 95 96 - table = kzalloc((num + 1) * sizeof(*table), GFP_KERNEL); 96 + table = kcalloc(num + 1, sizeof(*table), GFP_KERNEL); 97 97 if (table == NULL) 98 98 return -ENOMEM; 99 99
+1 -1
drivers/cpufreq/s3c24xx-cpufreq.c
··· 562 562 size = cpu_cur.info->calc_freqtable(&cpu_cur, NULL, 0); 563 563 size++; 564 564 565 - ftab = kzalloc(sizeof(*ftab) * size, GFP_KERNEL); 565 + ftab = kcalloc(size, sizeof(*ftab), GFP_KERNEL); 566 566 if (!ftab) 567 567 return -ENOMEM; 568 568
+2 -2
drivers/cpufreq/sfi-cpufreq.c
··· 95 95 if (ret) 96 96 return ret; 97 97 98 - freq_table = kzalloc(sizeof(*freq_table) * 99 - (num_freq_table_entries + 1), GFP_KERNEL); 98 + freq_table = kcalloc(num_freq_table_entries + 1, sizeof(*freq_table), 99 + GFP_KERNEL); 100 100 if (!freq_table) { 101 101 ret = -ENOMEM; 102 102 goto err_free_array;
+1 -1
drivers/cpufreq/spear-cpufreq.c
··· 195 195 cnt = prop->length / sizeof(u32); 196 196 val = prop->value; 197 197 198 - freq_tbl = kzalloc(sizeof(*freq_tbl) * (cnt + 1), GFP_KERNEL); 198 + freq_tbl = kcalloc(cnt + 1, sizeof(*freq_tbl), GFP_KERNEL); 199 199 if (!freq_tbl) { 200 200 ret = -ENOMEM; 201 201 goto out_put_node;
+4 -4
drivers/crypto/amcc/crypto4xx_core.c
··· 141 141 142 142 int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size) 143 143 { 144 - ctx->sa_in = kzalloc(size * 4, GFP_ATOMIC); 144 + ctx->sa_in = kcalloc(size, 4, GFP_ATOMIC); 145 145 if (ctx->sa_in == NULL) 146 146 return -ENOMEM; 147 147 148 - ctx->sa_out = kzalloc(size * 4, GFP_ATOMIC); 148 + ctx->sa_out = kcalloc(size, 4, GFP_ATOMIC); 149 149 if (ctx->sa_out == NULL) { 150 150 kfree(ctx->sa_in); 151 151 ctx->sa_in = NULL; ··· 180 180 if (!dev->pdr) 181 181 return -ENOMEM; 182 182 183 - dev->pdr_uinfo = kzalloc(sizeof(struct pd_uinfo) * PPC4XX_NUM_PD, 184 - GFP_KERNEL); 183 + dev->pdr_uinfo = kcalloc(PPC4XX_NUM_PD, sizeof(struct pd_uinfo), 184 + GFP_KERNEL); 185 185 if (!dev->pdr_uinfo) { 186 186 dma_free_coherent(dev->core_dev->device, 187 187 sizeof(struct ce_pd) * PPC4XX_NUM_PD,
+1 -1
drivers/crypto/inside-secure/safexcel_hash.c
··· 922 922 crypto_ahash_clear_flags(tfm, ~0); 923 923 blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm)); 924 924 925 - ipad = kzalloc(2 * blocksize, GFP_KERNEL); 925 + ipad = kcalloc(2, blocksize, GFP_KERNEL); 926 926 if (!ipad) { 927 927 ret = -ENOMEM; 928 928 goto free_request;
+1 -1
drivers/crypto/marvell/hash.c
··· 1198 1198 1199 1199 blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm)); 1200 1200 1201 - ipad = kzalloc(2 * blocksize, GFP_KERNEL); 1201 + ipad = kcalloc(2, blocksize, GFP_KERNEL); 1202 1202 if (!ipad) { 1203 1203 ret = -ENOMEM; 1204 1204 goto free_req;
+2 -2
drivers/crypto/n2_core.c
··· 1919 1919 goto out_hvapi_release; 1920 1920 1921 1921 err = -ENOMEM; 1922 - cpu_to_cwq = kzalloc(sizeof(struct spu_queue *) * NR_CPUS, 1922 + cpu_to_cwq = kcalloc(NR_CPUS, sizeof(struct spu_queue *), 1923 1923 GFP_KERNEL); 1924 1924 if (!cpu_to_cwq) 1925 1925 goto out_queue_cache_destroy; 1926 1926 1927 - cpu_to_mau = kzalloc(sizeof(struct spu_queue *) * NR_CPUS, 1927 + cpu_to_mau = kcalloc(NR_CPUS, sizeof(struct spu_queue *), 1928 1928 GFP_KERNEL); 1929 1929 if (!cpu_to_mau) 1930 1930 goto out_free_cwq_table;
+3 -2
drivers/crypto/qat/qat_common/qat_uclo.c
··· 1162 1162 suof_handle->img_table.num_simgs = suof_ptr->num_chunks - 1; 1163 1163 1164 1164 if (suof_handle->img_table.num_simgs != 0) { 1165 - suof_img_hdr = kzalloc(suof_handle->img_table.num_simgs * 1166 - sizeof(img_header), GFP_KERNEL); 1165 + suof_img_hdr = kcalloc(suof_handle->img_table.num_simgs, 1166 + sizeof(img_header), 1167 + GFP_KERNEL); 1167 1168 if (!suof_img_hdr) 1168 1169 return -ENOMEM; 1169 1170 suof_handle->img_table.simg_hdr = suof_img_hdr;
+2 -2
drivers/dma/ioat/init.c
··· 322 322 unsigned long tmo; 323 323 unsigned long flags; 324 324 325 - src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); 325 + src = kzalloc(IOAT_TEST_SIZE, GFP_KERNEL); 326 326 if (!src) 327 327 return -ENOMEM; 328 - dest = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); 328 + dest = kzalloc(IOAT_TEST_SIZE, GFP_KERNEL); 329 329 if (!dest) { 330 330 kfree(src); 331 331 return -ENOMEM;
+1 -1
drivers/dma/mv_xor.c
··· 781 781 if (!src) 782 782 return -ENOMEM; 783 783 784 - dest = kzalloc(sizeof(u8) * PAGE_SIZE, GFP_KERNEL); 784 + dest = kzalloc(PAGE_SIZE, GFP_KERNEL); 785 785 if (!dest) { 786 786 kfree(src); 787 787 return -ENOMEM;
+2 -2
drivers/dma/pl330.c
··· 1866 1866 int i; 1867 1867 1868 1868 /* Allocate 1 Manager and 'chans' Channel threads */ 1869 - pl330->channels = kzalloc((1 + chans) * sizeof(*thrd), 1869 + pl330->channels = kcalloc(1 + chans, sizeof(*thrd), 1870 1870 GFP_KERNEL); 1871 1871 if (!pl330->channels) 1872 1872 return -ENOMEM; ··· 2990 2990 2991 2991 pl330->num_peripherals = num_chan; 2992 2992 2993 - pl330->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); 2993 + pl330->peripherals = kcalloc(num_chan, sizeof(*pch), GFP_KERNEL); 2994 2994 if (!pl330->peripherals) { 2995 2995 ret = -ENOMEM; 2996 2996 goto probe_err2;
+3 -2
drivers/dma/sh/shdma-base.c
··· 1045 1045 1046 1046 static int __init shdma_enter(void) 1047 1047 { 1048 - shdma_slave_used = kzalloc(DIV_ROUND_UP(slave_num, BITS_PER_LONG) * 1049 - sizeof(long), GFP_KERNEL); 1048 + shdma_slave_used = kcalloc(DIV_ROUND_UP(slave_num, BITS_PER_LONG), 1049 + sizeof(long), 1050 + GFP_KERNEL); 1050 1051 if (!shdma_slave_used) 1051 1052 return -ENOMEM; 1052 1053 return 0;
+1 -1
drivers/dma/xilinx/zynqmp_dma.c
··· 471 471 if (ret < 0) 472 472 return ret; 473 473 474 - chan->sw_desc_pool = kzalloc(sizeof(*desc) * ZYNQMP_DMA_NUM_DESCS, 474 + chan->sw_desc_pool = kcalloc(ZYNQMP_DMA_NUM_DESCS, sizeof(*desc), 475 475 GFP_KERNEL); 476 476 if (!chan->sw_desc_pool) 477 477 return -ENOMEM;
+1 -1
drivers/edac/amd64_edac.c
··· 3451 3451 opstate_init(); 3452 3452 3453 3453 err = -ENOMEM; 3454 - ecc_stngs = kzalloc(amd_nb_num() * sizeof(ecc_stngs[0]), GFP_KERNEL); 3454 + ecc_stngs = kcalloc(amd_nb_num(), sizeof(ecc_stngs[0]), GFP_KERNEL); 3455 3455 if (!ecc_stngs) 3456 3456 goto err_free; 3457 3457
+1 -1
drivers/edac/i7core_edac.c
··· 461 461 if (!i7core_dev) 462 462 return NULL; 463 463 464 - i7core_dev->pdev = kzalloc(sizeof(*i7core_dev->pdev) * table->n_devs, 464 + i7core_dev->pdev = kcalloc(table->n_devs, sizeof(*i7core_dev->pdev), 465 465 GFP_KERNEL); 466 466 if (!i7core_dev->pdev) { 467 467 kfree(i7core_dev);
+14 -10
drivers/extcon/extcon.c
··· 1126 1126 char *str; 1127 1127 struct extcon_cable *cable; 1128 1128 1129 - edev->cables = kzalloc(sizeof(struct extcon_cable) * 1130 - edev->max_supported, GFP_KERNEL); 1129 + edev->cables = kcalloc(edev->max_supported, 1130 + sizeof(struct extcon_cable), 1131 + GFP_KERNEL); 1131 1132 if (!edev->cables) { 1132 1133 ret = -ENOMEM; 1133 1134 goto err_sysfs_alloc; ··· 1137 1136 cable = &edev->cables[index]; 1138 1137 1139 1138 snprintf(buf, 10, "cable.%d", index); 1140 - str = kzalloc(sizeof(char) * (strlen(buf) + 1), 1139 + str = kzalloc(strlen(buf) + 1, 1141 1140 GFP_KERNEL); 1142 1141 if (!str) { 1143 1142 for (index--; index >= 0; index--) { ··· 1178 1177 for (index = 0; edev->mutually_exclusive[index]; index++) 1179 1178 ; 1180 1179 1181 - edev->attrs_muex = kzalloc(sizeof(struct attribute *) * 1182 - (index + 1), GFP_KERNEL); 1180 + edev->attrs_muex = kcalloc(index + 1, 1181 + sizeof(struct attribute *), 1182 + GFP_KERNEL); 1183 1183 if (!edev->attrs_muex) { 1184 1184 ret = -ENOMEM; 1185 1185 goto err_muex; 1186 1186 } 1187 1187 1188 - edev->d_attrs_muex = kzalloc(sizeof(struct device_attribute) * 1189 - index, GFP_KERNEL); 1188 + edev->d_attrs_muex = kcalloc(index, 1189 + sizeof(struct device_attribute), 1190 + GFP_KERNEL); 1190 1191 if (!edev->d_attrs_muex) { 1191 1192 ret = -ENOMEM; 1192 1193 kfree(edev->attrs_muex); ··· 1197 1194 1198 1195 for (index = 0; edev->mutually_exclusive[index]; index++) { 1199 1196 sprintf(buf, "0x%x", edev->mutually_exclusive[index]); 1200 - name = kzalloc(sizeof(char) * (strlen(buf) + 1), 1197 + name = kzalloc(strlen(buf) + 1, 1201 1198 GFP_KERNEL); 1202 1199 if (!name) { 1203 1200 for (index--; index >= 0; index--) { ··· 1223 1220 1224 1221 if (edev->max_supported) { 1225 1222 edev->extcon_dev_type.groups = 1226 - kzalloc(sizeof(struct attribute_group *) * 1227 - (edev->max_supported + 2), GFP_KERNEL); 1223 + kcalloc(edev->max_supported + 2, 1224 + sizeof(struct attribute_group *), 1225 + GFP_KERNEL); 1228 1226 if (!edev->extcon_dev_type.groups) { 1229 1227 ret = -ENOMEM; 1230 1228 goto err_alloc_groups;
+1 -1
drivers/firmware/dell_rbu.c
··· 146 146 packet_array_size = max( 147 147 (unsigned int)(allocation_floor / rbu_data.packetsize), 148 148 (unsigned int)1); 149 - invalid_addr_packet_array = kzalloc(packet_array_size * sizeof(void*), 149 + invalid_addr_packet_array = kcalloc(packet_array_size, sizeof(void *), 150 150 GFP_KERNEL); 151 151 152 152 if (!invalid_addr_packet_array) {
+1 -1
drivers/firmware/efi/capsule.c
··· 231 231 count = DIV_ROUND_UP(imagesize, PAGE_SIZE); 232 232 sg_count = sg_pages_num(count); 233 233 234 - sg_pages = kzalloc(sg_count * sizeof(*sg_pages), GFP_KERNEL); 234 + sg_pages = kcalloc(sg_count, sizeof(*sg_pages), GFP_KERNEL); 235 235 if (!sg_pages) 236 236 return -ENOMEM; 237 237
+1 -1
drivers/firmware/efi/runtime-map.c
··· 166 166 if (!efi_enabled(EFI_MEMMAP)) 167 167 return 0; 168 168 169 - map_entries = kzalloc(efi.memmap.nr_map * sizeof(entry), GFP_KERNEL); 169 + map_entries = kcalloc(efi.memmap.nr_map, sizeof(entry), GFP_KERNEL); 170 170 if (!map_entries) { 171 171 ret = -ENOMEM; 172 172 goto out;
+2 -2
drivers/fmc/fmc-sdb.c
··· 48 48 arr = kzalloc(sizeof(*arr), GFP_KERNEL); 49 49 if (!arr) 50 50 return ERR_PTR(-ENOMEM); 51 - arr->record = kzalloc(sizeof(arr->record[0]) * n, GFP_KERNEL); 52 - arr->subtree = kzalloc(sizeof(arr->subtree[0]) * n, GFP_KERNEL); 51 + arr->record = kcalloc(n, sizeof(arr->record[0]), GFP_KERNEL); 52 + arr->subtree = kcalloc(n, sizeof(arr->subtree[0]), GFP_KERNEL); 53 53 if (!arr->record || !arr->subtree) { 54 54 kfree(arr->record); 55 55 kfree(arr->subtree);
+1 -1
drivers/gpio/gpio-ml-ioh.c
··· 443 443 goto err_iomap; 444 444 } 445 445 446 - chip_save = kzalloc(sizeof(*chip) * 8, GFP_KERNEL); 446 + chip_save = kcalloc(8, sizeof(*chip), GFP_KERNEL); 447 447 if (chip_save == NULL) { 448 448 ret = -ENOMEM; 449 449 goto err_kzalloc;
+3 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
··· 310 310 pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false); 311 311 } 312 312 313 - adev->acp.acp_cell = kzalloc(sizeof(struct mfd_cell) * ACP_DEVS, 313 + adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell), 314 314 GFP_KERNEL); 315 315 316 316 if (adev->acp.acp_cell == NULL) 317 317 return -ENOMEM; 318 318 319 - adev->acp.acp_res = kzalloc(sizeof(struct resource) * 4, GFP_KERNEL); 319 + adev->acp.acp_res = kcalloc(4, sizeof(struct resource), GFP_KERNEL); 320 320 321 321 if (adev->acp.acp_res == NULL) { 322 322 kfree(adev->acp.acp_cell); 323 323 return -ENOMEM; 324 324 } 325 325 326 - i2s_pdata = kzalloc(sizeof(struct i2s_platform_data) * 2, GFP_KERNEL); 326 + i2s_pdata = kcalloc(2, sizeof(struct i2s_platform_data), GFP_KERNEL); 327 327 if (i2s_pdata == NULL) { 328 328 kfree(adev->acp.acp_res); 329 329 kfree(adev->acp.acp_cell);
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
··· 452 452 ATOM_PPLIB_PhaseSheddingLimits_Record *entry; 453 453 454 454 adev->pm.dpm.dyn_state.phase_shedding_limits_table.entries = 455 - kzalloc(psl->ucNumEntries * 455 + kcalloc(psl->ucNumEntries, 456 456 sizeof(struct amdgpu_phase_shedding_limits_entry), 457 457 GFP_KERNEL); 458 458 if (!adev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) {
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
··· 53 53 n -= adev->irq.ih.ring_size; 54 54 n /= size; 55 55 56 - gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL); 56 + gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL); 57 57 if (!gtt_obj) { 58 58 DRM_ERROR("Failed to allocate %d pointers\n", n); 59 59 r = 1;
+1 -1
drivers/gpu/drm/amd/amdgpu/atom.c
··· 1221 1221 ectx.abort = false; 1222 1222 ectx.last_jump = 0; 1223 1223 if (ws) 1224 - ectx.ws = kzalloc(4 * ws, GFP_KERNEL); 1224 + ectx.ws = kcalloc(4, ws, GFP_KERNEL); 1225 1225 else 1226 1226 ectx.ws = NULL; 1227 1227
+6 -3
drivers/gpu/drm/amd/amdgpu/ci_dpm.c
··· 5679 5679 (mode_info->atom_context->bios + data_offset + 5680 5680 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 5681 5681 5682 - adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) * 5683 - state_array->ucNumEntries, GFP_KERNEL); 5682 + adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 5683 + sizeof(struct amdgpu_ps), 5684 + GFP_KERNEL); 5684 5685 if (!adev->pm.dpm.ps) 5685 5686 return -ENOMEM; 5686 5687 power_state_offset = (u8 *)state_array->states; ··· 5928 5927 ci_set_private_data_variables_based_on_pptable(adev); 5929 5928 5930 5929 adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 5931 - kzalloc(4 * sizeof(struct amdgpu_clock_voltage_dependency_entry), GFP_KERNEL); 5930 + kcalloc(4, 5931 + sizeof(struct amdgpu_clock_voltage_dependency_entry), 5932 + GFP_KERNEL); 5932 5933 if (!adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 5933 5934 ci_dpm_fini(adev); 5934 5935 return -ENOMEM;
+3 -2
drivers/gpu/drm/amd/amdgpu/kv_dpm.c
··· 2727 2727 (mode_info->atom_context->bios + data_offset + 2728 2728 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 2729 2729 2730 - adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) * 2731 - state_array->ucNumEntries, GFP_KERNEL); 2730 + adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 2731 + sizeof(struct amdgpu_ps), 2732 + GFP_KERNEL); 2732 2733 if (!adev->pm.dpm.ps) 2733 2734 return -ENOMEM; 2734 2735 power_state_offset = (u8 *)state_array->states;
+6 -3
drivers/gpu/drm/amd/amdgpu/si_dpm.c
··· 7242 7242 (mode_info->atom_context->bios + data_offset + 7243 7243 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 7244 7244 7245 - adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) * 7246 - state_array->ucNumEntries, GFP_KERNEL); 7245 + adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 7246 + sizeof(struct amdgpu_ps), 7247 + GFP_KERNEL); 7247 7248 if (!adev->pm.dpm.ps) 7248 7249 return -ENOMEM; 7249 7250 power_state_offset = (u8 *)state_array->states; ··· 7347 7346 return ret; 7348 7347 7349 7348 adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 7350 - kzalloc(4 * sizeof(struct amdgpu_clock_voltage_dependency_entry), GFP_KERNEL); 7349 + kcalloc(4, 7350 + sizeof(struct amdgpu_clock_voltage_dependency_entry), 7351 + GFP_KERNEL); 7351 7352 if (!adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 7352 7353 amdgpu_free_extended_power_table(adev); 7353 7354 return -ENOMEM;
+1 -1
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
··· 435 435 return false; 436 436 } 437 437 438 - msgs = kzalloc(num * sizeof(struct i2c_msg), GFP_KERNEL); 438 + msgs = kcalloc(num, sizeof(struct i2c_msg), GFP_KERNEL); 439 439 440 440 if (!msgs) 441 441 return false;
+1 -1
drivers/gpu/drm/amd/display/dc/basics/logger.c
··· 364 364 entry->type = log_type; 365 365 entry->logger = logger; 366 366 367 - entry->buf = kzalloc(DAL_LOGGER_BUFFER_MAX_SIZE * sizeof(char), 367 + entry->buf = kzalloc(DAL_LOGGER_BUFFER_MAX_SIZE, 368 368 GFP_KERNEL); 369 369 370 370 entry->buf_offset = 0;
+2 -2
drivers/gpu/drm/amd/display/dc/basics/vector.c
··· 40 40 return false; 41 41 } 42 42 43 - vector->container = kzalloc(struct_size * capacity, GFP_KERNEL); 43 + vector->container = kcalloc(capacity, struct_size, GFP_KERNEL); 44 44 if (vector->container == NULL) 45 45 return false; 46 46 vector->capacity = capacity; ··· 67 67 return false; 68 68 } 69 69 70 - vector->container = kzalloc(struct_size * count, GFP_KERNEL); 70 + vector->container = kcalloc(count, struct_size, GFP_KERNEL); 71 71 72 72 if (vector->container == NULL) 73 73 return false;
+4 -2
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
··· 1079 1079 if (*ss_entries_num == 0) 1080 1080 return; 1081 1081 1082 - ss_info = kzalloc(sizeof(struct spread_spectrum_info) * (*ss_entries_num), 1082 + ss_info = kcalloc(*ss_entries_num, 1083 + sizeof(struct spread_spectrum_info), 1083 1084 GFP_KERNEL); 1084 1085 ss_info_cur = ss_info; 1085 1086 if (ss_info == NULL) 1086 1087 return; 1087 1088 1088 - ss_data = kzalloc(sizeof(struct spread_spectrum_data) * (*ss_entries_num), 1089 + ss_data = kcalloc(*ss_entries_num, 1090 + sizeof(struct spread_spectrum_data), 1089 1091 GFP_KERNEL); 1090 1092 if (ss_data == NULL) 1091 1093 goto out_free_info;
+2 -1
drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
··· 98 98 if (number_of_bits) { 99 99 uint32_t index_of_uint = 0; 100 100 101 - slot = kzalloc(number_of_uints * sizeof(uint32_t), 101 + slot = kcalloc(number_of_uints, 102 + sizeof(uint32_t), 102 103 GFP_KERNEL); 103 104 104 105 if (!slot) {
+6 -4
drivers/gpu/drm/amd/display/modules/color/color_gamma.c
··· 1413 1413 1414 1414 output_tf->type = TF_TYPE_DISTRIBUTED_POINTS; 1415 1415 1416 - rgb_user = kzalloc(sizeof(*rgb_user) * (GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS), 1417 - GFP_KERNEL); 1416 + rgb_user = kcalloc(GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS, 1417 + sizeof(*rgb_user), 1418 + GFP_KERNEL); 1418 1419 if (!rgb_user) 1419 1420 goto rgb_user_alloc_fail; 1420 1421 1421 - rgb_regamma = kzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + _EXTRA_POINTS), 1422 - GFP_KERNEL); 1422 + rgb_regamma = kcalloc(MAX_HW_POINTS + _EXTRA_POINTS, 1423 + sizeof(*rgb_regamma), 1424 + GFP_KERNEL); 1423 1425 if (!rgb_regamma) 1424 1426 goto rgb_regamma_alloc_fail; 1425 1427
+2 -1
drivers/gpu/drm/amd/display/modules/freesync/freesync.c
··· 155 155 if (core_freesync == NULL) 156 156 goto fail_alloc_context; 157 157 158 - core_freesync->map = kzalloc(sizeof(struct freesync_entity) * MOD_FREESYNC_MAX_CONCURRENT_STREAMS, 158 + core_freesync->map = kcalloc(MOD_FREESYNC_MAX_CONCURRENT_STREAMS, 159 + sizeof(struct freesync_entity), 159 160 GFP_KERNEL); 160 161 161 162 if (core_freesync->map == NULL)
+5 -7
drivers/gpu/drm/amd/display/modules/stats/stats.c
··· 141 141 else 142 142 core_stats->entries = reg_data; 143 143 } 144 - core_stats->time = kzalloc( 145 - sizeof(struct stats_time_cache) * 146 - core_stats->entries, 144 + core_stats->time = kcalloc(core_stats->entries, 145 + sizeof(struct stats_time_cache), 147 146 GFP_KERNEL); 148 147 149 148 if (core_stats->time == NULL) 150 149 goto fail_construct_time; 151 150 152 151 core_stats->event_entries = DAL_STATS_EVENT_ENTRIES_DEFAULT; 153 - core_stats->events = kzalloc( 154 - sizeof(struct stats_event_cache) * 155 - core_stats->event_entries, 156 - GFP_KERNEL); 152 + core_stats->events = kcalloc(core_stats->event_entries, 153 + sizeof(struct stats_event_cache), 154 + GFP_KERNEL); 157 155 158 156 if (core_stats->events == NULL) 159 157 goto fail_construct_events;
+1 -1
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
··· 50 50 return 0; 51 51 } 52 52 53 - hwmgr->ps = kzalloc(size * table_entries, GFP_KERNEL); 53 + hwmgr->ps = kcalloc(table_entries, size, GFP_KERNEL); 54 54 if (hwmgr->ps == NULL) 55 55 return -ENOMEM; 56 56
+1 -1
drivers/gpu/drm/i915/gvt/vgpu.c
··· 121 121 high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE; 122 122 num_types = sizeof(vgpu_types) / sizeof(vgpu_types[0]); 123 123 124 - gvt->types = kzalloc(num_types * sizeof(struct intel_vgpu_type), 124 + gvt->types = kcalloc(num_types, sizeof(struct intel_vgpu_type), 125 125 GFP_KERNEL); 126 126 if (!gvt->types) 127 127 return -ENOMEM;
+1 -1
drivers/gpu/drm/i915/intel_hdcp.c
··· 429 429 if (num_downstream == 0) 430 430 return -EINVAL; 431 431 432 - ksv_fifo = kzalloc(num_downstream * DRM_HDCP_KSV_LEN, GFP_KERNEL); 432 + ksv_fifo = kcalloc(DRM_HDCP_KSV_LEN, num_downstream, GFP_KERNEL); 433 433 if (!ksv_fifo) 434 434 return -ENOMEM; 435 435
+1 -1
drivers/gpu/drm/i915/selftests/intel_uncore.c
··· 137 137 if (!IS_ENABLED(CONFIG_DRM_I915_SELFTEST_BROKEN)) 138 138 return 0; 139 139 140 - valid = kzalloc(BITS_TO_LONGS(FW_RANGE) * sizeof(*valid), 140 + valid = kcalloc(BITS_TO_LONGS(FW_RANGE), sizeof(*valid), 141 141 GFP_KERNEL); 142 142 if (!valid) 143 143 return -ENOMEM;
+2 -2
drivers/gpu/drm/nouveau/nvif/fifo.c
··· 50 50 goto done; 51 51 52 52 device->runlists = fls64(a->v.runlists.data); 53 - device->runlist = kzalloc(sizeof(*device->runlist) * 54 - device->runlists, GFP_KERNEL); 53 + device->runlist = kcalloc(device->runlists, sizeof(*device->runlist), 54 + GFP_KERNEL); 55 55 if (!device->runlist) { 56 56 ret = -ENOMEM; 57 57 goto done;
+1 -1
drivers/gpu/drm/nouveau/nvif/object.c
··· 83 83 return ret; 84 84 } 85 85 86 - *psclass = kzalloc(sizeof(**psclass) * args->sclass.count, GFP_KERNEL); 86 + *psclass = kcalloc(args->sclass.count, sizeof(**psclass), GFP_KERNEL); 87 87 if (*psclass) { 88 88 for (i = 0; i < args->sclass.count; i++) { 89 89 (*psclass)[i].oclass = args->sclass.oclass[i].oclass;
+2 -1
drivers/gpu/drm/nouveau/nvkm/core/event.c
··· 84 84 nvkm_event_init(const struct nvkm_event_func *func, int types_nr, int index_nr, 85 85 struct nvkm_event *event) 86 86 { 87 - event->refs = kzalloc(sizeof(*event->refs) * index_nr * types_nr, 87 + event->refs = kzalloc(array3_size(index_nr, types_nr, 88 + sizeof(*event->refs)), 88 89 GFP_KERNEL); 89 90 if (!event->refs) 90 91 return -ENOMEM;
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
··· 910 910 nvkm_debug(subdev, "%d PBDMA(s)\n", fifo->pbdma_nr); 911 911 912 912 /* Read PBDMA->runlist(s) mapping from HW. */ 913 - if (!(map = kzalloc(sizeof(*map) * fifo->pbdma_nr, GFP_KERNEL))) 913 + if (!(map = kcalloc(fifo->pbdma_nr, sizeof(*map), GFP_KERNEL))) 914 914 return -ENOMEM; 915 915 916 916 for (i = 0; i < fifo->pbdma_nr; i++)
+1 -1
drivers/gpu/drm/omapdrm/omap_gem.c
··· 268 268 } 269 269 } 270 270 } else { 271 - addrs = kzalloc(npages * sizeof(*addrs), GFP_KERNEL); 271 + addrs = kcalloc(npages, sizeof(*addrs), GFP_KERNEL); 272 272 if (!addrs) { 273 273 ret = -ENOMEM; 274 274 goto free_pages;
+1 -1
drivers/gpu/drm/radeon/atom.c
··· 1176 1176 ectx.abort = false; 1177 1177 ectx.last_jump = 0; 1178 1178 if (ws) 1179 - ectx.ws = kzalloc(4 * ws, GFP_KERNEL); 1179 + ectx.ws = kcalloc(4, ws, GFP_KERNEL); 1180 1180 else 1181 1181 ectx.ws = NULL; 1182 1182
+3 -1
drivers/gpu/drm/radeon/btc_dpm.c
··· 2581 2581 return ret; 2582 2582 2583 2583 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 2584 - kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); 2584 + kcalloc(4, 2585 + sizeof(struct radeon_clock_voltage_dependency_entry), 2586 + GFP_KERNEL); 2585 2587 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 2586 2588 r600_free_extended_power_table(rdev); 2587 2589 return -ENOMEM;
+6 -3
drivers/gpu/drm/radeon/ci_dpm.c
··· 5568 5568 (mode_info->atom_context->bios + data_offset + 5569 5569 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 5570 5570 5571 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 5572 - state_array->ucNumEntries, GFP_KERNEL); 5571 + rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 5572 + sizeof(struct radeon_ps), 5573 + GFP_KERNEL); 5573 5574 if (!rdev->pm.dpm.ps) 5574 5575 return -ENOMEM; 5575 5576 power_state_offset = (u8 *)state_array->states; ··· 5771 5770 ci_set_private_data_variables_based_on_pptable(rdev); 5772 5771 5773 5772 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 5774 - kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); 5773 + kcalloc(4, 5774 + sizeof(struct radeon_clock_voltage_dependency_entry), 5775 + GFP_KERNEL); 5775 5776 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 5776 5777 ci_dpm_fini(rdev); 5777 5778 return -ENOMEM;
+3 -2
drivers/gpu/drm/radeon/kv_dpm.c
··· 2660 2660 (mode_info->atom_context->bios + data_offset + 2661 2661 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 2662 2662 2663 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 2664 - state_array->ucNumEntries, GFP_KERNEL); 2663 + rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 2664 + sizeof(struct radeon_ps), 2665 + GFP_KERNEL); 2665 2666 if (!rdev->pm.dpm.ps) 2666 2667 return -ENOMEM; 2667 2668 power_state_offset = (u8 *)state_array->states;
+6 -3
drivers/gpu/drm/radeon/ni_dpm.c
··· 3998 3998 return -EINVAL; 3999 3999 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 4000 4000 4001 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 4002 - power_info->pplib.ucNumStates, GFP_KERNEL); 4001 + rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates, 4002 + sizeof(struct radeon_ps), 4003 + GFP_KERNEL); 4003 4004 if (!rdev->pm.dpm.ps) 4004 4005 return -ENOMEM; 4005 4006 ··· 4076 4075 return ret; 4077 4076 4078 4077 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 4079 - kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); 4078 + kcalloc(4, 4079 + sizeof(struct radeon_clock_voltage_dependency_entry), 4080 + GFP_KERNEL); 4080 4081 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 4081 4082 r600_free_extended_power_table(rdev); 4082 4083 return -ENOMEM;
+1 -1
drivers/gpu/drm/radeon/r600_dpm.c
··· 991 991 ATOM_PPLIB_PhaseSheddingLimits_Record *entry; 992 992 993 993 rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries = 994 - kzalloc(psl->ucNumEntries * 994 + kcalloc(psl->ucNumEntries, 995 995 sizeof(struct radeon_phase_shedding_limits_entry), 996 996 GFP_KERNEL); 997 997 if (!rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) {
+24 -15
drivers/gpu/drm/radeon/radeon_atombios.c
··· 2126 2126 num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; 2127 2127 if (num_modes == 0) 2128 2128 return state_index; 2129 - rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * num_modes, GFP_KERNEL); 2129 + rdev->pm.power_state = kcalloc(num_modes, 2130 + sizeof(struct radeon_power_state), 2131 + GFP_KERNEL); 2130 2132 if (!rdev->pm.power_state) 2131 2133 return state_index; 2132 2134 /* last mode is usually default, array is low to high */ 2133 2135 for (i = 0; i < num_modes; i++) { 2134 2136 rdev->pm.power_state[state_index].clock_info = 2135 - kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); 2137 + kcalloc(1, sizeof(struct radeon_pm_clock_info), 2138 + GFP_KERNEL); 2136 2139 if (!rdev->pm.power_state[state_index].clock_info) 2137 2140 return state_index; 2138 2141 rdev->pm.power_state[state_index].num_clock_modes = 1; ··· 2590 2587 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); 2591 2588 if (power_info->pplib.ucNumStates == 0) 2592 2589 return state_index; 2593 - rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2594 - power_info->pplib.ucNumStates, GFP_KERNEL); 2590 + rdev->pm.power_state = kcalloc(power_info->pplib.ucNumStates, 2591 + sizeof(struct radeon_power_state), 2592 + GFP_KERNEL); 2595 2593 if (!rdev->pm.power_state) 2596 2594 return state_index; 2597 2595 /* first mode is usually default, followed by low to high */ ··· 2607 2603 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset) + 2608 2604 (power_state->v1.ucNonClockStateIndex * 2609 2605 power_info->pplib.ucNonClockSize)); 2610 - rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) * 2611 - ((power_info->pplib.ucStateEntrySize - 1) ? 2612 - (power_info->pplib.ucStateEntrySize - 1) : 1), 2613 - GFP_KERNEL); 2606 + rdev->pm.power_state[i].clock_info = 2607 + kcalloc((power_info->pplib.ucStateEntrySize - 1) ? 2608 + (power_info->pplib.ucStateEntrySize - 1) : 1, 2609 + sizeof(struct radeon_pm_clock_info), 2610 + GFP_KERNEL); 2614 2611 if (!rdev->pm.power_state[i].clock_info) 2615 2612 return state_index; 2616 2613 if (power_info->pplib.ucStateEntrySize - 1) { ··· 2693 2688 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 2694 2689 if (state_array->ucNumEntries == 0) 2695 2690 return state_index; 2696 - rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2697 - state_array->ucNumEntries, GFP_KERNEL); 2691 + rdev->pm.power_state = kcalloc(state_array->ucNumEntries, 2692 + sizeof(struct radeon_power_state), 2693 + GFP_KERNEL); 2698 2694 if (!rdev->pm.power_state) 2699 2695 return state_index; 2700 2696 power_state_offset = (u8 *)state_array->states; ··· 2705 2699 non_clock_array_index = power_state->v2.nonClockInfoIndex; 2706 2700 non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) 2707 2701 &non_clock_info_array->nonClockInfo[non_clock_array_index]; 2708 - rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) * 2709 - (power_state->v2.ucNumDPMLevels ? 2710 - power_state->v2.ucNumDPMLevels : 1), 2711 - GFP_KERNEL); 2702 + rdev->pm.power_state[i].clock_info = 2703 + kcalloc(power_state->v2.ucNumDPMLevels ? 2704 + power_state->v2.ucNumDPMLevels : 1, 2705 + sizeof(struct radeon_pm_clock_info), 2706 + GFP_KERNEL); 2712 2707 if (!rdev->pm.power_state[i].clock_info) 2713 2708 return state_index; 2714 2709 if (power_state->v2.ucNumDPMLevels) { ··· 2789 2782 rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL); 2790 2783 if (rdev->pm.power_state) { 2791 2784 rdev->pm.power_state[0].clock_info = 2792 - kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); 2785 + kcalloc(1, 2786 + sizeof(struct radeon_pm_clock_info), 2787 + GFP_KERNEL); 2793 2788 if (rdev->pm.power_state[0].clock_info) { 2794 2789 /* add the default mode */ 2795 2790 rdev->pm.power_state[state_index].type =
+6 -3
drivers/gpu/drm/radeon/radeon_combios.c
··· 2642 2642 rdev->pm.default_power_state_index = -1; 2643 2643 2644 2644 /* allocate 2 power states */ 2645 - rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2, GFP_KERNEL); 2645 + rdev->pm.power_state = kcalloc(2, sizeof(struct radeon_power_state), 2646 + GFP_KERNEL); 2646 2647 if (rdev->pm.power_state) { 2647 2648 /* allocate 1 clock mode per state */ 2648 2649 rdev->pm.power_state[0].clock_info = 2649 - kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); 2650 + kcalloc(1, sizeof(struct radeon_pm_clock_info), 2651 + GFP_KERNEL); 2650 2652 rdev->pm.power_state[1].clock_info = 2651 - kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); 2653 + kcalloc(1, sizeof(struct radeon_pm_clock_info), 2654 + GFP_KERNEL); 2652 2655 if (!rdev->pm.power_state[0].clock_info || 2653 2656 !rdev->pm.power_state[1].clock_info) 2654 2657 goto pm_failed;
+1 -1
drivers/gpu/drm/radeon/radeon_test.c
··· 59 59 n = rdev->mc.gtt_size - rdev->gart_pin_size; 60 60 n /= size; 61 61 62 - gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL); 62 + gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL); 63 63 if (!gtt_obj) { 64 64 DRM_ERROR("Failed to allocate %d pointers\n", n); 65 65 r = 1;
+3 -2
drivers/gpu/drm/radeon/rs780_dpm.c
··· 804 804 return -EINVAL; 805 805 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 806 806 807 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 808 - power_info->pplib.ucNumStates, GFP_KERNEL); 807 + rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates, 808 + sizeof(struct radeon_ps), 809 + GFP_KERNEL); 809 810 if (!rdev->pm.dpm.ps) 810 811 return -ENOMEM; 811 812
+3 -2
drivers/gpu/drm/radeon/rv6xx_dpm.c
··· 1888 1888 return -EINVAL; 1889 1889 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 1890 1890 1891 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 1892 - power_info->pplib.ucNumStates, GFP_KERNEL); 1891 + rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates, 1892 + sizeof(struct radeon_ps), 1893 + GFP_KERNEL); 1893 1894 if (!rdev->pm.dpm.ps) 1894 1895 return -ENOMEM; 1895 1896
+3 -2
drivers/gpu/drm/radeon/rv770_dpm.c
··· 2282 2282 return -EINVAL; 2283 2283 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 2284 2284 2285 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 2286 - power_info->pplib.ucNumStates, GFP_KERNEL); 2285 + rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates, 2286 + sizeof(struct radeon_ps), 2287 + GFP_KERNEL); 2287 2288 if (!rdev->pm.dpm.ps) 2288 2289 return -ENOMEM; 2289 2290
+6 -3
drivers/gpu/drm/radeon/si_dpm.c
··· 6832 6832 (mode_info->atom_context->bios + data_offset + 6833 6833 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 6834 6834 6835 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 6836 - state_array->ucNumEntries, GFP_KERNEL); 6835 + rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 6836 + sizeof(struct radeon_ps), 6837 + GFP_KERNEL); 6837 6838 if (!rdev->pm.dpm.ps) 6838 6839 return -ENOMEM; 6839 6840 power_state_offset = (u8 *)state_array->states; ··· 6942 6941 return ret; 6943 6942 6944 6943 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 6945 - kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); 6944 + kcalloc(4, 6945 + sizeof(struct radeon_clock_voltage_dependency_entry), 6946 + GFP_KERNEL); 6946 6947 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 6947 6948 r600_free_extended_power_table(rdev); 6948 6949 return -ENOMEM;
+3 -2
drivers/gpu/drm/radeon/sumo_dpm.c
··· 1482 1482 (mode_info->atom_context->bios + data_offset + 1483 1483 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 1484 1484 1485 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 1486 - state_array->ucNumEntries, GFP_KERNEL); 1485 + rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 1486 + sizeof(struct radeon_ps), 1487 + GFP_KERNEL); 1487 1488 if (!rdev->pm.dpm.ps) 1488 1489 return -ENOMEM; 1489 1490 power_state_offset = (u8 *)state_array->states;
+3 -2
drivers/gpu/drm/radeon/trinity_dpm.c
··· 1757 1757 (mode_info->atom_context->bios + data_offset + 1758 1758 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 1759 1759 1760 - rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 1761 - state_array->ucNumEntries, GFP_KERNEL); 1760 + rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 1761 + sizeof(struct radeon_ps), 1762 + GFP_KERNEL); 1762 1763 if (!rdev->pm.dpm.ps) 1763 1764 return -ENOMEM; 1764 1765 power_state_offset = (u8 *)state_array->states;
+2 -2
drivers/gpu/drm/selftests/test-drm_mm.c
··· 1631 1631 if (!nodes) 1632 1632 goto err; 1633 1633 1634 - bitmap = kzalloc(count / BITS_PER_LONG * sizeof(unsigned long), 1634 + bitmap = kcalloc(count / BITS_PER_LONG, sizeof(unsigned long), 1635 1635 GFP_KERNEL); 1636 1636 if (!bitmap) 1637 1637 goto err_nodes; ··· 1745 1745 if (!nodes) 1746 1746 goto err; 1747 1747 1748 - bitmap = kzalloc(count / BITS_PER_LONG * sizeof(unsigned long), 1748 + bitmap = kcalloc(count / BITS_PER_LONG, sizeof(unsigned long), 1749 1749 GFP_KERNEL); 1750 1750 if (!bitmap) 1751 1751 goto err_nodes;
+2 -2
drivers/hid/hid-debug.c
··· 457 457 char *buf = NULL; 458 458 459 459 if (!f) { 460 - buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); 460 + buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_ATOMIC); 461 461 if (!buf) 462 462 return ERR_PTR(-ENOMEM); 463 463 } ··· 1088 1088 goto out; 1089 1089 } 1090 1090 1091 - if (!(list->hid_debug_buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_KERNEL))) { 1091 + if (!(list->hid_debug_buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_KERNEL))) { 1092 1092 err = -ENOMEM; 1093 1093 kfree(list); 1094 1094 goto out;
+1 -1
drivers/hv/hv.c
··· 190 190 { 191 191 int cpu; 192 192 193 - hv_context.hv_numa_map = kzalloc(sizeof(struct cpumask) * nr_node_ids, 193 + hv_context.hv_numa_map = kcalloc(nr_node_ids, sizeof(struct cpumask), 194 194 GFP_KERNEL); 195 195 if (hv_context.hv_numa_map == NULL) { 196 196 pr_err("Unable to allocate NUMA map\n");
+1 -1
drivers/hv/ring_buffer.c
··· 202 202 * First page holds struct hv_ring_buffer, do wraparound mapping for 203 203 * the rest. 204 204 */ 205 - pages_wraparound = kzalloc(sizeof(struct page *) * (page_cnt * 2 - 1), 205 + pages_wraparound = kcalloc(page_cnt * 2 - 1, sizeof(struct page *), 206 206 GFP_KERNEL); 207 207 if (!pages_wraparound) 208 208 return -ENOMEM;
+4 -3
drivers/hwmon/acpi_power_meter.c
··· 575 575 if (!pss->package.count) 576 576 goto end; 577 577 578 - resource->domain_devices = kzalloc(sizeof(struct acpi_device *) * 579 - pss->package.count, GFP_KERNEL); 578 + resource->domain_devices = kcalloc(pss->package.count, 579 + sizeof(struct acpi_device *), 580 + GFP_KERNEL); 580 581 if (!resource->domain_devices) { 581 582 res = -ENOMEM; 582 583 goto end; ··· 797 796 goto error; 798 797 } 799 798 800 - *str = kzalloc(sizeof(u8) * (element->string.length + 1), 799 + *str = kcalloc(element->string.length + 1, sizeof(u8), 801 800 GFP_KERNEL); 802 801 if (!*str) { 803 802 res = -ENOMEM;
+1 -1
drivers/hwmon/coretemp.c
··· 742 742 return -ENODEV; 743 743 744 744 max_packages = topology_max_packages(); 745 - pkg_devices = kzalloc(max_packages * sizeof(struct platform_device *), 745 + pkg_devices = kcalloc(max_packages, sizeof(struct platform_device *), 746 746 GFP_KERNEL); 747 747 if (!pkg_devices) 748 748 return -ENOMEM;
+3 -2
drivers/hwmon/i5k_amb.c
··· 274 274 num_ambs += hweight16(data->amb_present[i] & 0x7fff); 275 275 276 276 /* Set up sysfs stuff */ 277 - data->attrs = kzalloc(sizeof(*data->attrs) * num_ambs * KNOBS_PER_AMB, 278 - GFP_KERNEL); 277 + data->attrs = kzalloc(array3_size(num_ambs, KNOBS_PER_AMB, 278 + sizeof(*data->attrs)), 279 + GFP_KERNEL); 279 280 if (!data->attrs) 280 281 return -ENOMEM; 281 282 data->num_attrs = 0;
+1 -1
drivers/hwmon/ibmpex.c
··· 387 387 return -ENOENT; 388 388 data->num_sensors = err; 389 389 390 - data->sensors = kzalloc(data->num_sensors * sizeof(*data->sensors), 390 + data->sensors = kcalloc(data->num_sensors, sizeof(*data->sensors), 391 391 GFP_KERNEL); 392 392 if (!data->sensors) 393 393 return -ENOMEM;
+2 -2
drivers/i2c/busses/i2c-amd756-s4882.c
··· 169 169 170 170 printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n"); 171 171 /* Define the 5 virtual adapters and algorithms structures */ 172 - if (!(s4882_adapter = kzalloc(5 * sizeof(struct i2c_adapter), 172 + if (!(s4882_adapter = kcalloc(5, sizeof(struct i2c_adapter), 173 173 GFP_KERNEL))) { 174 174 error = -ENOMEM; 175 175 goto ERROR1; 176 176 } 177 - if (!(s4882_algo = kzalloc(5 * sizeof(struct i2c_algorithm), 177 + if (!(s4882_algo = kcalloc(5, sizeof(struct i2c_algorithm), 178 178 GFP_KERNEL))) { 179 179 error = -ENOMEM; 180 180 goto ERROR2;
+2 -2
drivers/i2c/busses/i2c-nforce2-s4985.c
··· 164 164 165 165 printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4985\n"); 166 166 /* Define the 5 virtual adapters and algorithms structures */ 167 - s4985_adapter = kzalloc(5 * sizeof(struct i2c_adapter), GFP_KERNEL); 167 + s4985_adapter = kcalloc(5, sizeof(struct i2c_adapter), GFP_KERNEL); 168 168 if (!s4985_adapter) { 169 169 error = -ENOMEM; 170 170 goto ERROR1; 171 171 } 172 - s4985_algo = kzalloc(5 * sizeof(struct i2c_algorithm), GFP_KERNEL); 172 + s4985_algo = kcalloc(5, sizeof(struct i2c_algorithm), GFP_KERNEL); 173 173 if (!s4985_algo) { 174 174 error = -ENOMEM; 175 175 goto ERROR2;
+1 -1
drivers/i2c/busses/i2c-nforce2.c
··· 381 381 int res1, res2; 382 382 383 383 /* we support 2 SMBus adapters */ 384 - smbuses = kzalloc(2 * sizeof(struct nforce2_smbus), GFP_KERNEL); 384 + smbuses = kcalloc(2, sizeof(struct nforce2_smbus), GFP_KERNEL); 385 385 if (!smbuses) 386 386 return -ENOMEM; 387 387 pci_set_drvdata(dev, smbuses);
+3 -2
drivers/i2c/i2c-stub.c
··· 338 338 chip->bank_mask >>= 1; 339 339 } 340 340 341 - chip->bank_words = kzalloc(chip->bank_mask * chip->bank_size * 342 - sizeof(u16), GFP_KERNEL); 341 + chip->bank_words = kcalloc(chip->bank_mask * chip->bank_size, 342 + sizeof(u16), 343 + GFP_KERNEL); 343 344 if (!chip->bank_words) 344 345 return -ENOMEM; 345 346
+1 -1
drivers/ide/hpt366.c
··· 1455 1455 if (info == &hpt36x || info == &hpt374) 1456 1456 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 1457 1457 1458 - dyn_info = kzalloc(sizeof(*dyn_info) * (dev2 ? 2 : 1), GFP_KERNEL); 1458 + dyn_info = kcalloc(dev2 ? 2 : 1, sizeof(*dyn_info), GFP_KERNEL); 1459 1459 if (dyn_info == NULL) { 1460 1460 printk(KERN_ERR "%s %s: out of memory!\n", 1461 1461 d.name, pci_name(dev));
+1 -1
drivers/ide/it821x.c
··· 652 652 struct it821x_dev *itdevs; 653 653 int rc; 654 654 655 - itdevs = kzalloc(2 * sizeof(*itdevs), GFP_KERNEL); 655 + itdevs = kcalloc(2, sizeof(*itdevs), GFP_KERNEL); 656 656 if (itdevs == NULL) { 657 657 printk(KERN_ERR DRV_NAME " %s: out of memory\n", pci_name(dev)); 658 658 return -ENOMEM;
+1 -1
drivers/iio/imu/adis_buffer.c
··· 38 38 if (!adis->xfer) 39 39 return -ENOMEM; 40 40 41 - adis->buffer = kzalloc(indio_dev->scan_bytes * 2, GFP_KERNEL); 41 + adis->buffer = kcalloc(indio_dev->scan_bytes, 2, GFP_KERNEL); 42 42 if (!adis->buffer) 43 43 return -ENOMEM; 44 44
+1 -1
drivers/iio/inkern.c
··· 436 436 } 437 437 438 438 /* NULL terminated array to save passing size */ 439 - chans = kzalloc(sizeof(*chans)*(nummaps + 1), GFP_KERNEL); 439 + chans = kcalloc(nummaps + 1, sizeof(*chans), GFP_KERNEL); 440 440 if (chans == NULL) { 441 441 ret = -ENOMEM; 442 442 goto error_ret;
+3 -2
drivers/infiniband/core/cache.c
··· 1245 1245 rwlock_init(&device->cache.lock); 1246 1246 1247 1247 device->cache.ports = 1248 - kzalloc(sizeof(*device->cache.ports) * 1249 - (rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL); 1248 + kcalloc(rdma_end_port(device) - rdma_start_port(device) + 1, 1249 + sizeof(*device->cache.ports), 1250 + GFP_KERNEL); 1250 1251 if (!device->cache.ports) 1251 1252 return -ENOMEM; 1252 1253
+2 -2
drivers/infiniband/core/device.c
··· 336 336 * Therefore port_immutable is declared as a 1 based array with 337 337 * potential empty slots at the beginning. 338 338 */ 339 - device->port_immutable = kzalloc(sizeof(*device->port_immutable) 340 - * (end_port + 1), 339 + device->port_immutable = kcalloc(end_port + 1, 340 + sizeof(*device->port_immutable), 341 341 GFP_KERNEL); 342 342 if (!device->port_immutable) 343 343 return -ENOMEM;
+6 -4
drivers/infiniband/core/iwpm_util.c
··· 56 56 int ret = 0; 57 57 mutex_lock(&iwpm_admin_lock); 58 58 if (atomic_read(&iwpm_admin.refcount) == 0) { 59 - iwpm_hash_bucket = kzalloc(IWPM_MAPINFO_HASH_SIZE * 60 - sizeof(struct hlist_head), GFP_KERNEL); 59 + iwpm_hash_bucket = kcalloc(IWPM_MAPINFO_HASH_SIZE, 60 + sizeof(struct hlist_head), 61 + GFP_KERNEL); 61 62 if (!iwpm_hash_bucket) { 62 63 ret = -ENOMEM; 63 64 goto init_exit; 64 65 } 65 - iwpm_reminfo_bucket = kzalloc(IWPM_REMINFO_HASH_SIZE * 66 - sizeof(struct hlist_head), GFP_KERNEL); 66 + iwpm_reminfo_bucket = kcalloc(IWPM_REMINFO_HASH_SIZE, 67 + sizeof(struct hlist_head), 68 + GFP_KERNEL); 67 69 if (!iwpm_reminfo_bucket) { 68 70 kfree(iwpm_hash_bucket); 69 71 ret = -ENOMEM;
+2 -2
drivers/infiniband/hw/cxgb3/cxio_hal.c
··· 279 279 if (!wq->qpid) 280 280 return -ENOMEM; 281 281 282 - wq->rq = kzalloc(depth * sizeof(struct t3_swrq), GFP_KERNEL); 282 + wq->rq = kcalloc(depth, sizeof(struct t3_swrq), GFP_KERNEL); 283 283 if (!wq->rq) 284 284 goto err1; 285 285 ··· 287 287 if (!wq->rq_addr) 288 288 goto err2; 289 289 290 - wq->sq = kzalloc(depth * sizeof(struct t3_swsq), GFP_KERNEL); 290 + wq->sq = kcalloc(depth, sizeof(struct t3_swsq), GFP_KERNEL); 291 291 if (!wq->sq) 292 292 goto err3; 293 293
+4 -3
drivers/infiniband/hw/cxgb4/device.c
··· 859 859 rdev->status_page->cq_size = rdev->lldi.vr->cq.size; 860 860 861 861 if (c4iw_wr_log) { 862 - rdev->wr_log = kzalloc((1 << c4iw_wr_log_size_order) * 863 - sizeof(*rdev->wr_log), GFP_KERNEL); 862 + rdev->wr_log = kcalloc(1 << c4iw_wr_log_size_order, 863 + sizeof(*rdev->wr_log), 864 + GFP_KERNEL); 864 865 if (rdev->wr_log) { 865 866 rdev->wr_log_size = 1 << c4iw_wr_log_size_order; 866 867 atomic_set(&rdev->wr_log_idx, 0); ··· 1446 1445 ctx->dev->db_state = RECOVERY; 1447 1446 idr_for_each(&ctx->dev->qpidr, count_qps, &count); 1448 1447 1449 - qp_list.qps = kzalloc(count * sizeof *qp_list.qps, GFP_ATOMIC); 1448 + qp_list.qps = kcalloc(count, sizeof(*qp_list.qps), GFP_ATOMIC); 1450 1449 if (!qp_list.qps) { 1451 1450 spin_unlock_irq(&ctx->dev->lock); 1452 1451 return;
+4 -4
drivers/infiniband/hw/cxgb4/qp.c
··· 216 216 } 217 217 218 218 if (!user) { 219 - wq->sq.sw_sq = kzalloc(wq->sq.size * sizeof *wq->sq.sw_sq, 220 - GFP_KERNEL); 219 + wq->sq.sw_sq = kcalloc(wq->sq.size, sizeof(*wq->sq.sw_sq), 220 + GFP_KERNEL); 221 221 if (!wq->sq.sw_sq) { 222 222 ret = -ENOMEM; 223 223 goto free_rq_qid; 224 224 } 225 225 226 - wq->rq.sw_rq = kzalloc(wq->rq.size * sizeof *wq->rq.sw_rq, 227 - GFP_KERNEL); 226 + wq->rq.sw_rq = kcalloc(wq->rq.size, sizeof(*wq->rq.sw_rq), 227 + GFP_KERNEL); 228 228 if (!wq->rq.sw_rq) { 229 229 ret = -ENOMEM; 230 230 goto free_sw_sq;
+1 -1
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
··· 3177 3177 struct device *dev = hr_dev->dev; 3178 3178 int ret = -EINVAL; 3179 3179 3180 - context = kzalloc(2 * sizeof(*context), GFP_KERNEL); 3180 + context = kcalloc(2, sizeof(*context), GFP_KERNEL); 3181 3181 if (!context) 3182 3182 return -ENOMEM; 3183 3183
+2 -1
drivers/infiniband/hw/mlx4/mad.c
··· 1613 1613 1614 1614 tun_qp = &ctx->qp[qp_type]; 1615 1615 1616 - tun_qp->ring = kzalloc(sizeof (struct mlx4_ib_buf) * MLX4_NUM_TUNNEL_BUFS, 1616 + tun_qp->ring = kcalloc(MLX4_NUM_TUNNEL_BUFS, 1617 + sizeof(struct mlx4_ib_buf), 1617 1618 GFP_KERNEL); 1618 1619 if (!tun_qp->ring) 1619 1620 return -ENOMEM;
+1 -1
drivers/infiniband/hw/mthca/mthca_mr.c
··· 144 144 buddy->max_order = max_order; 145 145 spin_lock_init(&buddy->lock); 146 146 147 - buddy->bits = kzalloc((buddy->max_order + 1) * sizeof (long *), 147 + buddy->bits = kcalloc(buddy->max_order + 1, sizeof(long *), 148 148 GFP_KERNEL); 149 149 buddy->num_free = kcalloc((buddy->max_order + 1), sizeof *buddy->num_free, 150 150 GFP_KERNEL);
+1 -1
drivers/infiniband/hw/mthca/mthca_profile.c
··· 79 79 struct mthca_resource *profile; 80 80 int i, j; 81 81 82 - profile = kzalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL); 82 + profile = kcalloc(MTHCA_RES_NUM, sizeof(*profile), GFP_KERNEL); 83 83 if (!profile) 84 84 return -ENOMEM; 85 85
+2 -1
drivers/infiniband/hw/nes/nes_mgt.c
··· 878 878 int ret; 879 879 880 880 /* Allocate space the all mgt QPs once */ 881 - mgtvnic = kzalloc(NES_MGT_QP_COUNT * sizeof(struct nes_vnic_mgt), GFP_KERNEL); 881 + mgtvnic = kcalloc(NES_MGT_QP_COUNT, sizeof(struct nes_vnic_mgt), 882 + GFP_KERNEL); 882 883 if (!mgtvnic) 883 884 return -ENOMEM; 884 885
+3 -2
drivers/infiniband/hw/nes/nes_verbs.c
··· 2254 2254 ibmr = ERR_PTR(-ENOMEM); 2255 2255 goto reg_user_mr_err; 2256 2256 } 2257 - root_vpbl.leaf_vpbl = kzalloc(sizeof(*root_vpbl.leaf_vpbl)*1024, 2258 - GFP_KERNEL); 2257 + root_vpbl.leaf_vpbl = kcalloc(1024, 2258 + sizeof(*root_vpbl.leaf_vpbl), 2259 + GFP_KERNEL); 2259 2260 if (!root_vpbl.leaf_vpbl) { 2260 2261 ib_umem_release(region); 2261 2262 pci_free_consistent(nesdev->pcidev, 8192, root_vpbl.pbl_vbase,
+1 -1
drivers/infiniband/hw/ocrdma/ocrdma_hw.c
··· 3096 3096 if (!num_eq) 3097 3097 return -EINVAL; 3098 3098 3099 - dev->eq_tbl = kzalloc(sizeof(struct ocrdma_eq) * num_eq, GFP_KERNEL); 3099 + dev->eq_tbl = kcalloc(num_eq, sizeof(struct ocrdma_eq), GFP_KERNEL); 3100 3100 if (!dev->eq_tbl) 3101 3101 return -ENOMEM; 3102 3102
+6 -5
drivers/infiniband/hw/ocrdma/ocrdma_main.c
··· 221 221 static int ocrdma_alloc_resources(struct ocrdma_dev *dev) 222 222 { 223 223 mutex_init(&dev->dev_lock); 224 - dev->cq_tbl = kzalloc(sizeof(struct ocrdma_cq *) * 225 - OCRDMA_MAX_CQ, GFP_KERNEL); 224 + dev->cq_tbl = kcalloc(OCRDMA_MAX_CQ, sizeof(struct ocrdma_cq *), 225 + GFP_KERNEL); 226 226 if (!dev->cq_tbl) 227 227 goto alloc_err; 228 228 229 229 if (dev->attr.max_qp) { 230 - dev->qp_tbl = kzalloc(sizeof(struct ocrdma_qp *) * 231 - OCRDMA_MAX_QP, GFP_KERNEL); 230 + dev->qp_tbl = kcalloc(OCRDMA_MAX_QP, 231 + sizeof(struct ocrdma_qp *), 232 + GFP_KERNEL); 232 233 if (!dev->qp_tbl) 233 234 goto alloc_err; 234 235 } 235 236 236 - dev->stag_arr = kzalloc(sizeof(u64) * OCRDMA_MAX_STAG, GFP_KERNEL); 237 + dev->stag_arr = kcalloc(OCRDMA_MAX_STAG, sizeof(u64), GFP_KERNEL); 237 238 if (dev->stag_arr == NULL) 238 239 goto alloc_err; 239 240
+6 -6
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
··· 843 843 void *va; 844 844 dma_addr_t pa; 845 845 846 - mr->pbl_table = kzalloc(sizeof(struct ocrdma_pbl) * 847 - mr->num_pbls, GFP_KERNEL); 846 + mr->pbl_table = kcalloc(mr->num_pbls, sizeof(struct ocrdma_pbl), 847 + GFP_KERNEL); 848 848 849 849 if (!mr->pbl_table) 850 850 return -ENOMEM; ··· 1323 1323 static int ocrdma_alloc_wr_id_tbl(struct ocrdma_qp *qp) 1324 1324 { 1325 1325 qp->wqe_wr_id_tbl = 1326 - kzalloc(sizeof(*(qp->wqe_wr_id_tbl)) * qp->sq.max_cnt, 1326 + kcalloc(qp->sq.max_cnt, sizeof(*(qp->wqe_wr_id_tbl)), 1327 1327 GFP_KERNEL); 1328 1328 if (qp->wqe_wr_id_tbl == NULL) 1329 1329 return -ENOMEM; 1330 1330 qp->rqe_wr_id_tbl = 1331 - kzalloc(sizeof(u64) * qp->rq.max_cnt, GFP_KERNEL); 1331 + kcalloc(qp->rq.max_cnt, sizeof(u64), GFP_KERNEL); 1332 1332 if (qp->rqe_wr_id_tbl == NULL) 1333 1333 return -ENOMEM; 1334 1334 ··· 1865 1865 1866 1866 if (udata == NULL) { 1867 1867 status = -ENOMEM; 1868 - srq->rqe_wr_id_tbl = kzalloc(sizeof(u64) * srq->rq.max_cnt, 1869 - GFP_KERNEL); 1868 + srq->rqe_wr_id_tbl = kcalloc(srq->rq.max_cnt, sizeof(u64), 1869 + GFP_KERNEL); 1870 1870 if (srq->rqe_wr_id_tbl == NULL) 1871 1871 goto arm_err; 1872 1872
+2 -2
drivers/infiniband/hw/qedr/main.c
··· 317 317 u16 n_entries; 318 318 int i, rc; 319 319 320 - dev->sgid_tbl = kzalloc(sizeof(union ib_gid) * 321 - QEDR_MAX_SGID, GFP_KERNEL); 320 + dev->sgid_tbl = kcalloc(QEDR_MAX_SGID, sizeof(union ib_gid), 321 + GFP_KERNEL); 322 322 if (!dev->sgid_tbl) 323 323 return -ENOMEM; 324 324
+2 -2
drivers/infiniband/hw/qedr/verbs.c
··· 1614 1614 qp->sq.max_wr = min_t(u32, attrs->cap.max_send_wr * dev->wq_multiplier, 1615 1615 dev->attr.max_sqe); 1616 1616 1617 - qp->wqe_wr_id = kzalloc(qp->sq.max_wr * sizeof(*qp->wqe_wr_id), 1617 + qp->wqe_wr_id = kcalloc(qp->sq.max_wr, sizeof(*qp->wqe_wr_id), 1618 1618 GFP_KERNEL); 1619 1619 if (!qp->wqe_wr_id) { 1620 1620 DP_ERR(dev, "create qp: failed SQ shadow memory allocation\n"); ··· 1632 1632 qp->rq.max_wr = (u16) max_t(u32, attrs->cap.max_recv_wr, 1); 1633 1633 1634 1634 /* Allocate driver internal RQ array */ 1635 - qp->rqe_wr_id = kzalloc(qp->rq.max_wr * sizeof(*qp->rqe_wr_id), 1635 + qp->rqe_wr_id = kcalloc(qp->rq.max_wr, sizeof(*qp->rqe_wr_id), 1636 1636 GFP_KERNEL); 1637 1637 if (!qp->rqe_wr_id) { 1638 1638 DP_ERR(dev,
+3 -2
drivers/infiniband/hw/qib/qib_iba7322.c
··· 7295 7295 actual_cnt -= dd->num_pports; 7296 7296 7297 7297 tabsize = actual_cnt; 7298 - dd->cspec->msix_entries = kzalloc(tabsize * 7299 - sizeof(struct qib_msix_entry), GFP_KERNEL); 7298 + dd->cspec->msix_entries = kcalloc(tabsize, 7299 + sizeof(struct qib_msix_entry), 7300 + GFP_KERNEL); 7300 7301 if (!dd->cspec->msix_entries) 7301 7302 tabsize = 0; 7302 7303
+2 -2
drivers/infiniband/hw/qib/qib_init.c
··· 1134 1134 if (!qib_cpulist_count) { 1135 1135 u32 count = num_online_cpus(); 1136 1136 1137 - qib_cpulist = kzalloc(BITS_TO_LONGS(count) * 1138 - sizeof(long), GFP_KERNEL); 1137 + qib_cpulist = kcalloc(BITS_TO_LONGS(count), sizeof(long), 1138 + GFP_KERNEL); 1139 1139 if (qib_cpulist) 1140 1140 qib_cpulist_count = count; 1141 1141 }
+1 -1
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
··· 543 543 /* Do Nothing */ 544 544 } 545 545 546 - res_chunk_list = kzalloc(sizeof(*res_chunk_list)*(res_lst_sz+1), 546 + res_chunk_list = kcalloc(res_lst_sz + 1, sizeof(*res_chunk_list), 547 547 GFP_ATOMIC); 548 548 if (!res_chunk_list) 549 549 return ERR_PTR(-ENOMEM);
+1 -1
drivers/infiniband/hw/usnic/usnic_vnic.c
··· 312 312 } 313 313 314 314 chunk->cnt = chunk->free_cnt = cnt; 315 - chunk->res = kzalloc(sizeof(*(chunk->res))*cnt, GFP_KERNEL); 315 + chunk->res = kcalloc(cnt, sizeof(*(chunk->res)), GFP_KERNEL); 316 316 if (!chunk->res) 317 317 return -ENOMEM; 318 318
+4 -3
drivers/infiniband/ulp/ipoib/ipoib_main.c
··· 1526 1526 return -ENOMEM; 1527 1527 set_bit(IPOIB_STOP_NEIGH_GC, &priv->flags); 1528 1528 size = roundup_pow_of_two(arp_tbl.gc_thresh3); 1529 - buckets = kzalloc(size * sizeof(*buckets), GFP_KERNEL); 1529 + buckets = kcalloc(size, sizeof(*buckets), GFP_KERNEL); 1530 1530 if (!buckets) { 1531 1531 kfree(htbl); 1532 1532 return -ENOMEM; ··· 1704 1704 ipoib_napi_add(dev); 1705 1705 1706 1706 /* Allocate RX/TX "rings" to hold queued skbs */ 1707 - priv->rx_ring = kzalloc(ipoib_recvq_size * sizeof *priv->rx_ring, 1708 - GFP_KERNEL); 1707 + priv->rx_ring = kcalloc(ipoib_recvq_size, 1708 + sizeof(*priv->rx_ring), 1709 + GFP_KERNEL); 1709 1710 if (!priv->rx_ring) 1710 1711 goto out; 1711 1712
+3 -2
drivers/infiniband/ulp/isert/ib_isert.c
··· 181 181 u64 dma_addr; 182 182 int i, j; 183 183 184 - isert_conn->rx_descs = kzalloc(ISERT_QP_MAX_RECV_DTOS * 185 - sizeof(struct iser_rx_desc), GFP_KERNEL); 184 + isert_conn->rx_descs = kcalloc(ISERT_QP_MAX_RECV_DTOS, 185 + sizeof(struct iser_rx_desc), 186 + GFP_KERNEL); 186 187 if (!isert_conn->rx_descs) 187 188 return -ENOMEM; 188 189
+2 -1
drivers/input/keyboard/omap4-keypad.c
··· 337 337 338 338 keypad_data->row_shift = get_count_order(keypad_data->cols); 339 339 max_keys = keypad_data->rows << keypad_data->row_shift; 340 - keypad_data->keymap = kzalloc(max_keys * sizeof(keypad_data->keymap[0]), 340 + keypad_data->keymap = kcalloc(max_keys, 341 + sizeof(keypad_data->keymap[0]), 341 342 GFP_KERNEL); 342 343 if (!keypad_data->keymap) { 343 344 dev_err(&pdev->dev, "Not enough memory for keymap\n");
+1 -1
drivers/iommu/dmar.c
··· 1458 1458 1459 1459 qi->desc = page_address(desc_page); 1460 1460 1461 - qi->desc_status = kzalloc(QI_LENGTH * sizeof(int), GFP_ATOMIC); 1461 + qi->desc_status = kcalloc(QI_LENGTH, sizeof(int), GFP_ATOMIC); 1462 1462 if (!qi->desc_status) { 1463 1463 free_page((unsigned long) qi->desc); 1464 1464 kfree(qi);
+2 -2
drivers/iommu/intel-iommu.c
··· 3189 3189 /* This is too big for the stack - allocate it from slab */ 3190 3190 ctxt_table_entries = ext ? 512 : 256; 3191 3191 ret = -ENOMEM; 3192 - ctxt_tbls = kzalloc(ctxt_table_entries * sizeof(void *), GFP_KERNEL); 3192 + ctxt_tbls = kcalloc(ctxt_table_entries, sizeof(void *), GFP_KERNEL); 3193 3193 if (!ctxt_tbls) 3194 3194 goto out_unmap; 3195 3195 ··· 4032 4032 unsigned long flag; 4033 4033 4034 4034 for_each_active_iommu(iommu, drhd) { 4035 - iommu->iommu_state = kzalloc(sizeof(u32) * MAX_SR_DMAR_REGS, 4035 + iommu->iommu_state = kcalloc(MAX_SR_DMAR_REGS, sizeof(u32), 4036 4036 GFP_ATOMIC); 4037 4037 if (!iommu->iommu_state) 4038 4038 goto nomem;
+1 -1
drivers/iommu/omap-iommu.c
··· 1455 1455 if (num_iommus < 0) 1456 1456 return 0; 1457 1457 1458 - arch_data = kzalloc((num_iommus + 1) * sizeof(*arch_data), GFP_KERNEL); 1458 + arch_data = kcalloc(num_iommus + 1, sizeof(*arch_data), GFP_KERNEL); 1459 1459 if (!arch_data) 1460 1460 return -ENOMEM; 1461 1461
+2 -2
drivers/ipack/carriers/tpci200.c
··· 457 457 { 458 458 int res; 459 459 460 - tpci200->slots = kzalloc( 461 - TPCI200_NB_SLOT * sizeof(struct tpci200_slot), GFP_KERNEL); 460 + tpci200->slots = kcalloc(TPCI200_NB_SLOT, sizeof(struct tpci200_slot), 461 + GFP_KERNEL); 462 462 if (tpci200->slots == NULL) 463 463 return -ENOMEM; 464 464
+2 -1
drivers/irqchip/irq-alpine-msi.c
··· 268 268 goto err_priv; 269 269 } 270 270 271 - priv->msi_map = kzalloc(sizeof(*priv->msi_map) * BITS_TO_LONGS(priv->num_spis), 271 + priv->msi_map = kcalloc(BITS_TO_LONGS(priv->num_spis), 272 + sizeof(*priv->msi_map), 272 273 GFP_KERNEL); 273 274 if (!priv->msi_map) { 274 275 ret = -ENOMEM;
+1 -1
drivers/irqchip/irq-gic-v2m.c
··· 361 361 break; 362 362 } 363 363 364 - v2m->bm = kzalloc(sizeof(long) * BITS_TO_LONGS(v2m->nr_spis), 364 + v2m->bm = kcalloc(BITS_TO_LONGS(v2m->nr_spis), sizeof(long), 365 365 GFP_KERNEL); 366 366 if (!v2m->bm) { 367 367 ret = -ENOMEM;
+8 -7
drivers/irqchip/irq-gic-v3-its.c
··· 1239 1239 if (!its_dev->event_map.vm) { 1240 1240 struct its_vlpi_map *maps; 1241 1241 1242 - maps = kzalloc(sizeof(*maps) * its_dev->event_map.nr_lpis, 1242 + maps = kcalloc(its_dev->event_map.nr_lpis, sizeof(*maps), 1243 1243 GFP_KERNEL); 1244 1244 if (!maps) { 1245 1245 ret = -ENOMEM; ··· 1437 1437 { 1438 1438 lpi_chunks = its_lpi_to_chunk(1UL << id_bits); 1439 1439 1440 - lpi_bitmap = kzalloc(BITS_TO_LONGS(lpi_chunks) * sizeof(long), 1440 + lpi_bitmap = kcalloc(BITS_TO_LONGS(lpi_chunks), sizeof(long), 1441 1441 GFP_KERNEL); 1442 1442 if (!lpi_bitmap) { 1443 1443 lpi_chunks = 0; ··· 1471 1471 if (!nr_chunks) 1472 1472 goto out; 1473 1473 1474 - bitmap = kzalloc(BITS_TO_LONGS(nr_chunks * IRQS_PER_CHUNK) * sizeof (long), 1474 + bitmap = kcalloc(BITS_TO_LONGS(nr_chunks * IRQS_PER_CHUNK), 1475 + sizeof(long), 1475 1476 GFP_ATOMIC); 1476 1477 if (!bitmap) 1477 1478 goto out; ··· 1824 1823 1825 1824 static int its_alloc_collections(struct its_node *its) 1826 1825 { 1827 - its->collections = kzalloc(nr_cpu_ids * sizeof(*its->collections), 1826 + its->collections = kcalloc(nr_cpu_ids, sizeof(*its->collections), 1828 1827 GFP_KERNEL); 1829 1828 if (!its->collections) 1830 1829 return -ENOMEM; ··· 2125 2124 if (alloc_lpis) { 2126 2125 lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis); 2127 2126 if (lpi_map) 2128 - col_map = kzalloc(sizeof(*col_map) * nr_lpis, 2127 + col_map = kcalloc(nr_lpis, sizeof(*col_map), 2129 2128 GFP_KERNEL); 2130 2129 } else { 2131 - col_map = kzalloc(sizeof(*col_map) * nr_ites, GFP_KERNEL); 2130 + col_map = kcalloc(nr_ites, sizeof(*col_map), GFP_KERNEL); 2132 2131 nr_lpis = 0; 2133 2132 lpi_base = 0; 2134 2133 } ··· 3184 3183 its = list_first_entry(&its_nodes, struct its_node, entry); 3185 3184 3186 3185 entries = roundup_pow_of_two(nr_cpu_ids); 3187 - vpe_proxy.vpes = kzalloc(sizeof(*vpe_proxy.vpes) * entries, 3186 + vpe_proxy.vpes = kcalloc(entries, sizeof(*vpe_proxy.vpes), 3188 3187 GFP_KERNEL); 3189 3188 if (!vpe_proxy.vpes) { 3190 3189 pr_err("ITS: Can't allocate GICv4 proxy device array\n");
+3 -2
drivers/irqchip/irq-gic-v3.c
··· 1167 1167 if (!nr_parts) 1168 1168 goto out_put_node; 1169 1169 1170 - parts = kzalloc(sizeof(*parts) * nr_parts, GFP_KERNEL); 1170 + parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); 1171 1171 if (WARN_ON(!parts)) 1172 1172 goto out_put_node; 1173 1173 ··· 1289 1289 if (of_property_read_u32(node, "#redistributor-regions", &nr_redist_regions)) 1290 1290 nr_redist_regions = 1; 1291 1291 1292 - rdist_regs = kzalloc(sizeof(*rdist_regs) * nr_redist_regions, GFP_KERNEL); 1292 + rdist_regs = kcalloc(nr_redist_regions, sizeof(*rdist_regs), 1293 + GFP_KERNEL); 1293 1294 if (!rdist_regs) { 1294 1295 err = -ENOMEM; 1295 1296 goto out_unmap_dist;
+1 -1
drivers/irqchip/irq-partition-percpu.c
··· 229 229 goto out; 230 230 desc->domain = d; 231 231 232 - desc->bitmap = kzalloc(sizeof(long) * BITS_TO_LONGS(nr_parts), 232 + desc->bitmap = kcalloc(BITS_TO_LONGS(nr_parts), sizeof(long), 233 233 GFP_KERNEL); 234 234 if (WARN_ON(!desc->bitmap)) 235 235 goto out;
+1 -1
drivers/irqchip/irq-s3c24xx.c
··· 1261 1261 return -ENOMEM; 1262 1262 1263 1263 intc->domain = domain; 1264 - intc->irqs = kzalloc(sizeof(struct s3c_irq_data) * 32, 1264 + intc->irqs = kcalloc(32, sizeof(struct s3c_irq_data), 1265 1265 GFP_KERNEL); 1266 1266 if (!intc->irqs) { 1267 1267 kfree(intc);
+1 -1
drivers/isdn/capi/capi.c
··· 1260 1260 if (capi_ttyminors <= 0) 1261 1261 capi_ttyminors = CAPINC_NR_PORTS; 1262 1262 1263 - capiminors = kzalloc(sizeof(struct capiminor *) * capi_ttyminors, 1263 + capiminors = kcalloc(capi_ttyminors, sizeof(struct capiminor *), 1264 1264 GFP_KERNEL); 1265 1265 if (!capiminors) 1266 1266 return -ENOMEM;
+1 -1
drivers/isdn/gigaset/capi.c
··· 1370 1370 cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; 1371 1371 1372 1372 /* build command table */ 1373 - commands = kzalloc(AT_NUM * (sizeof *commands), GFP_KERNEL); 1373 + commands = kcalloc(AT_NUM, sizeof(*commands), GFP_KERNEL); 1374 1374 if (!commands) 1375 1375 goto oom; 1376 1376
+1 -1
drivers/isdn/gigaset/i4l.c
··· 243 243 dev_kfree_skb(bcs->rx_skb); 244 244 gigaset_new_rx_skb(bcs); 245 245 246 - commands = kzalloc(AT_NUM * (sizeof *commands), GFP_ATOMIC); 246 + commands = kcalloc(AT_NUM, sizeof(*commands), GFP_ATOMIC); 247 247 if (!commands) { 248 248 gigaset_free_channel(bcs); 249 249 dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n");
+1 -1
drivers/isdn/hardware/avm/b1.c
··· 72 72 if (!card) 73 73 return NULL; 74 74 75 - cinfo = kzalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL); 75 + cinfo = kcalloc(nr_controllers, sizeof(*cinfo), GFP_KERNEL); 76 76 if (!cinfo) { 77 77 kfree(card); 78 78 return NULL;
+3 -1
drivers/isdn/hisax/fsm.c
··· 27 27 int i; 28 28 29 29 fsm->jumpmatrix = 30 - kzalloc(sizeof(FSMFNPTR) * fsm->state_count * fsm->event_count, GFP_KERNEL); 30 + kzalloc(array3_size(sizeof(FSMFNPTR), fsm->state_count, 31 + fsm->event_count), 32 + GFP_KERNEL); 31 33 if (!fsm->jumpmatrix) 32 34 return -ENOMEM; 33 35
+2 -2
drivers/isdn/i4l/isdn_common.c
··· 2070 2070 2071 2071 if ((adding) && (d->rcverr)) 2072 2072 kfree(d->rcverr); 2073 - if (!(d->rcverr = kzalloc(sizeof(int) * m, GFP_ATOMIC))) { 2073 + if (!(d->rcverr = kcalloc(m, sizeof(int), GFP_ATOMIC))) { 2074 2074 printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n"); 2075 2075 return -1; 2076 2076 } 2077 2077 2078 2078 if ((adding) && (d->rcvcount)) 2079 2079 kfree(d->rcvcount); 2080 - if (!(d->rcvcount = kzalloc(sizeof(int) * m, GFP_ATOMIC))) { 2080 + if (!(d->rcvcount = kcalloc(m, sizeof(int), GFP_ATOMIC))) { 2081 2081 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); 2082 2082 if (!adding) 2083 2083 kfree(d->rcverr);
+4 -2
drivers/isdn/mISDN/fsm.c
··· 32 32 { 33 33 int i; 34 34 35 - fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count * 36 - fsm->event_count, GFP_KERNEL); 35 + fsm->jumpmatrix = 36 + kzalloc(array3_size(sizeof(FSMFNPTR), fsm->state_count, 37 + fsm->event_count), 38 + GFP_KERNEL); 37 39 if (fsm->jumpmatrix == NULL) 38 40 return -ENOMEM; 39 41
+1 -1
drivers/lightnvm/pblk-init.c
··· 379 379 return -EINVAL; 380 380 } 381 381 382 - pblk->pad_dist = kzalloc((pblk->min_write_pgs - 1) * sizeof(atomic64_t), 382 + pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t), 383 383 GFP_KERNEL); 384 384 if (!pblk->pad_dist) 385 385 return -ENOMEM;
+2 -1
drivers/mailbox/pcc.c
··· 466 466 return -EINVAL; 467 467 } 468 468 469 - pcc_mbox_channels = kzalloc(sizeof(struct mbox_chan) * count, GFP_KERNEL); 469 + pcc_mbox_channels = kcalloc(count, sizeof(struct mbox_chan), 470 + GFP_KERNEL); 470 471 if (!pcc_mbox_channels) { 471 472 pr_err("Could not allocate space for PCC mbox channels\n"); 472 473 return -ENOMEM;
+4 -3
drivers/md/bcache/super.c
··· 1715 1715 iter_size = (sb->bucket_size / sb->block_size + 1) * 1716 1716 sizeof(struct btree_iter_set); 1717 1717 1718 - if (!(c->devices = kzalloc(c->nr_uuids * sizeof(void *), GFP_KERNEL)) || 1718 + if (!(c->devices = kcalloc(c->nr_uuids, sizeof(void *), GFP_KERNEL)) || 1719 1719 mempool_init_slab_pool(&c->search, 32, bch_search_cache) || 1720 1720 mempool_init_kmalloc_pool(&c->bio_meta, 2, 1721 1721 sizeof(struct bbio) + sizeof(struct bio_vec) * ··· 2043 2043 !init_heap(&ca->heap, free << 3, GFP_KERNEL) || 2044 2044 !(ca->buckets = vzalloc(sizeof(struct bucket) * 2045 2045 ca->sb.nbuckets)) || 2046 - !(ca->prio_buckets = kzalloc(sizeof(uint64_t) * prio_buckets(ca) * 2047 - 2, GFP_KERNEL)) || 2046 + !(ca->prio_buckets = kzalloc(array3_size(sizeof(uint64_t), 2047 + prio_buckets(ca), 2), 2048 + GFP_KERNEL)) || 2048 2049 !(ca->disk_buckets = alloc_bucket_pages(GFP_KERNEL, ca))) 2049 2050 return -ENOMEM; 2050 2051
+3 -2
drivers/md/dm-crypt.c
··· 1878 1878 unsigned i; 1879 1879 int err; 1880 1880 1881 - cc->cipher_tfm.tfms = kzalloc(cc->tfms_count * 1882 - sizeof(struct crypto_skcipher *), GFP_KERNEL); 1881 + cc->cipher_tfm.tfms = kcalloc(cc->tfms_count, 1882 + sizeof(struct crypto_skcipher *), 1883 + GFP_KERNEL); 1883 1884 if (!cc->cipher_tfm.tfms) 1884 1885 return -ENOMEM; 1885 1886
+1 -1
drivers/md/md-bitmap.c
··· 2117 2117 2118 2118 pages = DIV_ROUND_UP(chunks, PAGE_COUNTER_RATIO); 2119 2119 2120 - new_bp = kzalloc(pages * sizeof(*new_bp), GFP_KERNEL); 2120 + new_bp = kcalloc(pages, sizeof(*new_bp), GFP_KERNEL); 2121 2121 ret = -ENOMEM; 2122 2122 if (!new_bp) { 2123 2123 bitmap_file_unmap(&store);
+3 -3
drivers/md/md-cluster.c
··· 1380 1380 char str[64]; 1381 1381 struct md_cluster_info *cinfo = mddev->cluster_info; 1382 1382 1383 - cinfo->other_bitmap_lockres = kzalloc((mddev->bitmap_info.nodes - 1) * 1384 - sizeof(struct dlm_lock_resource *), 1385 - GFP_KERNEL); 1383 + cinfo->other_bitmap_lockres = 1384 + kcalloc(mddev->bitmap_info.nodes - 1, 1385 + sizeof(struct dlm_lock_resource *), GFP_KERNEL); 1386 1386 if (!cinfo->other_bitmap_lockres) { 1387 1387 pr_err("md: can't alloc mem for other bitmap locks\n"); 1388 1388 return 0;
+2 -1
drivers/md/md-multipath.c
··· 399 399 if (!conf) 400 400 goto out; 401 401 402 - conf->multipaths = kzalloc(sizeof(struct multipath_info)*mddev->raid_disks, 402 + conf->multipaths = kcalloc(mddev->raid_disks, 403 + sizeof(struct multipath_info), 403 404 GFP_KERNEL); 404 405 if (!conf->multipaths) 405 406 goto out_free_conf;
+6 -4
drivers/md/raid0.c
··· 159 159 } 160 160 161 161 err = -ENOMEM; 162 - conf->strip_zone = kzalloc(sizeof(struct strip_zone)* 163 - conf->nr_strip_zones, GFP_KERNEL); 162 + conf->strip_zone = kcalloc(conf->nr_strip_zones, 163 + sizeof(struct strip_zone), 164 + GFP_KERNEL); 164 165 if (!conf->strip_zone) 165 166 goto abort; 166 - conf->devlist = kzalloc(sizeof(struct md_rdev*)* 167 - conf->nr_strip_zones*mddev->raid_disks, 167 + conf->devlist = kzalloc(array3_size(sizeof(struct md_rdev *), 168 + conf->nr_strip_zones, 169 + mddev->raid_disks), 168 170 GFP_KERNEL); 169 171 if (!conf->devlist) 170 172 goto abort;
+5 -4
drivers/md/raid1.c
··· 2936 2936 if (!conf->barrier) 2937 2937 goto abort; 2938 2938 2939 - conf->mirrors = kzalloc(sizeof(struct raid1_info) 2940 - * mddev->raid_disks * 2, 2941 - GFP_KERNEL); 2939 + conf->mirrors = kzalloc(array3_size(sizeof(struct raid1_info), 2940 + mddev->raid_disks, 2), 2941 + GFP_KERNEL); 2942 2942 if (!conf->mirrors) 2943 2943 goto abort; 2944 2944 ··· 3241 3241 kfree(newpoolinfo); 3242 3242 return ret; 3243 3243 } 3244 - newmirrors = kzalloc(sizeof(struct raid1_info) * raid_disks * 2, 3244 + newmirrors = kzalloc(array3_size(sizeof(struct raid1_info), 3245 + raid_disks, 2), 3245 3246 GFP_KERNEL); 3246 3247 if (!newmirrors) { 3247 3248 kfree(newpoolinfo);
+6 -7
drivers/md/raid10.c
··· 3688 3688 goto out; 3689 3689 3690 3690 /* FIXME calc properly */ 3691 - conf->mirrors = kzalloc(sizeof(struct raid10_info)*(mddev->raid_disks + 3692 - max(0,-mddev->delta_disks)), 3691 + conf->mirrors = kcalloc(mddev->raid_disks + max(0, -mddev->delta_disks), 3692 + sizeof(struct raid10_info), 3693 3693 GFP_KERNEL); 3694 3694 if (!conf->mirrors) 3695 3695 goto out; ··· 4129 4129 conf->mirrors_new = NULL; 4130 4130 if (mddev->delta_disks > 0) { 4131 4131 /* allocate new 'mirrors' list */ 4132 - conf->mirrors_new = kzalloc( 4133 - sizeof(struct raid10_info) 4134 - *(mddev->raid_disks + 4135 - mddev->delta_disks), 4136 - GFP_KERNEL); 4132 + conf->mirrors_new = 4133 + kcalloc(mddev->raid_disks + mddev->delta_disks, 4134 + sizeof(struct raid10_info), 4135 + GFP_KERNEL); 4137 4136 if (!conf->mirrors_new) 4138 4137 return -ENOMEM; 4139 4138 }
+8 -7
drivers/md/raid5.c
··· 2396 2396 * is completely stalled, so now is a good time to resize 2397 2397 * conf->disks and the scribble region 2398 2398 */ 2399 - ndisks = kzalloc(newsize * sizeof(struct disk_info), GFP_NOIO); 2399 + ndisks = kcalloc(newsize, sizeof(struct disk_info), GFP_NOIO); 2400 2400 if (ndisks) { 2401 2401 for (i = 0; i < conf->pool_size; i++) 2402 2402 ndisks[i] = conf->disks[i]; ··· 6664 6664 } 6665 6665 *group_cnt = num_possible_nodes(); 6666 6666 size = sizeof(struct r5worker) * cnt; 6667 - workers = kzalloc(size * *group_cnt, GFP_NOIO); 6668 - *worker_groups = kzalloc(sizeof(struct r5worker_group) * 6669 - *group_cnt, GFP_NOIO); 6667 + workers = kcalloc(size, *group_cnt, GFP_NOIO); 6668 + *worker_groups = kcalloc(*group_cnt, sizeof(struct r5worker_group), 6669 + GFP_NOIO); 6670 6670 if (!*worker_groups || !workers) { 6671 6671 kfree(workers); 6672 6672 kfree(*worker_groups); ··· 6894 6894 goto abort; 6895 6895 INIT_LIST_HEAD(&conf->free_list); 6896 6896 INIT_LIST_HEAD(&conf->pending_list); 6897 - conf->pending_data = kzalloc(sizeof(struct r5pending_data) * 6898 - PENDING_IO_MAX, GFP_KERNEL); 6897 + conf->pending_data = kcalloc(PENDING_IO_MAX, 6898 + sizeof(struct r5pending_data), 6899 + GFP_KERNEL); 6899 6900 if (!conf->pending_data) 6900 6901 goto abort; 6901 6902 for (i = 0; i < PENDING_IO_MAX; i++) ··· 6945 6944 conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks; 6946 6945 max_disks = max(conf->raid_disks, conf->previous_raid_disks); 6947 6946 6948 - conf->disks = kzalloc(max_disks * sizeof(struct disk_info), 6947 + conf->disks = kcalloc(max_disks, sizeof(struct disk_info), 6949 6948 GFP_KERNEL); 6950 6949 6951 6950 if (!conf->disks)
+2 -2
drivers/media/dvb-frontends/dib7000p.c
··· 2018 2018 }; 2019 2019 int ret = 0; 2020 2020 2021 - tx = kzalloc(2*sizeof(u8), GFP_KERNEL); 2021 + tx = kzalloc(2, GFP_KERNEL); 2022 2022 if (!tx) 2023 2023 return -ENOMEM; 2024 - rx = kzalloc(2*sizeof(u8), GFP_KERNEL); 2024 + rx = kzalloc(2, GFP_KERNEL); 2025 2025 if (!rx) { 2026 2026 ret = -ENOMEM; 2027 2027 goto rx_memory_error;
+2 -2
drivers/media/dvb-frontends/dib8000.c
··· 4271 4271 u8 new_addr = 0; 4272 4272 struct i2c_device client = {.adap = host }; 4273 4273 4274 - client.i2c_write_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL); 4274 + client.i2c_write_buffer = kzalloc(4, GFP_KERNEL); 4275 4275 if (!client.i2c_write_buffer) { 4276 4276 dprintk("%s: not enough memory\n", __func__); 4277 4277 return -ENOMEM; 4278 4278 } 4279 - client.i2c_read_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL); 4279 + client.i2c_read_buffer = kzalloc(4, GFP_KERNEL); 4280 4280 if (!client.i2c_read_buffer) { 4281 4281 dprintk("%s: not enough memory\n", __func__); 4282 4282 ret = -ENOMEM;
+2 -2
drivers/media/dvb-frontends/dib9000.c
··· 2381 2381 u8 new_addr = 0; 2382 2382 struct i2c_device client = {.i2c_adap = i2c }; 2383 2383 2384 - client.i2c_write_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL); 2384 + client.i2c_write_buffer = kzalloc(4, GFP_KERNEL); 2385 2385 if (!client.i2c_write_buffer) { 2386 2386 dprintk("%s: not enough memory\n", __func__); 2387 2387 return -ENOMEM; 2388 2388 } 2389 - client.i2c_read_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL); 2389 + client.i2c_read_buffer = kzalloc(4, GFP_KERNEL); 2390 2390 if (!client.i2c_read_buffer) { 2391 2391 dprintk("%s: not enough memory\n", __func__); 2392 2392 ret = -ENOMEM;
+3 -3
drivers/media/usb/au0828/au0828-video.c
··· 217 217 dev->isoc_ctl.isoc_copy = isoc_copy; 218 218 dev->isoc_ctl.num_bufs = num_bufs; 219 219 220 - dev->isoc_ctl.urb = kzalloc(sizeof(void *)*num_bufs, GFP_KERNEL); 220 + dev->isoc_ctl.urb = kcalloc(num_bufs, sizeof(void *), GFP_KERNEL); 221 221 if (!dev->isoc_ctl.urb) { 222 222 au0828_isocdbg("cannot alloc memory for usb buffers\n"); 223 223 return -ENOMEM; 224 224 } 225 225 226 - dev->isoc_ctl.transfer_buffer = kzalloc(sizeof(void *)*num_bufs, 227 - GFP_KERNEL); 226 + dev->isoc_ctl.transfer_buffer = kcalloc(num_bufs, sizeof(void *), 227 + GFP_KERNEL); 228 228 if (!dev->isoc_ctl.transfer_buffer) { 229 229 au0828_isocdbg("cannot allocate memory for usb transfer\n"); 230 230 kfree(dev->isoc_ctl.urb);
+4 -4
drivers/media/usb/cx231xx/cx231xx-core.c
··· 1034 1034 dma_q->partial_buf[i] = 0; 1035 1035 1036 1036 dev->video_mode.isoc_ctl.urb = 1037 - kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1037 + kcalloc(num_bufs, sizeof(void *), GFP_KERNEL); 1038 1038 if (!dev->video_mode.isoc_ctl.urb) { 1039 1039 dev_err(dev->dev, 1040 1040 "cannot alloc memory for usb buffers\n"); ··· 1042 1042 } 1043 1043 1044 1044 dev->video_mode.isoc_ctl.transfer_buffer = 1045 - kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1045 + kcalloc(num_bufs, sizeof(void *), GFP_KERNEL); 1046 1046 if (!dev->video_mode.isoc_ctl.transfer_buffer) { 1047 1047 dev_err(dev->dev, 1048 1048 "cannot allocate memory for usbtransfer\n"); ··· 1169 1169 dma_q->partial_buf[i] = 0; 1170 1170 1171 1171 dev->video_mode.bulk_ctl.urb = 1172 - kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1172 + kcalloc(num_bufs, sizeof(void *), GFP_KERNEL); 1173 1173 if (!dev->video_mode.bulk_ctl.urb) { 1174 1174 dev_err(dev->dev, 1175 1175 "cannot alloc memory for usb buffers\n"); ··· 1177 1177 } 1178 1178 1179 1179 dev->video_mode.bulk_ctl.transfer_buffer = 1180 - kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1180 + kcalloc(num_bufs, sizeof(void *), GFP_KERNEL); 1181 1181 if (!dev->video_mode.bulk_ctl.transfer_buffer) { 1182 1182 dev_err(dev->dev, 1183 1183 "cannot allocate memory for usbtransfer\n");
+2 -2
drivers/media/usb/cx231xx/cx231xx-vbi.c
··· 415 415 for (i = 0; i < 8; i++) 416 416 dma_q->partial_buf[i] = 0; 417 417 418 - dev->vbi_mode.bulk_ctl.urb = kzalloc(sizeof(void *) * num_bufs, 418 + dev->vbi_mode.bulk_ctl.urb = kcalloc(num_bufs, sizeof(void *), 419 419 GFP_KERNEL); 420 420 if (!dev->vbi_mode.bulk_ctl.urb) { 421 421 dev_err(dev->dev, ··· 424 424 } 425 425 426 426 dev->vbi_mode.bulk_ctl.transfer_buffer = 427 - kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 427 + kcalloc(num_bufs, sizeof(void *), GFP_KERNEL); 428 428 if (!dev->vbi_mode.bulk_ctl.transfer_buffer) { 429 429 dev_err(dev->dev, 430 430 "cannot allocate memory for usbtransfer\n");
+1 -1
drivers/media/usb/go7007/go7007-fw.c
··· 1579 1579 GO7007_FW_NAME); 1580 1580 return -1; 1581 1581 } 1582 - code = kzalloc(codespace * 2, GFP_KERNEL); 1582 + code = kcalloc(codespace, 2, GFP_KERNEL); 1583 1583 if (code == NULL) 1584 1584 goto fw_failed; 1585 1585
+1 -1
drivers/media/usb/pvrusb2/pvrusb2-hdw.c
··· 2413 2413 2414 2414 hdw->control_cnt = CTRLDEF_COUNT; 2415 2415 hdw->control_cnt += MPEGDEF_COUNT; 2416 - hdw->controls = kzalloc(sizeof(struct pvr2_ctrl) * hdw->control_cnt, 2416 + hdw->controls = kcalloc(hdw->control_cnt, sizeof(struct pvr2_ctrl), 2417 2417 GFP_KERNEL); 2418 2418 if (!hdw->controls) goto fail; 2419 2419 hdw->hdw_desc = hdw_desc;
+1 -1
drivers/media/usb/pvrusb2/pvrusb2-std.c
··· 361 361 std_cnt); 362 362 if (!std_cnt) return NULL; // paranoia 363 363 364 - stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt, 364 + stddefs = kcalloc(std_cnt, sizeof(struct v4l2_standard), 365 365 GFP_KERNEL); 366 366 if (!stddefs) 367 367 return NULL;
+3 -3
drivers/media/usb/stk1160/stk1160-video.c
··· 439 439 440 440 dev->isoc_ctl.buf = NULL; 441 441 dev->isoc_ctl.max_pkt_size = dev->max_pkt_size; 442 - dev->isoc_ctl.urb = kzalloc(sizeof(void *)*num_bufs, GFP_KERNEL); 442 + dev->isoc_ctl.urb = kcalloc(num_bufs, sizeof(void *), GFP_KERNEL); 443 443 if (!dev->isoc_ctl.urb) { 444 444 stk1160_err("out of memory for urb array\n"); 445 445 return -ENOMEM; 446 446 } 447 447 448 - dev->isoc_ctl.transfer_buffer = kzalloc(sizeof(void *)*num_bufs, 449 - GFP_KERNEL); 448 + dev->isoc_ctl.transfer_buffer = kcalloc(num_bufs, sizeof(void *), 449 + GFP_KERNEL); 450 450 if (!dev->isoc_ctl.transfer_buffer) { 451 451 stk1160_err("out of memory for usb transfers\n"); 452 452 kfree(dev->isoc_ctl.urb);
+3 -2
drivers/media/usb/stkwebcam/stk-webcam.c
··· 567 567 if (dev->sio_bufs != NULL) 568 568 pr_err("sio_bufs already allocated\n"); 569 569 else { 570 - dev->sio_bufs = kzalloc(n_sbufs * sizeof(struct stk_sio_buffer), 571 - GFP_KERNEL); 570 + dev->sio_bufs = kcalloc(n_sbufs, 571 + sizeof(struct stk_sio_buffer), 572 + GFP_KERNEL); 572 573 if (dev->sio_bufs == NULL) 573 574 return -ENOMEM; 574 575 for (i = 0; i < n_sbufs; i++) {
+1 -1
drivers/media/usb/usbtv/usbtv-video.c
··· 507 507 ip->pipe = usb_rcvisocpipe(usbtv->udev, USBTV_VIDEO_ENDP); 508 508 ip->interval = 1; 509 509 ip->transfer_flags = URB_ISO_ASAP; 510 - ip->transfer_buffer = kzalloc(size * USBTV_ISOC_PACKETS, 510 + ip->transfer_buffer = kcalloc(USBTV_ISOC_PACKETS, size, 511 511 GFP_KERNEL); 512 512 if (!ip->transfer_buffer) { 513 513 usb_free_urb(ip);
+4 -3
drivers/mfd/cros_ec_dev.c
··· 299 299 resp = (struct ec_response_motion_sense *)msg->data; 300 300 sensor_num = resp->dump.sensor_count; 301 301 /* Allocate 1 extra sensors in FIFO are needed */ 302 - sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1), 302 + sensor_cells = kcalloc(sensor_num + 1, sizeof(struct mfd_cell), 303 303 GFP_KERNEL); 304 304 if (sensor_cells == NULL) 305 305 goto error; 306 306 307 - sensor_platforms = kzalloc(sizeof(struct cros_ec_sensor_platform) * 308 - (sensor_num + 1), GFP_KERNEL); 307 + sensor_platforms = kcalloc(sensor_num + 1, 308 + sizeof(struct cros_ec_sensor_platform), 309 + GFP_KERNEL); 309 310 if (sensor_platforms == NULL) 310 311 goto error_platforms; 311 312
+1 -1
drivers/mfd/mfd-core.c
··· 158 158 if (!pdev) 159 159 goto fail_alloc; 160 160 161 - res = kzalloc(sizeof(*res) * cell->num_resources, GFP_KERNEL); 161 + res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL); 162 162 if (!res) 163 163 goto fail_device; 164 164
+2 -2
drivers/mfd/timberdale.c
··· 707 707 goto err_config; 708 708 } 709 709 710 - msix_entries = kzalloc(TIMBERDALE_NR_IRQS * sizeof(*msix_entries), 711 - GFP_KERNEL); 710 + msix_entries = kcalloc(TIMBERDALE_NR_IRQS, sizeof(*msix_entries), 711 + GFP_KERNEL); 712 712 if (!msix_entries) 713 713 goto err_config; 714 714
+3 -3
drivers/misc/altera-stapl/altera.c
··· 304 304 if (sym_count <= 0) 305 305 goto exit_done; 306 306 307 - vars = kzalloc(sym_count * sizeof(long), GFP_KERNEL); 307 + vars = kcalloc(sym_count, sizeof(long), GFP_KERNEL); 308 308 309 309 if (vars == NULL) 310 310 status = -ENOMEM; 311 311 312 312 if (status == 0) { 313 - var_size = kzalloc(sym_count * sizeof(s32), GFP_KERNEL); 313 + var_size = kcalloc(sym_count, sizeof(s32), GFP_KERNEL); 314 314 315 315 if (var_size == NULL) 316 316 status = -ENOMEM; ··· 1136 1136 /* Allocate a writable buffer for this array */ 1137 1137 count = var_size[variable_id]; 1138 1138 long_tmp = vars[variable_id]; 1139 - longptr_tmp = kzalloc(count * sizeof(long), 1139 + longptr_tmp = kcalloc(count, sizeof(long), 1140 1140 GFP_KERNEL); 1141 1141 vars[variable_id] = (long)longptr_tmp; 1142 1142
+1 -1
drivers/misc/cxl/guest.c
··· 89 89 mod = 0; 90 90 } 91 91 92 - vpd_buf = kzalloc(entries * sizeof(unsigned long *), GFP_KERNEL); 92 + vpd_buf = kcalloc(entries, sizeof(unsigned long *), GFP_KERNEL); 93 93 if (!vpd_buf) 94 94 return -ENOMEM; 95 95
+1 -1
drivers/misc/cxl/of.c
··· 302 302 if (nranges == 0 || (nranges * 2 * sizeof(int)) != len) 303 303 return -EINVAL; 304 304 305 - adapter->guest->irq_avail = kzalloc(nranges * sizeof(struct irq_avail), 305 + adapter->guest->irq_avail = kcalloc(nranges, sizeof(struct irq_avail), 306 306 GFP_KERNEL); 307 307 if (adapter->guest->irq_avail == NULL) 308 308 return -ENOMEM;
+5 -4
drivers/misc/genwqe/card_ddcb.c
··· 1048 1048 "[%s] **err: could not allocate DDCB **\n", __func__); 1049 1049 return -ENOMEM; 1050 1050 } 1051 - queue->ddcb_req = kzalloc(sizeof(struct ddcb_requ *) * 1052 - queue->ddcb_max, GFP_KERNEL); 1051 + queue->ddcb_req = kcalloc(queue->ddcb_max, sizeof(struct ddcb_requ *), 1052 + GFP_KERNEL); 1053 1053 if (!queue->ddcb_req) { 1054 1054 rc = -ENOMEM; 1055 1055 goto free_ddcbs; 1056 1056 } 1057 1057 1058 - queue->ddcb_waitqs = kzalloc(sizeof(wait_queue_head_t) * 1059 - queue->ddcb_max, GFP_KERNEL); 1058 + queue->ddcb_waitqs = kcalloc(queue->ddcb_max, 1059 + sizeof(wait_queue_head_t), 1060 + GFP_KERNEL); 1060 1061 if (!queue->ddcb_waitqs) { 1061 1062 rc = -ENOMEM; 1062 1063 goto free_requs;
+5 -3
drivers/misc/sgi-xp/xpc_main.c
··· 416 416 * memory. 417 417 */ 418 418 DBUG_ON(part->channels != NULL); 419 - part->channels = kzalloc(sizeof(struct xpc_channel) * XPC_MAX_NCHANNELS, 419 + part->channels = kcalloc(XPC_MAX_NCHANNELS, 420 + sizeof(struct xpc_channel), 420 421 GFP_KERNEL); 421 422 if (part->channels == NULL) { 422 423 dev_err(xpc_chan, "can't get memory for channels\n"); ··· 906 905 short partid; 907 906 struct xpc_partition *part; 908 907 909 - xpc_partitions = kzalloc(sizeof(struct xpc_partition) * 910 - xp_max_npartitions, GFP_KERNEL); 908 + xpc_partitions = kcalloc(xp_max_npartitions, 909 + sizeof(struct xpc_partition), 910 + GFP_KERNEL); 911 911 if (xpc_partitions == NULL) { 912 912 dev_err(xpc_part, "can't get memory for partition structure\n"); 913 913 return -ENOMEM;
+1 -1
drivers/misc/sgi-xp/xpc_partition.c
··· 425 425 if (remote_rp == NULL) 426 426 return; 427 427 428 - discovered_nasids = kzalloc(sizeof(long) * xpc_nasid_mask_nlongs, 428 + discovered_nasids = kcalloc(xpc_nasid_mask_nlongs, sizeof(long), 429 429 GFP_KERNEL); 430 430 if (discovered_nasids == NULL) { 431 431 kfree(remote_rp_base);
+3 -2
drivers/misc/sgi-xp/xpnet.c
··· 520 520 521 521 dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME); 522 522 523 - xpnet_broadcast_partitions = kzalloc(BITS_TO_LONGS(xp_max_npartitions) * 524 - sizeof(long), GFP_KERNEL); 523 + xpnet_broadcast_partitions = kcalloc(BITS_TO_LONGS(xp_max_npartitions), 524 + sizeof(long), 525 + GFP_KERNEL); 525 526 if (xpnet_broadcast_partitions == NULL) 526 527 return -ENOMEM; 527 528
+1 -1
drivers/misc/sram.c
··· 185 185 * after the reserved blocks from the dt are processed. 186 186 */ 187 187 nblocks = (np) ? of_get_available_child_count(np) + 1 : 1; 188 - rblocks = kzalloc((nblocks) * sizeof(*rblocks), GFP_KERNEL); 188 + rblocks = kcalloc(nblocks, sizeof(*rblocks), GFP_KERNEL); 189 189 if (!rblocks) 190 190 return -ENOMEM; 191 191
+1 -1
drivers/mtd/ar7part.c
··· 55 55 int retries = 10; 56 56 struct mtd_partition *ar7_parts; 57 57 58 - ar7_parts = kzalloc(sizeof(*ar7_parts) * AR7_PARTS, GFP_KERNEL); 58 + ar7_parts = kcalloc(AR7_PARTS, sizeof(*ar7_parts), GFP_KERNEL); 59 59 if (!ar7_parts) 60 60 return -ENOMEM; 61 61 ar7_parts[0].name = "loader";
+1 -1
drivers/mtd/bcm47xxpart.c
··· 110 110 blocksize = 0x1000; 111 111 112 112 /* Alloc */ 113 - parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, 113 + parts = kcalloc(BCM47XXPART_MAX_PARTS, sizeof(struct mtd_partition), 114 114 GFP_KERNEL); 115 115 if (!parts) 116 116 return -ENOMEM;
+3 -2
drivers/mtd/chips/cfi_cmdset_0001.c
··· 608 608 mtd->size = devsize * cfi->numchips; 609 609 610 610 mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips; 611 - mtd->eraseregions = kzalloc(sizeof(struct mtd_erase_region_info) 612 - * mtd->numeraseregions, GFP_KERNEL); 611 + mtd->eraseregions = kcalloc(mtd->numeraseregions, 612 + sizeof(struct mtd_erase_region_info), 613 + GFP_KERNEL); 613 614 if (!mtd->eraseregions) 614 615 goto setup_err; 615 616
+1 -1
drivers/mtd/chips/cfi_cmdset_0002.c
··· 2636 2636 * first check the locking status of all sectors and save 2637 2637 * it for future use. 2638 2638 */ 2639 - sect = kzalloc(MAX_SECTORS * sizeof(struct ppb_lock), GFP_KERNEL); 2639 + sect = kcalloc(MAX_SECTORS, sizeof(struct ppb_lock), GFP_KERNEL); 2640 2640 if (!sect) 2641 2641 return -ENOMEM; 2642 2642
+1 -1
drivers/mtd/devices/docg3.c
··· 1827 1827 mtd->dev.parent = dev; 1828 1828 bbt_nbpages = DIV_ROUND_UP(docg3->max_block + 1, 1829 1829 8 * DOC_LAYOUT_PAGE_SIZE); 1830 - docg3->bbt = kzalloc(bbt_nbpages * DOC_LAYOUT_PAGE_SIZE, GFP_KERNEL); 1830 + docg3->bbt = kcalloc(DOC_LAYOUT_PAGE_SIZE, bbt_nbpages, GFP_KERNEL); 1831 1831 if (!docg3->bbt) 1832 1832 goto nomem3; 1833 1833
+2 -2
drivers/mtd/maps/physmap_of_core.c
··· 124 124 if (count < 0) 125 125 return part_probe_types_def; 126 126 127 - res = kzalloc((count + 1) * sizeof(*res), GFP_KERNEL); 127 + res = kcalloc(count + 1, sizeof(*res), GFP_KERNEL); 128 128 if (!res) 129 129 return NULL; 130 130 ··· 197 197 198 198 dev_set_drvdata(&dev->dev, info); 199 199 200 - mtd_list = kzalloc(sizeof(*mtd_list) * count, GFP_KERNEL); 200 + mtd_list = kcalloc(count, sizeof(*mtd_list), GFP_KERNEL); 201 201 if (!mtd_list) 202 202 goto err_flash_remove; 203 203
+4 -2
drivers/mtd/nand/onenand/onenand_base.c
··· 3721 3721 this->dies = ONENAND_IS_DDP(this) ? 2 : 1; 3722 3722 /* Maximum possible erase regions */ 3723 3723 mtd->numeraseregions = this->dies << 1; 3724 - mtd->eraseregions = kzalloc(sizeof(struct mtd_erase_region_info) 3725 - * (this->dies << 1), GFP_KERNEL); 3724 + mtd->eraseregions = 3725 + kcalloc(this->dies << 1, 3726 + sizeof(struct mtd_erase_region_info), 3727 + GFP_KERNEL); 3726 3728 if (!mtd->eraseregions) 3727 3729 return -ENOMEM; 3728 3730 }
+2 -2
drivers/mtd/ofpart.c
··· 71 71 if (nr_parts == 0) 72 72 return 0; 73 73 74 - parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL); 74 + parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); 75 75 if (!parts) 76 76 return -ENOMEM; 77 77 ··· 177 177 178 178 nr_parts = plen / sizeof(part[0]); 179 179 180 - parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL); 180 + parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); 181 181 if (!parts) 182 182 return -ENOMEM; 183 183
+1 -1
drivers/mtd/parsers/parser_trx.c
··· 62 62 uint8_t curr_part = 0, i = 0; 63 63 int err; 64 64 65 - parts = kzalloc(sizeof(struct mtd_partition) * TRX_PARSER_MAX_PARTS, 65 + parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition), 66 66 GFP_KERNEL); 67 67 if (!parts) 68 68 return -ENOMEM;
+3 -2
drivers/mtd/parsers/sharpslpart.c
··· 362 362 return err; 363 363 } 364 364 365 - sharpsl_nand_parts = kzalloc(sizeof(*sharpsl_nand_parts) * 366 - SHARPSL_NAND_PARTS, GFP_KERNEL); 365 + sharpsl_nand_parts = kcalloc(SHARPSL_NAND_PARTS, 366 + sizeof(*sharpsl_nand_parts), 367 + GFP_KERNEL); 367 368 if (!sharpsl_nand_parts) 368 369 return -ENOMEM; 369 370
+2 -2
drivers/mtd/sm_ftl.c
··· 82 82 83 83 84 84 /* Create array of pointers to the attributes */ 85 - attributes = kzalloc(sizeof(struct attribute *) * (NUM_ATTRIBUTES + 1), 85 + attributes = kcalloc(NUM_ATTRIBUTES + 1, sizeof(struct attribute *), 86 86 GFP_KERNEL); 87 87 if (!attributes) 88 88 goto error3; ··· 1137 1137 goto error2; 1138 1138 1139 1139 /* Allocate zone array, it will be initialized on demand */ 1140 - ftl->zones = kzalloc(sizeof(struct ftl_zone) * ftl->zone_count, 1140 + ftl->zones = kcalloc(ftl->zone_count, sizeof(struct ftl_zone), 1141 1141 GFP_KERNEL); 1142 1142 if (!ftl->zones) 1143 1143 goto error3;
+1 -1
drivers/mtd/tests/pagetest.c
··· 127 127 unsigned char *pp1, *pp2, *pp3, *pp4; 128 128 129 129 pr_info("crosstest\n"); 130 - pp1 = kzalloc(pgsize * 4, GFP_KERNEL); 130 + pp1 = kcalloc(pgsize, 4, GFP_KERNEL); 131 131 if (!pp1) 132 132 return -ENOMEM; 133 133 pp2 = pp1 + pgsize;
+1 -1
drivers/mtd/ubi/wl.c
··· 1592 1592 sprintf(ubi->bgt_name, UBI_BGT_NAME_PATTERN, ubi->ubi_num); 1593 1593 1594 1594 err = -ENOMEM; 1595 - ubi->lookuptbl = kzalloc(ubi->peb_count * sizeof(void *), GFP_KERNEL); 1595 + ubi->lookuptbl = kcalloc(ubi->peb_count, sizeof(void *), GFP_KERNEL); 1596 1596 if (!ubi->lookuptbl) 1597 1597 return err; 1598 1598
+1 -1
drivers/net/bonding/bond_main.c
··· 2418 2418 struct list_head *iter; 2419 2419 2420 2420 if (start_dev == end_dev) { 2421 - tags = kzalloc(sizeof(*tags) * (level + 1), GFP_ATOMIC); 2421 + tags = kcalloc(level + 1, sizeof(*tags), GFP_ATOMIC); 2422 2422 if (!tags) 2423 2423 return ERR_PTR(-ENOMEM); 2424 2424 tags[level].vlan_proto = VLAN_N_VID;
+2 -2
drivers/net/can/grcan.c
··· 1057 1057 return err; 1058 1058 } 1059 1059 1060 - priv->echo_skb = kzalloc(dma->tx.size * sizeof(*priv->echo_skb), 1060 + priv->echo_skb = kcalloc(dma->tx.size, sizeof(*priv->echo_skb), 1061 1061 GFP_KERNEL); 1062 1062 if (!priv->echo_skb) { 1063 1063 err = -ENOMEM; ··· 1066 1066 priv->can.echo_skb_max = dma->tx.size; 1067 1067 priv->can.echo_skb = priv->echo_skb; 1068 1068 1069 - priv->txdlc = kzalloc(dma->tx.size * sizeof(*priv->txdlc), GFP_KERNEL); 1069 + priv->txdlc = kcalloc(dma->tx.size, sizeof(*priv->txdlc), GFP_KERNEL); 1070 1070 if (!priv->txdlc) { 1071 1071 err = -ENOMEM; 1072 1072 goto exit_free_echo_skb;
+1 -1
drivers/net/can/slcan.c
··· 703 703 pr_info("slcan: serial line CAN interface driver\n"); 704 704 pr_info("slcan: %d dynamic interface channels.\n", maxdev); 705 705 706 - slcan_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL); 706 + slcan_devs = kcalloc(maxdev, sizeof(struct net_device *), GFP_KERNEL); 707 707 if (!slcan_devs) 708 708 return -ENOMEM; 709 709
+2 -2
drivers/net/ethernet/broadcom/bcm63xx_enet.c
··· 2150 2150 priv->tx_desc_alloc_size = size; 2151 2151 priv->tx_desc_cpu = p; 2152 2152 2153 - priv->tx_skb = kzalloc(sizeof(struct sk_buff *) * priv->tx_ring_size, 2153 + priv->tx_skb = kcalloc(priv->tx_ring_size, sizeof(struct sk_buff *), 2154 2154 GFP_KERNEL); 2155 2155 if (!priv->tx_skb) { 2156 2156 dev_err(kdev, "cannot allocate rx skb queue\n"); ··· 2164 2164 spin_lock_init(&priv->tx_lock); 2165 2165 2166 2166 /* init & fill rx ring with skbs */ 2167 - priv->rx_skb = kzalloc(sizeof(struct sk_buff *) * priv->rx_ring_size, 2167 + priv->rx_skb = kcalloc(priv->rx_ring_size, sizeof(struct sk_buff *), 2168 2168 GFP_KERNEL); 2169 2169 if (!priv->rx_skb) { 2170 2170 dev_err(kdev, "cannot allocate rx skb queue\n");
+7 -6
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
··· 571 571 else 572 572 set_bit(RAMROD_COMP_WAIT, &mcast.ramrod_flags); 573 573 if (mc_num) { 574 - mc = kzalloc(mc_num * sizeof(struct bnx2x_mcast_list_elem), 574 + mc = kcalloc(mc_num, sizeof(struct bnx2x_mcast_list_elem), 575 575 GFP_KERNEL); 576 576 if (!mc) { 577 577 BNX2X_ERR("Cannot Configure multicasts due to lack of memory\n"); ··· 1253 1253 num_vfs_param, iov->nr_virtfn); 1254 1254 1255 1255 /* allocate the vf array */ 1256 - bp->vfdb->vfs = kzalloc(sizeof(struct bnx2x_virtf) * 1257 - BNX2X_NR_VIRTFN(bp), GFP_KERNEL); 1256 + bp->vfdb->vfs = kcalloc(BNX2X_NR_VIRTFN(bp), 1257 + sizeof(struct bnx2x_virtf), 1258 + GFP_KERNEL); 1258 1259 if (!bp->vfdb->vfs) { 1259 1260 BNX2X_ERR("failed to allocate vf array\n"); 1260 1261 err = -ENOMEM; ··· 1279 1278 } 1280 1279 1281 1280 /* allocate the queue arrays for all VFs */ 1282 - bp->vfdb->vfqs = kzalloc( 1283 - BNX2X_MAX_NUM_VF_QUEUES * sizeof(struct bnx2x_vf_queue), 1284 - GFP_KERNEL); 1281 + bp->vfdb->vfqs = kcalloc(BNX2X_MAX_NUM_VF_QUEUES, 1282 + sizeof(struct bnx2x_vf_queue), 1283 + GFP_KERNEL); 1285 1284 1286 1285 if (!bp->vfdb->vfqs) { 1287 1286 BNX2X_ERR("failed to allocate vf queue array\n");
+5 -5
drivers/net/ethernet/broadcom/cnic.c
··· 660 660 id_tbl->max = size; 661 661 id_tbl->next = next; 662 662 spin_lock_init(&id_tbl->lock); 663 - id_tbl->table = kzalloc(DIV_ROUND_UP(size, 32) * 4, GFP_KERNEL); 663 + id_tbl->table = kcalloc(DIV_ROUND_UP(size, 32), 4, GFP_KERNEL); 664 664 if (!id_tbl->table) 665 665 return -ENOMEM; 666 666 ··· 1255 1255 cp->fcoe_init_cid = 0x10; 1256 1256 } 1257 1257 1258 - cp->iscsi_tbl = kzalloc(sizeof(struct cnic_iscsi) * MAX_ISCSI_TBL_SZ, 1258 + cp->iscsi_tbl = kcalloc(MAX_ISCSI_TBL_SZ, sizeof(struct cnic_iscsi), 1259 1259 GFP_KERNEL); 1260 1260 if (!cp->iscsi_tbl) 1261 1261 goto error; 1262 1262 1263 - cp->ctx_tbl = kzalloc(sizeof(struct cnic_context) * 1264 - cp->max_cid_space, GFP_KERNEL); 1263 + cp->ctx_tbl = kcalloc(cp->max_cid_space, sizeof(struct cnic_context), 1264 + GFP_KERNEL); 1265 1265 if (!cp->ctx_tbl) 1266 1266 goto error; 1267 1267 ··· 4100 4100 struct cnic_local *cp = dev->cnic_priv; 4101 4101 u32 port_id; 4102 4102 4103 - cp->csk_tbl = kzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ, 4103 + cp->csk_tbl = kcalloc(MAX_CM_SK_TBL_SZ, sizeof(struct cnic_sock), 4104 4104 GFP_KERNEL); 4105 4105 if (!cp->csk_tbl) 4106 4106 return -ENOMEM;
+3 -2
drivers/net/ethernet/broadcom/tg3.c
··· 8631 8631 tnapi++; 8632 8632 8633 8633 for (i = 0; i < tp->txq_cnt; i++, tnapi++) { 8634 - tnapi->tx_buffers = kzalloc(sizeof(struct tg3_tx_ring_info) * 8635 - TG3_TX_RING_SIZE, GFP_KERNEL); 8634 + tnapi->tx_buffers = kcalloc(TG3_TX_RING_SIZE, 8635 + sizeof(struct tg3_tx_ring_info), 8636 + GFP_KERNEL); 8636 8637 if (!tnapi->tx_buffers) 8637 8638 goto err_out; 8638 8639
+2 -2
drivers/net/ethernet/brocade/bna/bnad.c
··· 3141 3141 if (uc_count > bna_attr(&bnad->bna)->num_ucmac) 3142 3142 goto mode_default; 3143 3143 3144 - mac_list = kzalloc(uc_count * ETH_ALEN, GFP_ATOMIC); 3144 + mac_list = kcalloc(ETH_ALEN, uc_count, GFP_ATOMIC); 3145 3145 if (mac_list == NULL) 3146 3146 goto mode_default; 3147 3147 ··· 3182 3182 if (mc_count > bna_attr(&bnad->bna)->num_mcmac) 3183 3183 goto mode_allmulti; 3184 3184 3185 - mac_list = kzalloc((mc_count + 1) * ETH_ALEN, GFP_ATOMIC); 3185 + mac_list = kcalloc(mc_count + 1, ETH_ALEN, GFP_ATOMIC); 3186 3186 3187 3187 if (mac_list == NULL) 3188 3188 goto mode_allmulti;
+2 -2
drivers/net/ethernet/calxeda/xgmac.c
··· 739 739 740 740 netdev_dbg(priv->dev, "mtu [%d] bfsize [%d]\n", dev->mtu, bfsize); 741 741 742 - priv->rx_skbuff = kzalloc(sizeof(struct sk_buff *) * DMA_RX_RING_SZ, 742 + priv->rx_skbuff = kcalloc(DMA_RX_RING_SZ, sizeof(struct sk_buff *), 743 743 GFP_KERNEL); 744 744 if (!priv->rx_skbuff) 745 745 return -ENOMEM; ··· 752 752 if (!priv->dma_rx) 753 753 goto err_dma_rx; 754 754 755 - priv->tx_skbuff = kzalloc(sizeof(struct sk_buff *) * DMA_TX_RING_SZ, 755 + priv->tx_skbuff = kcalloc(DMA_TX_RING_SZ, sizeof(struct sk_buff *), 756 756 GFP_KERNEL); 757 757 if (!priv->tx_skbuff) 758 758 goto err_tx_skb;
+2 -2
drivers/net/ethernet/cavium/thunder/nicvf_queues.c
··· 292 292 rbdr->is_xdp = true; 293 293 } 294 294 rbdr->pgcnt = roundup_pow_of_two(rbdr->pgcnt); 295 - rbdr->pgcache = kzalloc(sizeof(*rbdr->pgcache) * 296 - rbdr->pgcnt, GFP_KERNEL); 295 + rbdr->pgcache = kcalloc(rbdr->pgcnt, sizeof(*rbdr->pgcache), 296 + GFP_KERNEL); 297 297 if (!rbdr->pgcache) 298 298 return -ENOMEM; 299 299 rbdr->pgidx = 0;
+2 -2
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
··· 561 561 if (!adap->uld) 562 562 return -ENOMEM; 563 563 564 - s->uld_rxq_info = kzalloc(CXGB4_ULD_MAX * 564 + s->uld_rxq_info = kcalloc(CXGB4_ULD_MAX, 565 565 sizeof(struct sge_uld_rxq_info *), 566 566 GFP_KERNEL); 567 567 if (!s->uld_rxq_info) 568 568 goto err_uld; 569 569 570 - s->uld_txq_info = kzalloc(CXGB4_TX_MAX * 570 + s->uld_txq_info = kcalloc(CXGB4_TX_MAX, 571 571 sizeof(struct sge_uld_txq_info *), 572 572 GFP_KERNEL); 573 573 if (!s->uld_txq_info)
+2 -2
drivers/net/ethernet/cortina/gemini.c
··· 910 910 } 911 911 912 912 /* Allocate a mapping to page look-up index */ 913 - geth->freeq_pages = kzalloc(pages * sizeof(*geth->freeq_pages), 914 - GFP_KERNEL); 913 + geth->freeq_pages = kcalloc(pages, sizeof(*geth->freeq_pages), 914 + GFP_KERNEL); 915 915 if (!geth->freeq_pages) 916 916 goto err_freeq; 917 917 geth->num_freeq_pages = pages;
+2 -1
drivers/net/ethernet/hisilicon/hns/hns_enet.c
··· 2197 2197 return -EINVAL; 2198 2198 } 2199 2199 2200 - priv->ring_data = kzalloc(h->q_num * sizeof(*priv->ring_data) * 2, 2200 + priv->ring_data = kzalloc(array3_size(h->q_num, 2201 + sizeof(*priv->ring_data), 2), 2201 2202 GFP_KERNEL); 2202 2203 if (!priv->ring_data) 2203 2204 return -ENOMEM;
+1 -1
drivers/net/ethernet/intel/e1000e/netdev.c
··· 3312 3312 return 0; 3313 3313 } 3314 3314 3315 - mta_list = kzalloc(netdev_mc_count(netdev) * ETH_ALEN, GFP_ATOMIC); 3315 + mta_list = kcalloc(netdev_mc_count(netdev), ETH_ALEN, GFP_ATOMIC); 3316 3316 if (!mta_list) 3317 3317 return -ENOMEM; 3318 3318
+4 -3
drivers/net/ethernet/intel/igb/igb_main.c
··· 3763 3763 /* Assume MSI-X interrupts, will be checked during IRQ allocation */ 3764 3764 adapter->flags |= IGB_FLAG_HAS_MSIX; 3765 3765 3766 - adapter->mac_table = kzalloc(sizeof(struct igb_mac_addr) * 3767 - hw->mac.rar_entry_count, GFP_ATOMIC); 3766 + adapter->mac_table = kcalloc(hw->mac.rar_entry_count, 3767 + sizeof(struct igb_mac_addr), 3768 + GFP_ATOMIC); 3768 3769 if (!adapter->mac_table) 3769 3770 return -ENOMEM; 3770 3771 ··· 4753 4752 return 0; 4754 4753 } 4755 4754 4756 - mta_list = kzalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); 4755 + mta_list = kcalloc(netdev_mc_count(netdev), 6, GFP_ATOMIC); 4757 4756 if (!mta_list) 4758 4757 return -ENOMEM; 4759 4758
+2 -2
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 6034 6034 for (i = 1; i < IXGBE_MAX_LINK_HANDLE; i++) 6035 6035 adapter->jump_tables[i] = NULL; 6036 6036 6037 - adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) * 6038 - hw->mac.num_rar_entries, 6037 + adapter->mac_table = kcalloc(hw->mac.num_rar_entries, 6038 + sizeof(struct ixgbe_mac_addr), 6039 6039 GFP_ATOMIC); 6040 6040 if (!adapter->mac_table) 6041 6041 return -ENOMEM;
+6 -4
drivers/net/ethernet/jme.c
··· 589 589 atomic_set(&txring->next_to_clean, 0); 590 590 atomic_set(&txring->nr_free, jme->tx_ring_size); 591 591 592 - txring->bufinf = kzalloc(sizeof(struct jme_buffer_info) * 593 - jme->tx_ring_size, GFP_ATOMIC); 592 + txring->bufinf = kcalloc(jme->tx_ring_size, 593 + sizeof(struct jme_buffer_info), 594 + GFP_ATOMIC); 594 595 if (unlikely(!(txring->bufinf))) 595 596 goto err_free_txring; 596 597 ··· 839 838 rxring->next_to_use = 0; 840 839 atomic_set(&rxring->next_to_clean, 0); 841 840 842 - rxring->bufinf = kzalloc(sizeof(struct jme_buffer_info) * 843 - jme->rx_ring_size, GFP_ATOMIC); 841 + rxring->bufinf = kcalloc(jme->rx_ring_size, 842 + sizeof(struct jme_buffer_info), 843 + GFP_ATOMIC); 844 844 if (unlikely(!(rxring->bufinf))) 845 845 goto err_free_rxring; 846 846
+2 -2
drivers/net/ethernet/mellanox/mlx4/alloc.c
··· 185 185 bitmap->avail = num - reserved_top - reserved_bot; 186 186 bitmap->effective_len = bitmap->avail; 187 187 spin_lock_init(&bitmap->lock); 188 - bitmap->table = kzalloc(BITS_TO_LONGS(bitmap->max) * 189 - sizeof(long), GFP_KERNEL); 188 + bitmap->table = kcalloc(BITS_TO_LONGS(bitmap->max), sizeof(long), 189 + GFP_KERNEL); 190 190 if (!bitmap->table) 191 191 return -ENOMEM; 192 192
+9 -6
drivers/net/ethernet/mellanox/mlx4/cmd.c
··· 2377 2377 struct mlx4_vf_admin_state *vf_admin; 2378 2378 2379 2379 priv->mfunc.master.slave_state = 2380 - kzalloc(dev->num_slaves * 2381 - sizeof(struct mlx4_slave_state), GFP_KERNEL); 2380 + kcalloc(dev->num_slaves, 2381 + sizeof(struct mlx4_slave_state), 2382 + GFP_KERNEL); 2382 2383 if (!priv->mfunc.master.slave_state) 2383 2384 goto err_comm; 2384 2385 2385 2386 priv->mfunc.master.vf_admin = 2386 - kzalloc(dev->num_slaves * 2387 - sizeof(struct mlx4_vf_admin_state), GFP_KERNEL); 2387 + kcalloc(dev->num_slaves, 2388 + sizeof(struct mlx4_vf_admin_state), 2389 + GFP_KERNEL); 2388 2390 if (!priv->mfunc.master.vf_admin) 2389 2391 goto err_comm_admin; 2390 2392 2391 2393 priv->mfunc.master.vf_oper = 2392 - kzalloc(dev->num_slaves * 2393 - sizeof(struct mlx4_vf_oper_state), GFP_KERNEL); 2394 + kcalloc(dev->num_slaves, 2395 + sizeof(struct mlx4_vf_oper_state), 2396 + GFP_KERNEL); 2394 2397 if (!priv->mfunc.master.vf_oper) 2395 2398 goto err_comm_oper; 2396 2399
+12 -8
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
··· 2229 2229 if (!dst->tx_ring_num[t]) 2230 2230 continue; 2231 2231 2232 - dst->tx_ring[t] = kzalloc(sizeof(struct mlx4_en_tx_ring *) * 2233 - MAX_TX_RINGS, GFP_KERNEL); 2232 + dst->tx_ring[t] = kcalloc(MAX_TX_RINGS, 2233 + sizeof(struct mlx4_en_tx_ring *), 2234 + GFP_KERNEL); 2234 2235 if (!dst->tx_ring[t]) 2235 2236 goto err_free_tx; 2236 2237 2237 - dst->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) * 2238 - MAX_TX_RINGS, GFP_KERNEL); 2238 + dst->tx_cq[t] = kcalloc(MAX_TX_RINGS, 2239 + sizeof(struct mlx4_en_cq *), 2240 + GFP_KERNEL); 2239 2241 if (!dst->tx_cq[t]) { 2240 2242 kfree(dst->tx_ring[t]); 2241 2243 goto err_free_tx; ··· 3322 3320 if (!priv->tx_ring_num[t]) 3323 3321 continue; 3324 3322 3325 - priv->tx_ring[t] = kzalloc(sizeof(struct mlx4_en_tx_ring *) * 3326 - MAX_TX_RINGS, GFP_KERNEL); 3323 + priv->tx_ring[t] = kcalloc(MAX_TX_RINGS, 3324 + sizeof(struct mlx4_en_tx_ring *), 3325 + GFP_KERNEL); 3327 3326 if (!priv->tx_ring[t]) { 3328 3327 err = -ENOMEM; 3329 3328 goto out; 3330 3329 } 3331 - priv->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) * 3332 - MAX_TX_RINGS, GFP_KERNEL); 3330 + priv->tx_cq[t] = kcalloc(MAX_TX_RINGS, 3331 + sizeof(struct mlx4_en_cq *), 3332 + GFP_KERNEL); 3333 3333 if (!priv->tx_cq[t]) { 3334 3334 err = -ENOMEM; 3335 3335 goto out;
+3 -2
drivers/net/ethernet/mellanox/mlx4/main.c
··· 2982 2982 int num_entries = dev->caps.num_ports; 2983 2983 int i, j; 2984 2984 2985 - priv->steer = kzalloc(sizeof(struct mlx4_steer) * num_entries, GFP_KERNEL); 2985 + priv->steer = kcalloc(num_entries, sizeof(struct mlx4_steer), 2986 + GFP_KERNEL); 2986 2987 if (!priv->steer) 2987 2988 return -ENOMEM; 2988 2989 ··· 3104 3103 } 3105 3104 } 3106 3105 3107 - dev->dev_vfs = kzalloc(total_vfs * sizeof(*dev->dev_vfs), GFP_KERNEL); 3106 + dev->dev_vfs = kcalloc(total_vfs, sizeof(*dev->dev_vfs), GFP_KERNEL); 3108 3107 if (NULL == dev->dev_vfs) { 3109 3108 mlx4_err(dev, "Failed to allocate memory for VFs\n"); 3110 3109 goto disable_sriov;
+8 -8
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
··· 487 487 int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev); 488 488 489 489 priv->mfunc.master.res_tracker.slave_list = 490 - kzalloc(dev->num_slaves * sizeof(struct slave_list), 490 + kcalloc(dev->num_slaves, sizeof(struct slave_list), 491 491 GFP_KERNEL); 492 492 if (!priv->mfunc.master.res_tracker.slave_list) 493 493 return -ENOMEM; ··· 514 514 sizeof(int), 515 515 GFP_KERNEL); 516 516 if (i == RES_MAC || i == RES_VLAN) 517 - res_alloc->allocated = kzalloc(MLX4_MAX_PORTS * 518 - (dev->persist->num_vfs 519 - + 1) * 520 - sizeof(int), GFP_KERNEL); 517 + res_alloc->allocated = 518 + kcalloc(MLX4_MAX_PORTS * 519 + (dev->persist->num_vfs + 1), 520 + sizeof(int), GFP_KERNEL); 521 521 else 522 - res_alloc->allocated = kzalloc((dev->persist-> 523 - num_vfs + 1) * 524 - sizeof(int), GFP_KERNEL); 522 + res_alloc->allocated = 523 + kcalloc(dev->persist->num_vfs + 1, 524 + sizeof(int), GFP_KERNEL); 525 525 /* Reduce the sink counter */ 526 526 if (i == RES_COUNTER) 527 527 res_alloc->res_free = dev->caps.max_counters - 1;
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
··· 381 381 382 382 count = mlx5_fpga_ipsec_counters_count(mdev); 383 383 384 - data = kzalloc(sizeof(*data) * count * 2, GFP_KERNEL); 384 + data = kzalloc(array3_size(sizeof(*data), count, 2), GFP_KERNEL); 385 385 if (!data) { 386 386 ret = -ENOMEM; 387 387 goto out;
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
··· 394 394 int i; 395 395 396 396 clock->ptp_info.pin_config = 397 - kzalloc(sizeof(*clock->ptp_info.pin_config) * 398 - clock->ptp_info.n_pins, GFP_KERNEL); 397 + kcalloc(clock->ptp_info.n_pins, 398 + sizeof(*clock->ptp_info.pin_config), 399 + GFP_KERNEL); 399 400 if (!clock->ptp_info.pin_config) 400 401 return -ENOMEM; 401 402 clock->ptp_info.enable = mlx5_ptp_enable;
+2 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
··· 740 740 mlxsw_sp_port->root_qdisc->prio_bitmap = 0xff; 741 741 mlxsw_sp_port->root_qdisc->tclass_num = MLXSW_SP_PORT_DEFAULT_TCLASS; 742 742 743 - mlxsw_sp_qdisc = kzalloc(sizeof(*mlxsw_sp_qdisc) * IEEE_8021QAZ_MAX_TCS, 743 + mlxsw_sp_qdisc = kcalloc(IEEE_8021QAZ_MAX_TCS, 744 + sizeof(*mlxsw_sp_qdisc), 744 745 GFP_KERNEL); 745 746 if (!mlxsw_sp_qdisc) 746 747 goto err_tclass_qdiscs_init;
+1 -1
drivers/net/ethernet/micrel/ksz884x.c
··· 4372 4372 */ 4373 4373 static int ksz_alloc_soft_desc(struct ksz_desc_info *desc_info, int transmit) 4374 4374 { 4375 - desc_info->ring = kzalloc(sizeof(struct ksz_desc) * desc_info->alloc, 4375 + desc_info->ring = kcalloc(desc_info->alloc, sizeof(struct ksz_desc), 4376 4376 GFP_KERNEL); 4377 4377 if (!desc_info->ring) 4378 4378 return 1;
+4 -4
drivers/net/ethernet/neterion/vxge/vxge-config.c
··· 2220 2220 channel->length = length; 2221 2221 channel->vp_id = vp_id; 2222 2222 2223 - channel->work_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL); 2223 + channel->work_arr = kcalloc(length, sizeof(void *), GFP_KERNEL); 2224 2224 if (channel->work_arr == NULL) 2225 2225 goto exit1; 2226 2226 2227 - channel->free_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL); 2227 + channel->free_arr = kcalloc(length, sizeof(void *), GFP_KERNEL); 2228 2228 if (channel->free_arr == NULL) 2229 2229 goto exit1; 2230 2230 channel->free_ptr = length; 2231 2231 2232 - channel->reserve_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL); 2232 + channel->reserve_arr = kcalloc(length, sizeof(void *), GFP_KERNEL); 2233 2233 if (channel->reserve_arr == NULL) 2234 2234 goto exit1; 2235 2235 channel->reserve_ptr = length; 2236 2236 channel->reserve_top = 0; 2237 2237 2238 - channel->orig_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL); 2238 + channel->orig_arr = kcalloc(length, sizeof(void *), GFP_KERNEL); 2239 2239 if (channel->orig_arr == NULL) 2240 2240 goto exit1; 2241 2241
+2 -2
drivers/net/ethernet/neterion/vxge/vxge-main.c
··· 3429 3429 vxge_initialize_ethtool_ops(ndev); 3430 3430 3431 3431 /* Allocate memory for vpath */ 3432 - vdev->vpaths = kzalloc((sizeof(struct vxge_vpath)) * 3433 - no_of_vpath, GFP_KERNEL); 3432 + vdev->vpaths = kcalloc(no_of_vpath, sizeof(struct vxge_vpath), 3433 + GFP_KERNEL); 3434 3434 if (!vdev->vpaths) { 3435 3435 vxge_debug_init(VXGE_ERR, 3436 3436 "%s: vpath memory allocation failed",
+6 -4
drivers/net/ethernet/pasemi/pasemi_mac.c
··· 390 390 spin_lock_init(&ring->lock); 391 391 392 392 ring->size = RX_RING_SIZE; 393 - ring->ring_info = kzalloc(sizeof(struct pasemi_mac_buffer) * 394 - RX_RING_SIZE, GFP_KERNEL); 393 + ring->ring_info = kcalloc(RX_RING_SIZE, 394 + sizeof(struct pasemi_mac_buffer), 395 + GFP_KERNEL); 395 396 396 397 if (!ring->ring_info) 397 398 goto out_ring_info; ··· 474 473 spin_lock_init(&ring->lock); 475 474 476 475 ring->size = TX_RING_SIZE; 477 - ring->ring_info = kzalloc(sizeof(struct pasemi_mac_buffer) * 478 - TX_RING_SIZE, GFP_KERNEL); 476 + ring->ring_info = kcalloc(TX_RING_SIZE, 477 + sizeof(struct pasemi_mac_buffer), 478 + GFP_KERNEL); 479 479 if (!ring->ring_info) 480 480 goto out_ring_info; 481 481
+3 -2
drivers/net/ethernet/qlogic/qed/qed_debug.c
··· 6617 6617 6618 6618 /* Read no. of modules and allocate memory for their pointers */ 6619 6619 meta->modules_num = qed_read_byte_from_buf(meta_buf_bytes, &offset); 6620 - meta->modules = kzalloc(meta->modules_num * sizeof(char *), GFP_KERNEL); 6620 + meta->modules = kcalloc(meta->modules_num, sizeof(char *), 6621 + GFP_KERNEL); 6621 6622 if (!meta->modules) 6622 6623 return DBG_STATUS_VIRT_MEM_ALLOC_FAILED; 6623 6624 ··· 6646 6645 6647 6646 /* Read number of formats and allocate memory for all formats */ 6648 6647 meta->formats_num = qed_read_dword_from_buf(meta_buf_bytes, &offset); 6649 - meta->formats = kzalloc(meta->formats_num * 6648 + meta->formats = kcalloc(meta->formats_num, 6650 6649 sizeof(struct mcp_trace_format), 6651 6650 GFP_KERNEL); 6652 6651 if (!meta->formats)
+8 -8
drivers/net/ethernet/qlogic/qed/qed_dev.c
··· 814 814 if (rc) 815 815 goto alloc_err; 816 816 817 - qm_info->qm_pq_params = kzalloc(sizeof(*qm_info->qm_pq_params) * 818 - qed_init_qm_get_num_pqs(p_hwfn), 817 + qm_info->qm_pq_params = kcalloc(qed_init_qm_get_num_pqs(p_hwfn), 818 + sizeof(*qm_info->qm_pq_params), 819 819 GFP_KERNEL); 820 820 if (!qm_info->qm_pq_params) 821 821 goto alloc_err; 822 822 823 - qm_info->qm_vport_params = kzalloc(sizeof(*qm_info->qm_vport_params) * 824 - qed_init_qm_get_num_vports(p_hwfn), 823 + qm_info->qm_vport_params = kcalloc(qed_init_qm_get_num_vports(p_hwfn), 824 + sizeof(*qm_info->qm_vport_params), 825 825 GFP_KERNEL); 826 826 if (!qm_info->qm_vport_params) 827 827 goto alloc_err; 828 828 829 - qm_info->qm_port_params = kzalloc(sizeof(*qm_info->qm_port_params) * 830 - p_hwfn->cdev->num_ports_in_engine, 829 + qm_info->qm_port_params = kcalloc(p_hwfn->cdev->num_ports_in_engine, 830 + sizeof(*qm_info->qm_port_params), 831 831 GFP_KERNEL); 832 832 if (!qm_info->qm_port_params) 833 833 goto alloc_err; 834 834 835 - qm_info->wfq_data = kzalloc(sizeof(*qm_info->wfq_data) * 836 - qed_init_qm_get_num_vports(p_hwfn), 835 + qm_info->wfq_data = kcalloc(qed_init_qm_get_num_vports(p_hwfn), 836 + sizeof(*qm_info->wfq_data), 837 837 GFP_KERNEL); 838 838 if (!qm_info->wfq_data) 839 839 goto alloc_err;
+2 -2
drivers/net/ethernet/qlogic/qed/qed_init_ops.c
··· 149 149 if (IS_VF(p_hwfn->cdev)) 150 150 return 0; 151 151 152 - rt_data->b_valid = kzalloc(sizeof(bool) * RUNTIME_ARRAY_SIZE, 152 + rt_data->b_valid = kcalloc(RUNTIME_ARRAY_SIZE, sizeof(bool), 153 153 GFP_KERNEL); 154 154 if (!rt_data->b_valid) 155 155 return -ENOMEM; 156 156 157 - rt_data->init_val = kzalloc(sizeof(u32) * RUNTIME_ARRAY_SIZE, 157 + rt_data->init_val = kcalloc(RUNTIME_ARRAY_SIZE, sizeof(u32), 158 158 GFP_KERNEL); 159 159 if (!rt_data->init_val) { 160 160 kfree(rt_data->b_valid);
+1 -1
drivers/net/ethernet/qlogic/qed/qed_l2.c
··· 98 98 p_l2_info->queues = max_t(u8, rx, tx); 99 99 } 100 100 101 - pp_qids = kzalloc(sizeof(unsigned long *) * p_l2_info->queues, 101 + pp_qids = kcalloc(p_l2_info->queues, sizeof(unsigned long *), 102 102 GFP_KERNEL); 103 103 if (!pp_qids) 104 104 return -ENOMEM;
+6 -4
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 1025 1025 1026 1026 act_pci_func = ahw->total_nic_func; 1027 1027 1028 - adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) * 1029 - act_pci_func, GFP_KERNEL); 1028 + adapter->npars = kcalloc(act_pci_func, 1029 + sizeof(struct qlcnic_npar_info), 1030 + GFP_KERNEL); 1030 1031 if (!adapter->npars) { 1031 1032 ret = -ENOMEM; 1032 1033 goto err_pci_info; 1033 1034 } 1034 1035 1035 - adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) * 1036 - QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL); 1036 + adapter->eswitch = kcalloc(QLCNIC_NIU_MAX_XG_PORTS, 1037 + sizeof(struct qlcnic_eswitch), 1038 + GFP_KERNEL); 1037 1039 if (!adapter->eswitch) { 1038 1040 ret = -ENOMEM; 1039 1041 goto err_npars;
+4 -4
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
··· 157 157 adapter->ahw->sriov = sriov; 158 158 sriov->num_vfs = num_vfs; 159 159 bc = &sriov->bc; 160 - sriov->vf_info = kzalloc(sizeof(struct qlcnic_vf_info) * 161 - num_vfs, GFP_KERNEL); 160 + sriov->vf_info = kcalloc(num_vfs, sizeof(struct qlcnic_vf_info), 161 + GFP_KERNEL); 162 162 if (!sriov->vf_info) { 163 163 err = -ENOMEM; 164 164 goto qlcnic_free_sriov; ··· 450 450 return 0; 451 451 452 452 num_vlans = sriov->num_allowed_vlans; 453 - sriov->allowed_vlans = kzalloc(sizeof(u16) * num_vlans, GFP_KERNEL); 453 + sriov->allowed_vlans = kcalloc(num_vlans, sizeof(u16), GFP_KERNEL); 454 454 if (!sriov->allowed_vlans) 455 455 return -ENOMEM; 456 456 ··· 706 706 static inline int qlcnic_sriov_alloc_bc_msg(struct qlcnic_bc_hdr **hdr, 707 707 u32 size) 708 708 { 709 - *hdr = kzalloc(sizeof(struct qlcnic_bc_hdr) * size, GFP_ATOMIC); 709 + *hdr = kcalloc(size, sizeof(struct qlcnic_bc_hdr), GFP_ATOMIC); 710 710 if (!*hdr) 711 711 return -ENOMEM; 712 712
+1 -1
drivers/net/ethernet/socionext/netsec.c
··· 973 973 goto err; 974 974 } 975 975 976 - dring->desc = kzalloc(DESC_NUM * sizeof(*dring->desc), GFP_KERNEL); 976 + dring->desc = kcalloc(DESC_NUM, sizeof(*dring->desc), GFP_KERNEL); 977 977 if (!dring->desc) { 978 978 ret = -ENOMEM; 979 979 goto err;
+3 -2
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
··· 2320 2320 pr_debug("%s: wl=%p port=%p\n", __func__, wl, port); 2321 2321 2322 2322 /* allocate scan list */ 2323 - wl->networks = kzalloc(sizeof(struct gelic_wl_scan_info) * 2324 - GELIC_WL_BSS_MAX_ENT, GFP_KERNEL); 2323 + wl->networks = kcalloc(GELIC_WL_BSS_MAX_ENT, 2324 + sizeof(struct gelic_wl_scan_info), 2325 + GFP_KERNEL); 2325 2326 2326 2327 if (!wl->networks) 2327 2328 goto fail_bss;
+3 -2
drivers/net/phy/dp83640.c
··· 1097 1097 if (!clock) 1098 1098 goto out; 1099 1099 1100 - clock->caps.pin_config = kzalloc(sizeof(struct ptp_pin_desc) * 1101 - DP83640_N_PINS, GFP_KERNEL); 1100 + clock->caps.pin_config = kcalloc(DP83640_N_PINS, 1101 + sizeof(struct ptp_pin_desc), 1102 + GFP_KERNEL); 1102 1103 if (!clock->caps.pin_config) { 1103 1104 kfree(clock); 1104 1105 clock = NULL;
+1 -1
drivers/net/slip/slip.c
··· 1307 1307 printk(KERN_INFO "SLIP linefill/keepalive option.\n"); 1308 1308 #endif 1309 1309 1310 - slip_devs = kzalloc(sizeof(struct net_device *)*slip_maxdev, 1310 + slip_devs = kcalloc(slip_maxdev, sizeof(struct net_device *), 1311 1311 GFP_KERNEL); 1312 1312 if (!slip_devs) 1313 1313 return -ENOMEM;
+1 -1
drivers/net/team/team.c
··· 280 280 struct team_option **dst_opts; 281 281 int err; 282 282 283 - dst_opts = kzalloc(sizeof(struct team_option *) * option_count, 283 + dst_opts = kcalloc(option_count, sizeof(struct team_option *), 284 284 GFP_KERNEL); 285 285 if (!dst_opts) 286 286 return -ENOMEM;
+1 -1
drivers/net/usb/smsc95xx.c
··· 1661 1661 } 1662 1662 1663 1663 if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { 1664 - u32 *filter_mask = kzalloc(sizeof(u32) * 32, GFP_KERNEL); 1664 + u32 *filter_mask = kcalloc(32, sizeof(u32), GFP_KERNEL); 1665 1665 u32 command[2]; 1666 1666 u32 offset[2]; 1667 1667 u32 crc[4];
+4 -4
drivers/net/virtio_net.c
··· 2552 2552 virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ); 2553 2553 2554 2554 /* Allocate space for find_vqs parameters */ 2555 - vqs = kzalloc(total_vqs * sizeof(*vqs), GFP_KERNEL); 2555 + vqs = kcalloc(total_vqs, sizeof(*vqs), GFP_KERNEL); 2556 2556 if (!vqs) 2557 2557 goto err_vq; 2558 2558 callbacks = kmalloc_array(total_vqs, sizeof(*callbacks), GFP_KERNEL); ··· 2562 2562 if (!names) 2563 2563 goto err_names; 2564 2564 if (!vi->big_packets || vi->mergeable_rx_bufs) { 2565 - ctx = kzalloc(total_vqs * sizeof(*ctx), GFP_KERNEL); 2565 + ctx = kcalloc(total_vqs, sizeof(*ctx), GFP_KERNEL); 2566 2566 if (!ctx) 2567 2567 goto err_ctx; 2568 2568 } else { ··· 2626 2626 vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL); 2627 2627 if (!vi->ctrl) 2628 2628 goto err_ctrl; 2629 - vi->sq = kzalloc(sizeof(*vi->sq) * vi->max_queue_pairs, GFP_KERNEL); 2629 + vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL); 2630 2630 if (!vi->sq) 2631 2631 goto err_sq; 2632 - vi->rq = kzalloc(sizeof(*vi->rq) * vi->max_queue_pairs, GFP_KERNEL); 2632 + vi->rq = kcalloc(vi->max_queue_pairs, sizeof(*vi->rq), GFP_KERNEL); 2633 2633 if (!vi->rq) 2634 2634 goto err_rq; 2635 2635
+4 -2
drivers/net/wan/fsl_ucc_hdlc.c
··· 198 198 goto free_tx_bd; 199 199 } 200 200 201 - priv->rx_skbuff = kzalloc(priv->rx_ring_size * sizeof(*priv->rx_skbuff), 201 + priv->rx_skbuff = kcalloc(priv->rx_ring_size, 202 + sizeof(*priv->rx_skbuff), 202 203 GFP_KERNEL); 203 204 if (!priv->rx_skbuff) 204 205 goto free_ucc_pram; 205 206 206 - priv->tx_skbuff = kzalloc(priv->tx_ring_size * sizeof(*priv->tx_skbuff), 207 + priv->tx_skbuff = kcalloc(priv->tx_ring_size, 208 + sizeof(*priv->tx_skbuff), 207 209 GFP_KERNEL); 208 210 if (!priv->tx_skbuff) 209 211 goto free_rx_skbuff;
+1 -1
drivers/net/wireless/ath/ath10k/htt_rx.c
··· 582 582 } 583 583 584 584 htt->rx_ring.netbufs_ring = 585 - kzalloc(htt->rx_ring.size * sizeof(struct sk_buff *), 585 + kcalloc(htt->rx_ring.size, sizeof(struct sk_buff *), 586 586 GFP_KERNEL); 587 587 if (!htt->rx_ring.netbufs_ring) 588 588 goto err_netbuf;
+1 -1
drivers/net/wireless/ath/ath10k/wmi-tlv.c
··· 155 155 const void **tb; 156 156 int ret; 157 157 158 - tb = kzalloc(sizeof(*tb) * WMI_TLV_TAG_MAX, gfp); 158 + tb = kcalloc(WMI_TLV_TAG_MAX, sizeof(*tb), gfp); 159 159 if (!tb) 160 160 return ERR_PTR(-ENOMEM); 161 161
+1 -1
drivers/net/wireless/ath/ath6kl/cfg80211.c
··· 1041 1041 1042 1042 n_channels = request->n_channels; 1043 1043 1044 - channels = kzalloc(n_channels * sizeof(u16), GFP_KERNEL); 1044 + channels = kcalloc(n_channels, sizeof(u16), GFP_KERNEL); 1045 1045 if (channels == NULL) { 1046 1046 ath6kl_warn("failed to set scan channels, scan all channels"); 1047 1047 n_channels = 0;
+4 -3
drivers/net/wireless/ath/carl9170/main.c
··· 1958 1958 if (!bands) 1959 1959 return -EINVAL; 1960 1960 1961 - ar->survey = kzalloc(sizeof(struct survey_info) * chans, GFP_KERNEL); 1961 + ar->survey = kcalloc(chans, sizeof(struct survey_info), GFP_KERNEL); 1962 1962 if (!ar->survey) 1963 1963 return -ENOMEM; 1964 1964 ar->num_channels = chans; ··· 1988 1988 if (WARN_ON(ar->mem_bitmap)) 1989 1989 return -EINVAL; 1990 1990 1991 - ar->mem_bitmap = kzalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG) * 1992 - sizeof(unsigned long), GFP_KERNEL); 1991 + ar->mem_bitmap = kcalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG), 1992 + sizeof(unsigned long), 1993 + GFP_KERNEL); 1993 1994 1994 1995 if (!ar->mem_bitmap) 1995 1996 return -ENOMEM;
+1 -1
drivers/net/wireless/broadcom/b43/phy_n.c
··· 1518 1518 u16 i; 1519 1519 u32 *data; 1520 1520 1521 - data = kzalloc(len * sizeof(u32), GFP_KERNEL); 1521 + data = kcalloc(len, sizeof(u32), GFP_KERNEL); 1522 1522 if (!data) { 1523 1523 b43err(dev->wl, "allocation for samples loading failed\n"); 1524 1524 return -ENOMEM;
+2 -2
drivers/net/wireless/broadcom/b43legacy/main.c
··· 3300 3300 3301 3301 if ((phy->type == B43legacy_PHYTYPE_B) || 3302 3302 (phy->type == B43legacy_PHYTYPE_G)) { 3303 - phy->_lo_pairs = kzalloc(sizeof(struct b43legacy_lopair) 3304 - * B43legacy_LO_COUNT, 3303 + phy->_lo_pairs = kcalloc(B43legacy_LO_COUNT, 3304 + sizeof(struct b43legacy_lopair), 3305 3305 GFP_KERNEL); 3306 3306 if (!phy->_lo_pairs) 3307 3307 return -ENOMEM;
+3 -2
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
··· 1486 1486 (struct brcmf_commonring **)if_msgbuf->commonrings; 1487 1487 msgbuf->flowrings = (struct brcmf_commonring **)if_msgbuf->flowrings; 1488 1488 msgbuf->max_flowrings = if_msgbuf->max_flowrings; 1489 - msgbuf->flowring_dma_handle = kzalloc(msgbuf->max_flowrings * 1490 - sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL); 1489 + msgbuf->flowring_dma_handle = 1490 + kcalloc(msgbuf->max_flowrings, 1491 + sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL); 1491 1492 if (!msgbuf->flowring_dma_handle) 1492 1493 goto fail; 1493 1494
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
··· 1058 1058 channel_cnt = AF_PEER_SEARCH_CNT; 1059 1059 else 1060 1060 channel_cnt = SOCIAL_CHAN_CNT; 1061 - default_chan_list = kzalloc(channel_cnt * sizeof(*default_chan_list), 1061 + default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list), 1062 1062 GFP_KERNEL); 1063 1063 if (default_chan_list == NULL) { 1064 1064 brcmf_err("channel list allocation failed\n");
+4 -3
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c
··· 507 507 wlc->hw->wlc = wlc; 508 508 509 509 wlc->hw->bandstate[0] = 510 - kzalloc(sizeof(struct brcms_hw_band) * MAXBANDS, GFP_ATOMIC); 510 + kcalloc(MAXBANDS, sizeof(struct brcms_hw_band), GFP_ATOMIC); 511 511 if (wlc->hw->bandstate[0] == NULL) { 512 512 *err = 1006; 513 513 goto fail; ··· 521 521 } 522 522 523 523 wlc->modulecb = 524 - kzalloc(sizeof(struct modulecb) * BRCMS_MAXMODULES, GFP_ATOMIC); 524 + kcalloc(BRCMS_MAXMODULES, sizeof(struct modulecb), 525 + GFP_ATOMIC); 525 526 if (wlc->modulecb == NULL) { 526 527 *err = 1009; 527 528 goto fail; ··· 554 553 } 555 554 556 555 wlc->bandstate[0] = 557 - kzalloc(sizeof(struct brcms_band)*MAXBANDS, GFP_ATOMIC); 556 + kcalloc(MAXBANDS, sizeof(struct brcms_band), GFP_ATOMIC); 558 557 if (wlc->bandstate[0] == NULL) { 559 558 *err = 1025; 560 559 goto fail;
+7 -6
drivers/net/wireless/intel/iwlegacy/common.c
··· 922 922 D_EEPROM("Parsing data for %d channels.\n", il->channel_count); 923 923 924 924 il->channel_info = 925 - kzalloc(sizeof(struct il_channel_info) * il->channel_count, 925 + kcalloc(il->channel_count, sizeof(struct il_channel_info), 926 926 GFP_KERNEL); 927 927 if (!il->channel_info) { 928 928 IL_ERR("Could not allocate channel_info\n"); ··· 3041 3041 } 3042 3042 3043 3043 txq->meta = 3044 - kzalloc(sizeof(struct il_cmd_meta) * actual_slots, GFP_KERNEL); 3044 + kcalloc(actual_slots, sizeof(struct il_cmd_meta), GFP_KERNEL); 3045 3045 txq->cmd = 3046 - kzalloc(sizeof(struct il_device_cmd *) * actual_slots, GFP_KERNEL); 3046 + kcalloc(actual_slots, sizeof(struct il_device_cmd *), GFP_KERNEL); 3047 3047 3048 3048 if (!txq->meta || !txq->cmd) 3049 3049 goto out_free_arrays; ··· 3455 3455 } 3456 3456 3457 3457 channels = 3458 - kzalloc(sizeof(struct ieee80211_channel) * il->channel_count, 3458 + kcalloc(il->channel_count, sizeof(struct ieee80211_channel), 3459 3459 GFP_KERNEL); 3460 3460 if (!channels) 3461 3461 return -ENOMEM; ··· 4654 4654 { 4655 4655 if (!il->txq) 4656 4656 il->txq = 4657 - kzalloc(sizeof(struct il_tx_queue) * 4658 - il->cfg->num_of_queues, GFP_KERNEL); 4657 + kcalloc(il->cfg->num_of_queues, 4658 + sizeof(struct il_tx_queue), 4659 + GFP_KERNEL); 4659 4660 if (!il->txq) { 4660 4661 IL_ERR("Not enough memory for txq\n"); 4661 4662 return -ENOMEM;
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
··· 564 564 else 565 565 blacklist_len = IWL_SCAN_MAX_BLACKLIST_LEN; 566 566 567 - blacklist = kzalloc(sizeof(*blacklist) * blacklist_len, GFP_KERNEL); 567 + blacklist = kcalloc(blacklist_len, sizeof(*blacklist), GFP_KERNEL); 568 568 if (!blacklist) 569 569 return -ENOMEM; 570 570
+7 -5
drivers/net/wireless/intersil/p54/eeprom.c
··· 161 161 if (!tmp) 162 162 goto err_out; 163 163 164 - tmp->channels = kzalloc(sizeof(struct ieee80211_channel) * 165 - list->band_channel_num[band], GFP_KERNEL); 164 + tmp->channels = kcalloc(list->band_channel_num[band], 165 + sizeof(struct ieee80211_channel), 166 + GFP_KERNEL); 166 167 if (!tmp->channels) 167 168 goto err_out; 168 169 ··· 345 344 goto free; 346 345 } 347 346 priv->chan_num = max_channel_num; 348 - priv->survey = kzalloc(sizeof(struct survey_info) * max_channel_num, 347 + priv->survey = kcalloc(max_channel_num, sizeof(struct survey_info), 349 348 GFP_KERNEL); 350 349 if (!priv->survey) { 351 350 ret = -ENOMEM; ··· 353 352 } 354 353 355 354 list->max_entries = max_channel_num; 356 - list->channels = kzalloc(sizeof(struct p54_channel_entry) * 357 - max_channel_num, GFP_KERNEL); 355 + list->channels = kcalloc(max_channel_num, 356 + sizeof(struct p54_channel_entry), 357 + GFP_KERNEL); 358 358 if (!list->channels) { 359 359 ret = -ENOMEM; 360 360 goto free;
+1 -1
drivers/net/wireless/intersil/prism54/oid_mgt.c
··· 244 244 /* Alloc the cache */ 245 245 for (i = 0; i < OID_NUM_LAST; i++) { 246 246 if (isl_oid[i].flags & OID_FLAG_CACHED) { 247 - priv->mib[i] = kzalloc(isl_oid[i].size * 247 + priv->mib[i] = kcalloc(isl_oid[i].size, 248 248 (isl_oid[i].range + 1), 249 249 GFP_KERNEL); 250 250 if (!priv->mib[i])
+2 -2
drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
··· 399 399 400 400 new_node->win_size = win_size; 401 401 402 - new_node->rx_reorder_ptr = kzalloc(sizeof(void *) * win_size, 403 - GFP_KERNEL); 402 + new_node->rx_reorder_ptr = kcalloc(win_size, sizeof(void *), 403 + GFP_KERNEL); 404 404 if (!new_node->rx_reorder_ptr) { 405 405 kfree((u8 *) new_node); 406 406 mwifiex_dbg(priv->adapter, ERROR,
+5 -4
drivers/net/wireless/marvell/mwifiex/sdio.c
··· 2106 2106 return -ENOMEM; 2107 2107 2108 2108 /* Allocate skb pointer buffers */ 2109 - card->mpa_rx.skb_arr = kzalloc((sizeof(void *)) * 2110 - card->mp_agg_pkt_limit, GFP_KERNEL); 2109 + card->mpa_rx.skb_arr = kcalloc(card->mp_agg_pkt_limit, sizeof(void *), 2110 + GFP_KERNEL); 2111 2111 if (!card->mpa_rx.skb_arr) { 2112 2112 kfree(card->mp_regs); 2113 2113 return -ENOMEM; 2114 2114 } 2115 2115 2116 - card->mpa_rx.len_arr = kzalloc(sizeof(*card->mpa_rx.len_arr) * 2117 - card->mp_agg_pkt_limit, GFP_KERNEL); 2116 + card->mpa_rx.len_arr = kcalloc(card->mp_agg_pkt_limit, 2117 + sizeof(*card->mpa_rx.len_arr), 2118 + GFP_KERNEL); 2118 2119 if (!card->mpa_rx.len_arr) { 2119 2120 kfree(card->mp_regs); 2120 2121 kfree(card->mpa_rx.skb_arr);
+1 -1
drivers/net/wireless/quantenna/qtnfmac/commands.c
··· 1216 1216 return -EINVAL; 1217 1217 } 1218 1218 1219 - limits = kzalloc(sizeof(*limits) * rec->n_limits, 1219 + limits = kcalloc(rec->n_limits, sizeof(*limits), 1220 1220 GFP_KERNEL); 1221 1221 if (!limits) 1222 1222 return -ENOMEM;
+1 -1
drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
··· 397 397 if (*offset) 398 398 return 0; 399 399 400 - data = kzalloc((1 + CIPHER_MAX) * MAX_LINE_LENGTH, GFP_KERNEL); 400 + data = kcalloc(1 + CIPHER_MAX, MAX_LINE_LENGTH, GFP_KERNEL); 401 401 if (!data) 402 402 return -ENOMEM; 403 403
+2 -2
drivers/net/wireless/realtek/rtlwifi/efuse.c
··· 258 258 } 259 259 260 260 /* allocate memory for efuse_tbl and efuse_word */ 261 - efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] * 262 - sizeof(u8), GFP_ATOMIC); 261 + efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE], 262 + GFP_ATOMIC); 263 263 if (!efuse_tbl) 264 264 return; 265 265 efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC);
+1 -1
drivers/net/wireless/realtek/rtlwifi/usb.c
··· 1048 1048 } 1049 1049 rtlpriv = hw->priv; 1050 1050 rtlpriv->hw = hw; 1051 - rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), 1051 + rtlpriv->usb_data = kcalloc(RTL_USB_MAX_RX_COUNT, sizeof(u32), 1052 1052 GFP_KERNEL); 1053 1053 if (!rtlpriv->usb_data) 1054 1054 return -ENOMEM;
+5 -5
drivers/net/wireless/st/cw1200/queue.c
··· 154 154 spin_lock_init(&stats->lock); 155 155 init_waitqueue_head(&stats->wait_link_id_empty); 156 156 157 - stats->link_map_cache = kzalloc(sizeof(int) * map_capacity, 157 + stats->link_map_cache = kcalloc(map_capacity, sizeof(int), 158 158 GFP_KERNEL); 159 159 if (!stats->link_map_cache) 160 160 return -ENOMEM; ··· 181 181 spin_lock_init(&queue->lock); 182 182 timer_setup(&queue->gc, cw1200_queue_gc, 0); 183 183 184 - queue->pool = kzalloc(sizeof(struct cw1200_queue_item) * capacity, 185 - GFP_KERNEL); 184 + queue->pool = kcalloc(capacity, sizeof(struct cw1200_queue_item), 185 + GFP_KERNEL); 186 186 if (!queue->pool) 187 187 return -ENOMEM; 188 188 189 - queue->link_map_cache = kzalloc(sizeof(int) * stats->map_capacity, 190 - GFP_KERNEL); 189 + queue->link_map_cache = kcalloc(stats->map_capacity, sizeof(int), 190 + GFP_KERNEL); 191 191 if (!queue->link_map_cache) { 192 192 kfree(queue->pool); 193 193 queue->pool = NULL;
+3 -3
drivers/net/wireless/st/cw1200/scan.c
··· 230 230 scan.type = WSM_SCAN_TYPE_BACKGROUND; 231 231 scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND; 232 232 } 233 - scan.ch = kzalloc( 234 - sizeof(struct wsm_scan_ch) * (it - priv->scan.curr), 235 - GFP_KERNEL); 233 + scan.ch = kcalloc(it - priv->scan.curr, 234 + sizeof(struct wsm_scan_ch), 235 + GFP_KERNEL); 236 236 if (!scan.ch) { 237 237 priv->scan.status = -ENOMEM; 238 238 goto fail;
+4 -2
drivers/nvmem/rockchip-efuse.c
··· 122 122 addr_offset = offset % RK3399_NBYTES; 123 123 addr_len = addr_end - addr_start; 124 124 125 - buf = kzalloc(sizeof(*buf) * addr_len * RK3399_NBYTES, GFP_KERNEL); 125 + buf = kzalloc(array3_size(addr_len, RK3399_NBYTES, sizeof(*buf)), 126 + GFP_KERNEL); 126 127 if (!buf) { 127 128 ret = -ENOMEM; 128 129 goto nomem; ··· 175 174 addr_offset = offset % RK3399_NBYTES; 176 175 addr_len = addr_end - addr_start; 177 176 178 - buf = kzalloc(sizeof(*buf) * addr_len * RK3399_NBYTES, GFP_KERNEL); 177 + buf = kzalloc(array3_size(addr_len, RK3399_NBYTES, sizeof(*buf)), 178 + GFP_KERNEL); 179 179 if (!buf) { 180 180 clk_disable_unprepare(efuse->clk); 181 181 return -ENOMEM;
+1 -1
drivers/nvmem/sunxi_sid.c
··· 185 185 if (IS_ERR(nvmem)) 186 186 return PTR_ERR(nvmem); 187 187 188 - randomness = kzalloc(sizeof(u8) * (size), GFP_KERNEL); 188 + randomness = kzalloc(size, GFP_KERNEL); 189 189 if (!randomness) { 190 190 ret = -EINVAL; 191 191 goto err_unreg_nvmem;
+1 -1
drivers/of/platform.c
··· 129 129 130 130 /* Populate the resource table */ 131 131 if (num_irq || num_reg) { 132 - res = kzalloc(sizeof(*res) * (num_irq + num_reg), GFP_KERNEL); 132 + res = kcalloc(num_irq + num_reg, sizeof(*res), GFP_KERNEL); 133 133 if (!res) { 134 134 platform_device_put(dev); 135 135 return NULL;
+1 -1
drivers/of/unittest.c
··· 156 156 } 157 157 158 158 /* Array of 4 properties for the purpose of testing */ 159 - prop = kzalloc(sizeof(*prop) * 4, GFP_KERNEL); 159 + prop = kcalloc(4, sizeof(*prop), GFP_KERNEL); 160 160 if (!prop) { 161 161 unittest(0, "kzalloc() failed\n"); 162 162 return;
+2 -2
drivers/opp/ti-opp-supply.c
··· 122 122 goto out; 123 123 } 124 124 125 - table = kzalloc(sizeof(*data->vdd_table) * 126 - data->num_vdd_table, GFP_KERNEL); 125 + table = kcalloc(data->num_vdd_table, sizeof(*data->vdd_table), 126 + GFP_KERNEL); 127 127 if (!table) { 128 128 ret = -ENOMEM; 129 129 goto out;
+2 -2
drivers/pci/msi.c
··· 474 474 return 0; 475 475 476 476 /* Dynamically create the MSI attributes for the PCI device */ 477 - msi_attrs = kzalloc(sizeof(void *) * (num_msi + 1), GFP_KERNEL); 477 + msi_attrs = kcalloc(num_msi + 1, sizeof(void *), GFP_KERNEL); 478 478 if (!msi_attrs) 479 479 return -ENOMEM; 480 480 for_each_pci_msi_entry(entry, pdev) { ··· 501 501 msi_irq_group->name = "msi_irqs"; 502 502 msi_irq_group->attrs = msi_attrs; 503 503 504 - msi_irq_groups = kzalloc(sizeof(void *) * 2, GFP_KERNEL); 504 + msi_irq_groups = kcalloc(2, sizeof(void *), GFP_KERNEL); 505 505 if (!msi_irq_groups) 506 506 goto error_irq_group; 507 507 msi_irq_groups[0] = msi_irq_group;
+1 -1
drivers/pci/pci-sysfs.c
··· 1076 1076 { 1077 1077 int error; 1078 1078 1079 - b->legacy_io = kzalloc(sizeof(struct bin_attribute) * 2, 1079 + b->legacy_io = kcalloc(2, sizeof(struct bin_attribute), 1080 1080 GFP_ATOMIC); 1081 1081 if (!b->legacy_io) 1082 1082 goto kzalloc_err;
+1 -1
drivers/pcmcia/pd6729.c
··· 628 628 char configbyte; 629 629 struct pd6729_socket *socket; 630 630 631 - socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS, 631 + socket = kcalloc(MAX_SOCKETS, sizeof(struct pd6729_socket), 632 632 GFP_KERNEL); 633 633 if (!socket) { 634 634 dev_warn(&dev->dev, "failed to kzalloc socket.\n");
+2 -2
drivers/pinctrl/bcm/pinctrl-bcm2835.c
··· 771 771 maps_per_pin++; 772 772 if (num_pulls) 773 773 maps_per_pin++; 774 - cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps), 775 - GFP_KERNEL); 774 + cur_map = maps = kcalloc(num_pins * maps_per_pin, sizeof(*maps), 775 + GFP_KERNEL); 776 776 if (!maps) 777 777 return -ENOMEM; 778 778
+1 -1
drivers/pinctrl/freescale/pinctrl-mxs.c
··· 89 89 if (!purecfg && config) 90 90 new_num = 2; 91 91 92 - new_map = kzalloc(sizeof(*new_map) * new_num, GFP_KERNEL); 92 + new_map = kcalloc(new_num, sizeof(*new_map), GFP_KERNEL); 93 93 if (!new_map) 94 94 return -ENOMEM; 95 95
+2 -1
drivers/pinctrl/pinctrl-lantiq.c
··· 158 158 159 159 for_each_child_of_node(np_config, np) 160 160 max_maps += ltq_pinctrl_dt_subnode_size(np); 161 - *map = kzalloc(max_maps * sizeof(struct pinctrl_map) * 2, GFP_KERNEL); 161 + *map = kzalloc(array3_size(max_maps, sizeof(struct pinctrl_map), 2), 162 + GFP_KERNEL); 162 163 if (!*map) 163 164 return -ENOMEM; 164 165 tmp = *map;
+1 -1
drivers/pinctrl/sirf/pinctrl-sirf.c
··· 108 108 return -ENODEV; 109 109 } 110 110 111 - *map = kzalloc(sizeof(**map) * count, GFP_KERNEL); 111 + *map = kcalloc(count, sizeof(**map), GFP_KERNEL); 112 112 if (!*map) 113 113 return -ENOMEM; 114 114
+1 -1
drivers/pinctrl/spear/pinctrl-spear.c
··· 172 172 return -ENODEV; 173 173 } 174 174 175 - *map = kzalloc(sizeof(**map) * count, GFP_KERNEL); 175 + *map = kcalloc(count, sizeof(**map), GFP_KERNEL); 176 176 if (!*map) 177 177 return -ENOMEM; 178 178
+1 -1
drivers/pinctrl/sunxi/pinctrl-sunxi.c
··· 277 277 if (!configlen) 278 278 return NULL; 279 279 280 - pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL); 280 + pinconfig = kcalloc(configlen, sizeof(*pinconfig), GFP_KERNEL); 281 281 if (!pinconfig) 282 282 return ERR_PTR(-ENOMEM); 283 283
+1 -1
drivers/pinctrl/vt8500/pinctrl-wmt.c
··· 352 352 if (num_pulls) 353 353 maps_per_pin++; 354 354 355 - cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps), 355 + cur_map = maps = kcalloc(num_pins * maps_per_pin, sizeof(*maps), 356 356 GFP_KERNEL); 357 357 if (!maps) 358 358 return -ENOMEM;
+3 -3
drivers/platform/x86/alienware-wmi.c
··· 458 458 * - zone_data num_zones is for the distinct zones 459 459 */ 460 460 zone_dev_attrs = 461 - kzalloc(sizeof(struct device_attribute) * (quirks->num_zones + 1), 461 + kcalloc(quirks->num_zones + 1, sizeof(struct device_attribute), 462 462 GFP_KERNEL); 463 463 if (!zone_dev_attrs) 464 464 return -ENOMEM; 465 465 466 466 zone_attrs = 467 - kzalloc(sizeof(struct attribute *) * (quirks->num_zones + 2), 467 + kcalloc(quirks->num_zones + 2, sizeof(struct attribute *), 468 468 GFP_KERNEL); 469 469 if (!zone_attrs) 470 470 return -ENOMEM; 471 471 472 472 zone_data = 473 - kzalloc(sizeof(struct platform_zone) * (quirks->num_zones), 473 + kcalloc(quirks->num_zones, sizeof(struct platform_zone), 474 474 GFP_KERNEL); 475 475 if (!zone_data) 476 476 return -ENOMEM;
+6 -6
drivers/platform/x86/intel_ips.c
··· 964 964 u16 *mcp_samples, *ctv1_samples, *ctv2_samples, *mch_samples; 965 965 u8 cur_seqno, last_seqno; 966 966 967 - mcp_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL); 968 - ctv1_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL); 969 - ctv2_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL); 970 - mch_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL); 971 - cpu_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL); 972 - mchp_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL); 967 + mcp_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL); 968 + ctv1_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL); 969 + ctv2_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL); 970 + mch_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL); 971 + cpu_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u32), GFP_KERNEL); 972 + mchp_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u32), GFP_KERNEL); 973 973 if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples || 974 974 !cpu_samples || !mchp_samples) { 975 975 dev_err(ips->dev,
+1 -1
drivers/platform/x86/panasonic-laptop.c
··· 571 571 return -ENOMEM; 572 572 } 573 573 574 - pcc->sinf = kzalloc(sizeof(u32) * (num_sifr + 1), GFP_KERNEL); 574 + pcc->sinf = kcalloc(num_sifr + 1, sizeof(u32), GFP_KERNEL); 575 575 if (!pcc->sinf) { 576 576 result = -ENOMEM; 577 577 goto out_hotkey;
+1 -1
drivers/platform/x86/thinkpad_acpi.c
··· 6006 6006 if (led_supported == TPACPI_LED_NONE) 6007 6007 return 1; 6008 6008 6009 - tpacpi_leds = kzalloc(sizeof(*tpacpi_leds) * TPACPI_LED_NUMLEDS, 6009 + tpacpi_leds = kcalloc(TPACPI_LED_NUMLEDS, sizeof(*tpacpi_leds), 6010 6010 GFP_KERNEL); 6011 6011 if (!tpacpi_leds) { 6012 6012 pr_err("Out of memory for LED data\n");
+1 -1
drivers/power/supply/wm97xx_battery.c
··· 201 201 if (pdata->min_voltage >= 0) 202 202 props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */ 203 203 204 - prop = kzalloc(props * sizeof(*prop), GFP_KERNEL); 204 + prop = kcalloc(props, sizeof(*prop), GFP_KERNEL); 205 205 if (!prop) { 206 206 ret = -ENOMEM; 207 207 goto err3;
+1 -1
drivers/power/supply/z2_battery.c
··· 146 146 if (info->min_voltage >= 0) 147 147 props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */ 148 148 149 - prop = kzalloc(props * sizeof(*prop), GFP_KERNEL); 149 + prop = kcalloc(props, sizeof(*prop), GFP_KERNEL); 150 150 if (!prop) 151 151 return -ENOMEM; 152 152
+5 -4
drivers/powercap/powercap_sys.c
··· 545 545 dev_set_name(&power_zone->dev, "%s:%x", 546 546 dev_name(power_zone->dev.parent), 547 547 power_zone->id); 548 - power_zone->constraints = kzalloc(sizeof(*power_zone->constraints) * 549 - nr_constraints, GFP_KERNEL); 548 + power_zone->constraints = kcalloc(nr_constraints, 549 + sizeof(*power_zone->constraints), 550 + GFP_KERNEL); 550 551 if (!power_zone->constraints) 551 552 goto err_const_alloc; 552 553 553 554 nr_attrs = nr_constraints * POWERCAP_CONSTRAINTS_ATTRS + 554 555 POWERCAP_ZONE_MAX_ATTRS + 1; 555 - power_zone->zone_dev_attrs = kzalloc(sizeof(void *) * 556 - nr_attrs, GFP_KERNEL); 556 + power_zone->zone_dev_attrs = kcalloc(nr_attrs, sizeof(void *), 557 + GFP_KERNEL); 557 558 if (!power_zone->zone_dev_attrs) 558 559 goto err_attr_alloc; 559 560 create_power_zone_common_attributes(power_zone);
+3 -3
drivers/rapidio/rio-scan.c
··· 425 425 rswitch = rdev->rswitch; 426 426 rswitch->port_ok = 0; 427 427 spin_lock_init(&rswitch->lock); 428 - rswitch->route_table = kzalloc(sizeof(u8)* 429 - RIO_MAX_ROUTE_ENTRIES(port->sys_size), 430 - GFP_KERNEL); 428 + rswitch->route_table = 429 + kzalloc(RIO_MAX_ROUTE_ENTRIES(port->sys_size), 430 + GFP_KERNEL); 431 431 if (!rswitch->route_table) 432 432 goto cleanup; 433 433 /* Initialize switch route table */
+1 -1
drivers/regulator/s2mps11.c
··· 1162 1162 } 1163 1163 } 1164 1164 1165 - rdata = kzalloc(sizeof(*rdata) * rdev_num, GFP_KERNEL); 1165 + rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL); 1166 1166 if (!rdata) 1167 1167 return -ENOMEM; 1168 1168
+3 -3
drivers/s390/block/dcssblk.c
··· 238 238 if (dev_info->num_of_segments <= 1) 239 239 return 0; 240 240 241 - sort_list = kzalloc( 242 - sizeof(struct segment_info) * dev_info->num_of_segments, 243 - GFP_KERNEL); 241 + sort_list = kcalloc(dev_info->num_of_segments, 242 + sizeof(struct segment_info), 243 + GFP_KERNEL); 244 244 if (sort_list == NULL) 245 245 return -ENOMEM; 246 246 i = 0;
+1 -1
drivers/s390/char/keyboard.c
··· 78 78 } 79 79 } 80 80 kbd->fn_handler = 81 - kzalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL); 81 + kcalloc(NR_FN_HANDLER, sizeof(fn_handler_fn *), GFP_KERNEL); 82 82 if (!kbd->fn_handler) 83 83 goto out_func; 84 84 kbd->accent_table = kmemdup(ebc_accent_table,
+1 -1
drivers/s390/char/vmur.c
··· 242 242 * That means we allocate room for CCWs to cover count/reclen 243 243 * records plus a NOP. 244 244 */ 245 - cpa = kzalloc((rec_count + 1) * sizeof(struct ccw1), 245 + cpa = kcalloc(rec_count + 1, sizeof(struct ccw1), 246 246 GFP_KERNEL | GFP_DMA); 247 247 if (!cpa) 248 248 return ERR_PTR(-ENOMEM);
+1 -1
drivers/s390/char/zcore.c
··· 152 152 char *buf; 153 153 int i = 0; 154 154 155 - buf = kzalloc(memblock.memory.cnt * CHUNK_INFO_SIZE, GFP_KERNEL); 155 + buf = kcalloc(memblock.memory.cnt, CHUNK_INFO_SIZE, GFP_KERNEL); 156 156 if (!buf) { 157 157 return -ENOMEM; 158 158 }
+1 -1
drivers/s390/cio/qdio_setup.c
··· 536 536 537 537 int qdio_enable_async_operation(struct qdio_output_q *outq) 538 538 { 539 - outq->aobs = kzalloc(sizeof(struct qaob *) * QDIO_MAX_BUFFERS_PER_Q, 539 + outq->aobs = kcalloc(QDIO_MAX_BUFFERS_PER_Q, sizeof(struct qaob *), 540 540 GFP_ATOMIC); 541 541 if (!outq->aobs) { 542 542 outq->use_cq = 0;
+3 -2
drivers/s390/cio/qdio_thinint.c
··· 241 241 /* allocate non-shared indicators and shared indicator */ 242 242 int __init tiqdio_allocate_memory(void) 243 243 { 244 - q_indicators = kzalloc(sizeof(struct indicator_t) * TIQDIO_NR_INDICATORS, 245 - GFP_KERNEL); 244 + q_indicators = kcalloc(TIQDIO_NR_INDICATORS, 245 + sizeof(struct indicator_t), 246 + GFP_KERNEL); 246 247 if (!q_indicators) 247 248 return -ENOMEM; 248 249 return 0;
+1 -1
drivers/s390/crypto/pkey_api.c
··· 121 121 * allocate consecutive memory for request CPRB, request param 122 122 * block, reply CPRB and reply param block 123 123 */ 124 - cprbmem = kzalloc(2 * cprbplusparamblen, GFP_KERNEL); 124 + cprbmem = kcalloc(2, cprbplusparamblen, GFP_KERNEL); 125 125 if (!cprbmem) 126 126 return -ENOMEM; 127 127
+1 -1
drivers/s390/net/ctcm_main.c
··· 1379 1379 } else 1380 1380 ccw_num = 8; 1381 1381 1382 - ch->ccw = kzalloc(ccw_num * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); 1382 + ch->ccw = kcalloc(ccw_num, sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); 1383 1383 if (ch->ccw == NULL) 1384 1384 goto nomem_return; 1385 1385
+15 -12
drivers/s390/net/qeth_core_main.c
··· 374 374 } 375 375 card->qdio.no_in_queues = 2; 376 376 card->qdio.out_bufstates = 377 - kzalloc(card->qdio.no_out_queues * 378 - QDIO_MAX_BUFFERS_PER_Q * 379 - sizeof(struct qdio_outbuf_state), GFP_KERNEL); 377 + kcalloc(card->qdio.no_out_queues * 378 + QDIO_MAX_BUFFERS_PER_Q, 379 + sizeof(struct qdio_outbuf_state), 380 + GFP_KERNEL); 380 381 outbuf_states = card->qdio.out_bufstates; 381 382 if (outbuf_states == NULL) { 382 383 rc = -1; ··· 2539 2538 2540 2539 /* outbound */ 2541 2540 card->qdio.out_qs = 2542 - kzalloc(card->qdio.no_out_queues * 2543 - sizeof(struct qeth_qdio_out_q *), GFP_KERNEL); 2541 + kcalloc(card->qdio.no_out_queues, 2542 + sizeof(struct qeth_qdio_out_q *), 2543 + GFP_KERNEL); 2544 2544 if (!card->qdio.out_qs) 2545 2545 goto out_freepool; 2546 2546 for (i = 0; i < card->qdio.no_out_queues; ++i) { ··· 4965 4963 4966 4964 QETH_DBF_TEXT(SETUP, 2, "qdioest"); 4967 4965 4968 - qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q * sizeof(char), 4969 - GFP_KERNEL); 4966 + qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q, 4967 + GFP_KERNEL); 4970 4968 if (!qib_param_field) { 4971 4969 rc = -ENOMEM; 4972 4970 goto out_free_nothing; ··· 4975 4973 qeth_create_qib_param_field(card, qib_param_field); 4976 4974 qeth_create_qib_param_field_blkt(card, qib_param_field); 4977 4975 4978 - in_sbal_ptrs = kzalloc(card->qdio.no_in_queues * 4979 - QDIO_MAX_BUFFERS_PER_Q * sizeof(void *), 4976 + in_sbal_ptrs = kcalloc(card->qdio.no_in_queues * QDIO_MAX_BUFFERS_PER_Q, 4977 + sizeof(void *), 4980 4978 GFP_KERNEL); 4981 4979 if (!in_sbal_ptrs) { 4982 4980 rc = -ENOMEM; ··· 4987 4985 virt_to_phys(card->qdio.in_q->bufs[i].buffer); 4988 4986 } 4989 4987 4990 - queue_start_poll = kzalloc(sizeof(void *) * card->qdio.no_in_queues, 4988 + queue_start_poll = kcalloc(card->qdio.no_in_queues, sizeof(void *), 4991 4989 GFP_KERNEL); 4992 4990 if (!queue_start_poll) { 4993 4991 rc = -ENOMEM; ··· 4999 4997 qeth_qdio_establish_cq(card, in_sbal_ptrs, queue_start_poll); 5000 4998 5001 4999 out_sbal_ptrs = 5002 - kzalloc(card->qdio.no_out_queues * QDIO_MAX_BUFFERS_PER_Q * 5003 - sizeof(void *), GFP_KERNEL); 5000 + kcalloc(card->qdio.no_out_queues * QDIO_MAX_BUFFERS_PER_Q, 5001 + sizeof(void *), 5002 + GFP_KERNEL); 5004 5003 if (!out_sbal_ptrs) { 5005 5004 rc = -ENOMEM; 5006 5005 goto out_free_queue_start_poll;
+1 -1
drivers/scsi/BusLogic.c
··· 2366 2366 if (blogic_probe_options.noprobe) 2367 2367 return -ENODEV; 2368 2368 blogic_probeinfo_list = 2369 - kzalloc(BLOGIC_MAX_ADAPTERS * sizeof(struct blogic_probeinfo), 2369 + kcalloc(BLOGIC_MAX_ADAPTERS, sizeof(struct blogic_probeinfo), 2370 2370 GFP_KERNEL); 2371 2371 if (blogic_probeinfo_list == NULL) { 2372 2372 blogic_err("BusLogic: Unable to allocate Probe Info List\n",
+3 -1
drivers/scsi/aacraid/linit.c
··· 1681 1681 if (aac_reset_devices || reset_devices) 1682 1682 aac->init_reset = true; 1683 1683 1684 - aac->fibs = kzalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL); 1684 + aac->fibs = kcalloc(shost->can_queue + AAC_NUM_MGT_FIB, 1685 + sizeof(struct fib), 1686 + GFP_KERNEL); 1685 1687 if (!aac->fibs) 1686 1688 goto out_free_host; 1687 1689 spin_lock_init(&aac->fib_lock);
+2 -2
drivers/scsi/aic7xxx/aic7xxx_core.c
··· 4779 4779 SLIST_INIT(&scb_data->sg_maps); 4780 4780 4781 4781 /* Allocate SCB resources */ 4782 - scb_data->scbarray = kzalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, 4783 - GFP_ATOMIC); 4782 + scb_data->scbarray = kcalloc(AHC_SCB_MAX_ALLOC, sizeof(struct scb), 4783 + GFP_ATOMIC); 4784 4784 if (scb_data->scbarray == NULL) 4785 4785 return (ENOMEM); 4786 4786
+3 -2
drivers/scsi/aic94xx/aic94xx_hwi.c
··· 220 220 221 221 /* allocate the index array and bitmap */ 222 222 asd_ha->seq.tc_index_bitmap_bits = asd_ha->hw_prof.max_scbs; 223 - asd_ha->seq.tc_index_array = kzalloc(asd_ha->seq.tc_index_bitmap_bits* 224 - sizeof(void *), GFP_KERNEL); 223 + asd_ha->seq.tc_index_array = kcalloc(asd_ha->seq.tc_index_bitmap_bits, 224 + sizeof(void *), 225 + GFP_KERNEL); 225 226 if (!asd_ha->seq.tc_index_array) 226 227 return -ENOMEM; 227 228
+1 -1
drivers/scsi/aic94xx/aic94xx_init.c
··· 350 350 int flash_command = FLASH_CMD_NONE; 351 351 int err = 0; 352 352 353 - cmd_ptr = kzalloc(count*2, GFP_KERNEL); 353 + cmd_ptr = kcalloc(count, 2, GFP_KERNEL); 354 354 355 355 if (!cmd_ptr) { 356 356 err = FAIL_OUT_MEMORY;
+22 -18
drivers/scsi/be2iscsi/be_main.c
··· 2467 2467 2468 2468 /* Allocate memory for wrb_context */ 2469 2469 phwi_ctrlr = phba->phwi_ctrlr; 2470 - phwi_ctrlr->wrb_context = kzalloc(sizeof(struct hwi_wrb_context) * 2471 - phba->params.cxns_per_ctrl, 2470 + phwi_ctrlr->wrb_context = kcalloc(phba->params.cxns_per_ctrl, 2471 + sizeof(struct hwi_wrb_context), 2472 2472 GFP_KERNEL); 2473 2473 if (!phwi_ctrlr->wrb_context) { 2474 2474 kfree(phba->phwi_ctrlr); ··· 2621 2621 2622 2622 /* Allocate memory for WRBQ */ 2623 2623 phwi_ctxt = phwi_ctrlr->phwi_ctxt; 2624 - phwi_ctxt->be_wrbq = kzalloc(sizeof(struct be_queue_info) * 2625 - phba->params.cxns_per_ctrl, 2624 + phwi_ctxt->be_wrbq = kcalloc(phba->params.cxns_per_ctrl, 2625 + sizeof(struct be_queue_info), 2626 2626 GFP_KERNEL); 2627 2627 if (!phwi_ctxt->be_wrbq) { 2628 2628 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, ··· 2633 2633 for (index = 0; index < phba->params.cxns_per_ctrl; index++) { 2634 2634 pwrb_context = &phwi_ctrlr->wrb_context[index]; 2635 2635 pwrb_context->pwrb_handle_base = 2636 - kzalloc(sizeof(struct wrb_handle *) * 2637 - phba->params.wrbs_per_cxn, GFP_KERNEL); 2636 + kcalloc(phba->params.wrbs_per_cxn, 2637 + sizeof(struct wrb_handle *), 2638 + GFP_KERNEL); 2638 2639 if (!pwrb_context->pwrb_handle_base) { 2639 2640 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 2640 2641 "BM_%d : Mem Alloc Failed. Failing to load\n"); 2641 2642 goto init_wrb_hndl_failed; 2642 2643 } 2643 2644 pwrb_context->pwrb_handle_basestd = 2644 - kzalloc(sizeof(struct wrb_handle *) * 2645 - phba->params.wrbs_per_cxn, GFP_KERNEL); 2645 + kcalloc(phba->params.wrbs_per_cxn, 2646 + sizeof(struct wrb_handle *), 2647 + GFP_KERNEL); 2646 2648 if (!pwrb_context->pwrb_handle_basestd) { 2647 2649 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 2648 2650 "BM_%d : Mem Alloc Failed. Failing to load\n"); ··· 3898 3896 mem_descr_sglh = phba->init_mem; 3899 3897 mem_descr_sglh += HWI_MEM_SGLH; 3900 3898 if (1 == mem_descr_sglh->num_elements) { 3901 - phba->io_sgl_hndl_base = kzalloc(sizeof(struct sgl_handle *) * 3902 - phba->params.ios_per_ctrl, 3899 + phba->io_sgl_hndl_base = kcalloc(phba->params.ios_per_ctrl, 3900 + sizeof(struct sgl_handle *), 3903 3901 GFP_KERNEL); 3904 3902 if (!phba->io_sgl_hndl_base) { 3905 3903 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 3906 3904 "BM_%d : Mem Alloc Failed. Failing to load\n"); 3907 3905 return -ENOMEM; 3908 3906 } 3909 - phba->eh_sgl_hndl_base = kzalloc(sizeof(struct sgl_handle *) * 3910 - (phba->params.icds_per_ctrl - 3911 - phba->params.ios_per_ctrl), 3912 - GFP_KERNEL); 3907 + phba->eh_sgl_hndl_base = 3908 + kcalloc(phba->params.icds_per_ctrl - 3909 + phba->params.ios_per_ctrl, 3910 + sizeof(struct sgl_handle *), GFP_KERNEL); 3913 3911 if (!phba->eh_sgl_hndl_base) { 3914 3912 kfree(phba->io_sgl_hndl_base); 3915 3913 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, ··· 4036 4034 phba->cid_array_info[ulp_num] = ptr_cid_info; 4037 4035 } 4038 4036 } 4039 - phba->ep_array = kzalloc(sizeof(struct iscsi_endpoint *) * 4040 - phba->params.cxns_per_ctrl, GFP_KERNEL); 4037 + phba->ep_array = kcalloc(phba->params.cxns_per_ctrl, 4038 + sizeof(struct iscsi_endpoint *), 4039 + GFP_KERNEL); 4041 4040 if (!phba->ep_array) { 4042 4041 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 4043 4042 "BM_%d : Failed to allocate memory in " ··· 4048 4045 goto free_memory; 4049 4046 } 4050 4047 4051 - phba->conn_table = kzalloc(sizeof(struct beiscsi_conn *) * 4052 - phba->params.cxns_per_ctrl, GFP_KERNEL); 4048 + phba->conn_table = kcalloc(phba->params.cxns_per_ctrl, 4049 + sizeof(struct beiscsi_conn *), 4050 + GFP_KERNEL); 4053 4051 if (!phba->conn_table) { 4054 4052 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 4055 4053 "BM_%d : Failed to allocate memory in"
+1 -1
drivers/scsi/bfa/bfad_attr.c
··· 927 927 struct bfa_rport_qualifier_s *rports = NULL; 928 928 unsigned long flags; 929 929 930 - rports = kzalloc(sizeof(struct bfa_rport_qualifier_s) * nrports, 930 + rports = kcalloc(nrports, sizeof(struct bfa_rport_qualifier_s), 931 931 GFP_ATOMIC); 932 932 if (rports == NULL) 933 933 return snprintf(buf, PAGE_SIZE, "Failed\n");
+3 -2
drivers/scsi/bfa/bfad_bsg.c
··· 3252 3252 struct bfa_sge_s *sg_table; 3253 3253 int sge_num = 1; 3254 3254 3255 - buf_base = kzalloc((sizeof(struct bfad_buf_info) + 3256 - sizeof(struct bfa_sge_s)) * sge_num, GFP_KERNEL); 3255 + buf_base = kcalloc(sizeof(struct bfad_buf_info) + 3256 + sizeof(struct bfa_sge_s), 3257 + sge_num, GFP_KERNEL); 3257 3258 if (!buf_base) 3258 3259 return NULL; 3259 3260
+1 -1
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
··· 1397 1397 hba->next_conn_id = 0; 1398 1398 1399 1399 hba->tgt_ofld_list = 1400 - kzalloc(sizeof(struct bnx2fc_rport *) * BNX2FC_NUM_MAX_SESS, 1400 + kcalloc(BNX2FC_NUM_MAX_SESS, sizeof(struct bnx2fc_rport *), 1401 1401 GFP_KERNEL); 1402 1402 if (!hba->tgt_ofld_list) { 1403 1403 printk(KERN_ERR PFX "Unable to allocate tgt offload list\n");
+4 -4
drivers/scsi/bnx2fc/bnx2fc_io.c
··· 240 240 return NULL; 241 241 } 242 242 243 - cmgr->free_list = kzalloc(sizeof(*cmgr->free_list) * 244 - arr_sz, GFP_KERNEL); 243 + cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list), 244 + GFP_KERNEL); 245 245 if (!cmgr->free_list) { 246 246 printk(KERN_ERR PFX "failed to alloc free_list\n"); 247 247 goto mem_err; 248 248 } 249 249 250 - cmgr->free_list_lock = kzalloc(sizeof(*cmgr->free_list_lock) * 251 - arr_sz, GFP_KERNEL); 250 + cmgr->free_list_lock = kcalloc(arr_sz, sizeof(*cmgr->free_list_lock), 251 + GFP_KERNEL); 252 252 if (!cmgr->free_list_lock) { 253 253 printk(KERN_ERR PFX "failed to alloc free_list_lock\n"); 254 254 kfree(cmgr->free_list);
+2 -2
drivers/scsi/csiostor/csio_wr.c
··· 276 276 q->un.iq.flq_idx = flq_idx; 277 277 278 278 flq = wrm->q_arr[q->un.iq.flq_idx]; 279 - flq->un.fl.bufs = kzalloc(flq->credits * 279 + flq->un.fl.bufs = kcalloc(flq->credits, 280 280 sizeof(struct csio_dma_buf), 281 281 GFP_KERNEL); 282 282 if (!flq->un.fl.bufs) { ··· 1579 1579 return -EINVAL; 1580 1580 } 1581 1581 1582 - wrm->q_arr = kzalloc(sizeof(struct csio_q *) * wrm->num_q, GFP_KERNEL); 1582 + wrm->q_arr = kcalloc(wrm->num_q, sizeof(struct csio_q *), GFP_KERNEL); 1583 1583 if (!wrm->q_arr) 1584 1584 goto err; 1585 1585
+6 -5
drivers/scsi/esas2r/esas2r_init.c
··· 833 833 834 834 /* allocate requests for asynchronous events */ 835 835 a->first_ae_req = 836 - kzalloc(num_ae_requests * sizeof(struct esas2r_request), 836 + kcalloc(num_ae_requests, sizeof(struct esas2r_request), 837 837 GFP_KERNEL); 838 838 839 839 if (a->first_ae_req == NULL) { ··· 843 843 } 844 844 845 845 /* allocate the S/G list memory descriptors */ 846 - a->sg_list_mds = kzalloc( 847 - num_sg_lists * sizeof(struct esas2r_mem_desc), GFP_KERNEL); 846 + a->sg_list_mds = kcalloc(num_sg_lists, sizeof(struct esas2r_mem_desc), 847 + GFP_KERNEL); 848 848 849 849 if (a->sg_list_mds == NULL) { 850 850 esas2r_log(ESAS2R_LOG_CRIT, ··· 854 854 855 855 /* allocate the request table */ 856 856 a->req_table = 857 - kzalloc((num_requests + num_ae_requests + 858 - 1) * sizeof(struct esas2r_request *), GFP_KERNEL); 857 + kcalloc(num_requests + num_ae_requests + 1, 858 + sizeof(struct esas2r_request *), 859 + GFP_KERNEL); 859 860 860 861 if (a->req_table == NULL) { 861 862 esas2r_log(ESAS2R_LOG_CRIT,
+11 -11
drivers/scsi/hpsa.c
··· 1923 1923 } 1924 1924 spin_unlock_irqrestore(&h->reset_lock, flags); 1925 1925 1926 - added = kzalloc(sizeof(*added) * HPSA_MAX_DEVICES, GFP_KERNEL); 1927 - removed = kzalloc(sizeof(*removed) * HPSA_MAX_DEVICES, GFP_KERNEL); 1926 + added = kcalloc(HPSA_MAX_DEVICES, sizeof(*added), GFP_KERNEL); 1927 + removed = kcalloc(HPSA_MAX_DEVICES, sizeof(*removed), GFP_KERNEL); 1928 1928 1929 1929 if (!added || !removed) { 1930 1930 dev_warn(&h->pdev->dev, "out of memory in " ··· 2171 2171 return 0; 2172 2172 2173 2173 h->ioaccel2_cmd_sg_list = 2174 - kzalloc(sizeof(*h->ioaccel2_cmd_sg_list) * h->nr_cmds, 2174 + kcalloc(h->nr_cmds, sizeof(*h->ioaccel2_cmd_sg_list), 2175 2175 GFP_KERNEL); 2176 2176 if (!h->ioaccel2_cmd_sg_list) 2177 2177 return -ENOMEM; ··· 2211 2211 if (h->chainsize <= 0) 2212 2212 return 0; 2213 2213 2214 - h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds, 2215 - GFP_KERNEL); 2214 + h->cmd_sg_list = kcalloc(h->nr_cmds, sizeof(*h->cmd_sg_list), 2215 + GFP_KERNEL); 2216 2216 if (!h->cmd_sg_list) 2217 2217 return -ENOMEM; 2218 2218 ··· 4321 4321 bool physical_device; 4322 4322 DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS); 4323 4323 4324 - currentsd = kzalloc(sizeof(*currentsd) * HPSA_MAX_DEVICES, GFP_KERNEL); 4324 + currentsd = kcalloc(HPSA_MAX_DEVICES, sizeof(*currentsd), GFP_KERNEL); 4325 4325 physdev_list = kzalloc(sizeof(*physdev_list), GFP_KERNEL); 4326 4326 logdev_list = kzalloc(sizeof(*logdev_list), GFP_KERNEL); 4327 4327 tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL); ··· 6404 6404 status = -EINVAL; 6405 6405 goto cleanup1; 6406 6406 } 6407 - buff = kzalloc(SG_ENTRIES_IN_CMD * sizeof(char *), GFP_KERNEL); 6407 + buff = kcalloc(SG_ENTRIES_IN_CMD, sizeof(char *), GFP_KERNEL); 6408 6408 if (!buff) { 6409 6409 status = -ENOMEM; 6410 6410 goto cleanup1; ··· 7933 7933 7934 7934 static int hpsa_alloc_cmd_pool(struct ctlr_info *h) 7935 7935 { 7936 - h->cmd_pool_bits = kzalloc( 7937 - DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) * 7938 - sizeof(unsigned long), GFP_KERNEL); 7936 + h->cmd_pool_bits = kcalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG), 7937 + sizeof(unsigned long), 7938 + GFP_KERNEL); 7939 7939 h->cmd_pool = pci_alloc_consistent(h->pdev, 7940 7940 h->nr_cmds * sizeof(*h->cmd_pool), 7941 7941 &(h->cmd_pool_dhandle)); ··· 8509 8509 if (!h) 8510 8510 return NULL; 8511 8511 8512 - h->reply_map = kzalloc(sizeof(*h->reply_map) * nr_cpu_ids, GFP_KERNEL); 8512 + h->reply_map = kcalloc(nr_cpu_ids, sizeof(*h->reply_map), GFP_KERNEL); 8513 8513 if (!h->reply_map) { 8514 8514 kfree(h); 8515 8515 return NULL;
+6 -4
drivers/scsi/ipr.c
··· 9713 9713 int i, rc = -ENOMEM; 9714 9714 9715 9715 ENTER; 9716 - ioa_cfg->res_entries = kzalloc(sizeof(struct ipr_resource_entry) * 9717 - ioa_cfg->max_devs_supported, GFP_KERNEL); 9716 + ioa_cfg->res_entries = kcalloc(ioa_cfg->max_devs_supported, 9717 + sizeof(struct ipr_resource_entry), 9718 + GFP_KERNEL); 9718 9719 9719 9720 if (!ioa_cfg->res_entries) 9720 9721 goto out; ··· 9776 9775 list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q); 9777 9776 } 9778 9777 9779 - ioa_cfg->trace = kzalloc(sizeof(struct ipr_trace_entry) * 9780 - IPR_NUM_TRACE_ENTRIES, GFP_KERNEL); 9778 + ioa_cfg->trace = kcalloc(IPR_NUM_TRACE_ENTRIES, 9779 + sizeof(struct ipr_trace_entry), 9780 + GFP_KERNEL); 9781 9781 9782 9782 if (!ioa_cfg->trace) 9783 9783 goto out_free_hostrcb_dma;
+1 -1
drivers/scsi/libsas/sas_expander.c
··· 443 443 struct expander_device *ex = &dev->ex_dev; 444 444 int res = -ENOMEM; 445 445 446 - ex->ex_phy = kzalloc(sizeof(*ex->ex_phy)*ex->num_phys, GFP_KERNEL); 446 + ex->ex_phy = kcalloc(ex->num_phys, sizeof(*ex->ex_phy), GFP_KERNEL); 447 447 if (!ex->ex_phy) 448 448 return -ENOMEM; 449 449
+4 -3
drivers/scsi/lpfc/lpfc_init.c
··· 5723 5723 } 5724 5724 5725 5725 if (!phba->sli.sli3_ring) 5726 - phba->sli.sli3_ring = kzalloc(LPFC_SLI3_MAX_RING * 5727 - sizeof(struct lpfc_sli_ring), GFP_KERNEL); 5726 + phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING, 5727 + sizeof(struct lpfc_sli_ring), 5728 + GFP_KERNEL); 5728 5729 if (!phba->sli.sli3_ring) 5729 5730 return -ENOMEM; 5730 5731 ··· 6234 6233 6235 6234 /* Allocate eligible FCF bmask memory for FCF roundrobin failover */ 6236 6235 longs = (LPFC_SLI4_FCF_TBL_INDX_MAX + BITS_PER_LONG - 1)/BITS_PER_LONG; 6237 - phba->fcf.fcf_rr_bmask = kzalloc(longs * sizeof(unsigned long), 6236 + phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long), 6238 6237 GFP_KERNEL); 6239 6238 if (!phba->fcf.fcf_rr_bmask) { 6240 6239 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+22 -28
drivers/scsi/lpfc/lpfc_sli.c
··· 1720 1720 - LPFC_IOCBQ_LOOKUP_INCREMENT)) { 1721 1721 new_len = psli->iocbq_lookup_len + LPFC_IOCBQ_LOOKUP_INCREMENT; 1722 1722 spin_unlock_irq(&phba->hbalock); 1723 - new_arr = kzalloc(new_len * sizeof (struct lpfc_iocbq *), 1723 + new_arr = kcalloc(new_len, sizeof(struct lpfc_iocbq *), 1724 1724 GFP_KERNEL); 1725 1725 if (new_arr) { 1726 1726 spin_lock_irq(&phba->hbalock); ··· 5142 5142 */ 5143 5143 if ((phba->vpi_bmask == NULL) && (phba->vpi_ids == NULL)) { 5144 5144 longs = (phba->max_vpi + BITS_PER_LONG) / BITS_PER_LONG; 5145 - phba->vpi_bmask = kzalloc(longs * sizeof(unsigned long), 5145 + phba->vpi_bmask = kcalloc(longs, 5146 + sizeof(unsigned long), 5146 5147 GFP_KERNEL); 5147 5148 if (!phba->vpi_bmask) { 5148 5149 rc = -ENOMEM; 5149 5150 goto lpfc_sli_hba_setup_error; 5150 5151 } 5151 5152 5152 - phba->vpi_ids = kzalloc( 5153 - (phba->max_vpi+1) * sizeof(uint16_t), 5154 - GFP_KERNEL); 5153 + phba->vpi_ids = kcalloc(phba->max_vpi + 1, 5154 + sizeof(uint16_t), 5155 + GFP_KERNEL); 5155 5156 if (!phba->vpi_ids) { 5156 5157 kfree(phba->vpi_bmask); 5157 5158 rc = -ENOMEM; ··· 5837 5836 length = sizeof(struct lpfc_rsrc_blks); 5838 5837 switch (type) { 5839 5838 case LPFC_RSC_TYPE_FCOE_RPI: 5840 - phba->sli4_hba.rpi_bmask = kzalloc(longs * 5839 + phba->sli4_hba.rpi_bmask = kcalloc(longs, 5841 5840 sizeof(unsigned long), 5842 5841 GFP_KERNEL); 5843 5842 if (unlikely(!phba->sli4_hba.rpi_bmask)) { 5844 5843 rc = -ENOMEM; 5845 5844 goto err_exit; 5846 5845 } 5847 - phba->sli4_hba.rpi_ids = kzalloc(rsrc_id_cnt * 5846 + phba->sli4_hba.rpi_ids = kcalloc(rsrc_id_cnt, 5848 5847 sizeof(uint16_t), 5849 5848 GFP_KERNEL); 5850 5849 if (unlikely(!phba->sli4_hba.rpi_ids)) { ··· 5866 5865 ext_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list; 5867 5866 break; 5868 5867 case LPFC_RSC_TYPE_FCOE_VPI: 5869 - phba->vpi_bmask = kzalloc(longs * 5870 - sizeof(unsigned long), 5868 + phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long), 5871 5869 GFP_KERNEL); 5872 5870 if (unlikely(!phba->vpi_bmask)) { 5873 5871 rc = -ENOMEM; 5874 5872 goto err_exit; 5875 5873 } 5876 - phba->vpi_ids = kzalloc(rsrc_id_cnt * 5877 - sizeof(uint16_t), 5874 + phba->vpi_ids = kcalloc(rsrc_id_cnt, sizeof(uint16_t), 5878 5875 GFP_KERNEL); 5879 5876 if (unlikely(!phba->vpi_ids)) { 5880 5877 kfree(phba->vpi_bmask); ··· 5886 5887 ext_blk_list = &phba->lpfc_vpi_blk_list; 5887 5888 break; 5888 5889 case LPFC_RSC_TYPE_FCOE_XRI: 5889 - phba->sli4_hba.xri_bmask = kzalloc(longs * 5890 + phba->sli4_hba.xri_bmask = kcalloc(longs, 5890 5891 sizeof(unsigned long), 5891 5892 GFP_KERNEL); 5892 5893 if (unlikely(!phba->sli4_hba.xri_bmask)) { ··· 5894 5895 goto err_exit; 5895 5896 } 5896 5897 phba->sli4_hba.max_cfg_param.xri_used = 0; 5897 - phba->sli4_hba.xri_ids = kzalloc(rsrc_id_cnt * 5898 + phba->sli4_hba.xri_ids = kcalloc(rsrc_id_cnt, 5898 5899 sizeof(uint16_t), 5899 5900 GFP_KERNEL); 5900 5901 if (unlikely(!phba->sli4_hba.xri_ids)) { ··· 5909 5910 ext_blk_list = &phba->sli4_hba.lpfc_xri_blk_list; 5910 5911 break; 5911 5912 case LPFC_RSC_TYPE_FCOE_VFI: 5912 - phba->sli4_hba.vfi_bmask = kzalloc(longs * 5913 + phba->sli4_hba.vfi_bmask = kcalloc(longs, 5913 5914 sizeof(unsigned long), 5914 5915 GFP_KERNEL); 5915 5916 if (unlikely(!phba->sli4_hba.vfi_bmask)) { 5916 5917 rc = -ENOMEM; 5917 5918 goto err_exit; 5918 5919 } 5919 - phba->sli4_hba.vfi_ids = kzalloc(rsrc_id_cnt * 5920 + phba->sli4_hba.vfi_ids = kcalloc(rsrc_id_cnt, 5920 5921 sizeof(uint16_t), 5921 5922 GFP_KERNEL); 5922 5923 if (unlikely(!phba->sli4_hba.vfi_ids)) { ··· 6249 6250 } 6250 6251 base = phba->sli4_hba.max_cfg_param.rpi_base; 6251 6252 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; 6252 - phba->sli4_hba.rpi_bmask = kzalloc(longs * 6253 + phba->sli4_hba.rpi_bmask = kcalloc(longs, 6253 6254 sizeof(unsigned long), 6254 6255 GFP_KERNEL); 6255 6256 if (unlikely(!phba->sli4_hba.rpi_bmask)) { 6256 6257 rc = -ENOMEM; 6257 6258 goto err_exit; 6258 6259 } 6259 - phba->sli4_hba.rpi_ids = kzalloc(count * 6260 - sizeof(uint16_t), 6260 + phba->sli4_hba.rpi_ids = kcalloc(count, sizeof(uint16_t), 6261 6261 GFP_KERNEL); 6262 6262 if (unlikely(!phba->sli4_hba.rpi_ids)) { 6263 6263 rc = -ENOMEM; ··· 6277 6279 } 6278 6280 base = phba->sli4_hba.max_cfg_param.vpi_base; 6279 6281 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; 6280 - phba->vpi_bmask = kzalloc(longs * 6281 - sizeof(unsigned long), 6282 + phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long), 6282 6283 GFP_KERNEL); 6283 6284 if (unlikely(!phba->vpi_bmask)) { 6284 6285 rc = -ENOMEM; 6285 6286 goto free_rpi_ids; 6286 6287 } 6287 - phba->vpi_ids = kzalloc(count * 6288 - sizeof(uint16_t), 6288 + phba->vpi_ids = kcalloc(count, sizeof(uint16_t), 6289 6289 GFP_KERNEL); 6290 6290 if (unlikely(!phba->vpi_ids)) { 6291 6291 rc = -ENOMEM; ··· 6304 6308 } 6305 6309 base = phba->sli4_hba.max_cfg_param.xri_base; 6306 6310 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; 6307 - phba->sli4_hba.xri_bmask = kzalloc(longs * 6311 + phba->sli4_hba.xri_bmask = kcalloc(longs, 6308 6312 sizeof(unsigned long), 6309 6313 GFP_KERNEL); 6310 6314 if (unlikely(!phba->sli4_hba.xri_bmask)) { ··· 6312 6316 goto free_vpi_ids; 6313 6317 } 6314 6318 phba->sli4_hba.max_cfg_param.xri_used = 0; 6315 - phba->sli4_hba.xri_ids = kzalloc(count * 6316 - sizeof(uint16_t), 6319 + phba->sli4_hba.xri_ids = kcalloc(count, sizeof(uint16_t), 6317 6320 GFP_KERNEL); 6318 6321 if (unlikely(!phba->sli4_hba.xri_ids)) { 6319 6322 rc = -ENOMEM; ··· 6333 6338 } 6334 6339 base = phba->sli4_hba.max_cfg_param.vfi_base; 6335 6340 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; 6336 - phba->sli4_hba.vfi_bmask = kzalloc(longs * 6341 + phba->sli4_hba.vfi_bmask = kcalloc(longs, 6337 6342 sizeof(unsigned long), 6338 6343 GFP_KERNEL); 6339 6344 if (unlikely(!phba->sli4_hba.vfi_bmask)) { 6340 6345 rc = -ENOMEM; 6341 6346 goto free_xri_ids; 6342 6347 } 6343 - phba->sli4_hba.vfi_ids = kzalloc(count * 6344 - sizeof(uint16_t), 6348 + phba->sli4_hba.vfi_ids = kcalloc(count, sizeof(uint16_t), 6345 6349 GFP_KERNEL); 6346 6350 if (unlikely(!phba->sli4_hba.vfi_ids)) { 6347 6351 rc = -ENOMEM;
+1 -1
drivers/scsi/lpfc/lpfc_vport.c
··· 840 840 struct lpfc_vport *port_iterator; 841 841 struct lpfc_vport **vports; 842 842 int index = 0; 843 - vports = kzalloc((phba->max_vports + 1) * sizeof(struct lpfc_vport *), 843 + vports = kcalloc(phba->max_vports + 1, sizeof(struct lpfc_vport *), 844 844 GFP_KERNEL); 845 845 if (vports == NULL) 846 846 return NULL;
+4 -4
drivers/scsi/megaraid/megaraid_sas_base.c
··· 5419 5419 /* stream detection initialization */ 5420 5420 if (instance->adapter_type == VENTURA_SERIES) { 5421 5421 fusion->stream_detect_by_ld = 5422 - kzalloc(sizeof(struct LD_STREAM_DETECT *) 5423 - * MAX_LOGICAL_DRIVES_EXT, 5424 - GFP_KERNEL); 5422 + kcalloc(MAX_LOGICAL_DRIVES_EXT, 5423 + sizeof(struct LD_STREAM_DETECT *), 5424 + GFP_KERNEL); 5425 5425 if (!fusion->stream_detect_by_ld) { 5426 5426 dev_err(&instance->pdev->dev, 5427 5427 "unable to allocate stream detection for pool of LDs\n"); ··· 6139 6139 */ 6140 6140 static int megasas_alloc_ctrl_mem(struct megasas_instance *instance) 6141 6141 { 6142 - instance->reply_map = kzalloc(sizeof(unsigned int) * nr_cpu_ids, 6142 + instance->reply_map = kcalloc(nr_cpu_ids, sizeof(unsigned int), 6143 6143 GFP_KERNEL); 6144 6144 if (!instance->reply_map) 6145 6145 return -ENOMEM;
+1 -1
drivers/scsi/megaraid/megaraid_sas_fusion.c
··· 487 487 * commands. 488 488 */ 489 489 fusion->cmd_list = 490 - kzalloc(sizeof(struct megasas_cmd_fusion *) * max_mpt_cmd, 490 + kcalloc(max_mpt_cmd, sizeof(struct megasas_cmd_fusion *), 491 491 GFP_KERNEL); 492 492 if (!fusion->cmd_list) { 493 493 dev_err(&instance->pdev->dev,
+1 -1
drivers/scsi/osst.c
··· 381 381 struct scatterlist *sg, *sgl = (struct scatterlist *)buffer; 382 382 int i; 383 383 384 - pages = kzalloc(use_sg * sizeof(struct page *), GFP_KERNEL); 384 + pages = kcalloc(use_sg, sizeof(struct page *), GFP_KERNEL); 385 385 if (!pages) 386 386 goto free_req; 387 387
+1 -1
drivers/scsi/pm8001/pm8001_ctl.c
··· 705 705 return -EINPROGRESS; 706 706 pm8001_ha->fw_status = FLASH_IN_PROGRESS; 707 707 708 - cmd_ptr = kzalloc(count*2, GFP_KERNEL); 708 + cmd_ptr = kcalloc(count, 2, GFP_KERNEL); 709 709 if (!cmd_ptr) { 710 710 pm8001_ha->fw_status = FAIL_OUT_MEMORY; 711 711 return -ENOMEM;
+3 -2
drivers/scsi/pmcraid.c
··· 4873 4873 int i; 4874 4874 4875 4875 pinstance->res_entries = 4876 - kzalloc(sizeof(struct pmcraid_resource_entry) * 4877 - PMCRAID_MAX_RESOURCES, GFP_KERNEL); 4876 + kcalloc(PMCRAID_MAX_RESOURCES, 4877 + sizeof(struct pmcraid_resource_entry), 4878 + GFP_KERNEL); 4878 4879 4879 4880 if (NULL == pinstance->res_entries) { 4880 4881 pmcraid_err("failed to allocate memory for resource table\n");
+1 -1
drivers/scsi/qedi/qedi_main.c
··· 524 524 id_tbl->max = size; 525 525 id_tbl->next = next; 526 526 spin_lock_init(&id_tbl->lock); 527 - id_tbl->table = kzalloc(DIV_ROUND_UP(size, 32) * 4, GFP_KERNEL); 527 + id_tbl->table = kcalloc(DIV_ROUND_UP(size, 32), 4, GFP_KERNEL); 528 528 if (!id_tbl->table) 529 529 return -ENOMEM; 530 530
+6 -4
drivers/scsi/qla2xxx/qla_init.c
··· 3089 3089 req->num_outstanding_cmds = ha->cur_fw_iocb_count; 3090 3090 } 3091 3091 3092 - req->outstanding_cmds = kzalloc(sizeof(srb_t *) * 3093 - req->num_outstanding_cmds, GFP_KERNEL); 3092 + req->outstanding_cmds = kcalloc(req->num_outstanding_cmds, 3093 + sizeof(srb_t *), 3094 + GFP_KERNEL); 3094 3095 3095 3096 if (!req->outstanding_cmds) { 3096 3097 /* ··· 3099 3098 * initialization. 3100 3099 */ 3101 3100 req->num_outstanding_cmds = MIN_OUTSTANDING_COMMANDS; 3102 - req->outstanding_cmds = kzalloc(sizeof(srb_t *) * 3103 - req->num_outstanding_cmds, GFP_KERNEL); 3101 + req->outstanding_cmds = kcalloc(req->num_outstanding_cmds, 3102 + sizeof(srb_t *), 3103 + GFP_KERNEL); 3104 3104 3105 3105 if (!req->outstanding_cmds) { 3106 3106 ql_log(ql_log_fatal, NULL, 0x0126,
+3 -2
drivers/scsi/qla2xxx/qla_isr.c
··· 3434 3434 "Adjusted Max no of queues pairs: %d.\n", ha->max_qpairs); 3435 3435 } 3436 3436 } 3437 - ha->msix_entries = kzalloc(sizeof(struct qla_msix_entry) * 3438 - ha->msix_count, GFP_KERNEL); 3437 + ha->msix_entries = kcalloc(ha->msix_count, 3438 + sizeof(struct qla_msix_entry), 3439 + GFP_KERNEL); 3439 3440 if (!ha->msix_entries) { 3440 3441 ql_log(ql_log_fatal, vha, 0x00c8, 3441 3442 "Failed to allocate memory for ha->msix_entries.\n");
+8 -6
drivers/scsi/qla2xxx/qla_os.c
··· 410 410 struct rsp_que *rsp) 411 411 { 412 412 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); 413 - ha->req_q_map = kzalloc(sizeof(struct req_que *) * ha->max_req_queues, 413 + ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *), 414 414 GFP_KERNEL); 415 415 if (!ha->req_q_map) { 416 416 ql_log(ql_log_fatal, vha, 0x003b, ··· 418 418 goto fail_req_map; 419 419 } 420 420 421 - ha->rsp_q_map = kzalloc(sizeof(struct rsp_que *) * ha->max_rsp_queues, 421 + ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *), 422 422 GFP_KERNEL); 423 423 if (!ha->rsp_q_map) { 424 424 ql_log(ql_log_fatal, vha, 0x003c, ··· 4045 4045 (*rsp)->ring); 4046 4046 /* Allocate memory for NVRAM data for vports */ 4047 4047 if (ha->nvram_npiv_size) { 4048 - ha->npiv_info = kzalloc(sizeof(struct qla_npiv_entry) * 4049 - ha->nvram_npiv_size, GFP_KERNEL); 4048 + ha->npiv_info = kcalloc(ha->nvram_npiv_size, 4049 + sizeof(struct qla_npiv_entry), 4050 + GFP_KERNEL); 4050 4051 if (!ha->npiv_info) { 4051 4052 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, 4052 4053 "Failed to allocate memory for npiv_info.\n"); ··· 4081 4080 INIT_LIST_HEAD(&ha->vp_list); 4082 4081 4083 4082 /* Allocate memory for our loop_id bitmap */ 4084 - ha->loop_id_map = kzalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE) * sizeof(long), 4085 - GFP_KERNEL); 4083 + ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE), 4084 + sizeof(long), 4085 + GFP_KERNEL); 4086 4086 if (!ha->loop_id_map) 4087 4087 goto fail_loop_id_map; 4088 4088 else {
+6 -4
drivers/scsi/qla2xxx/qla_target.c
··· 6248 6248 return -ENOMEM; 6249 6249 } 6250 6250 6251 - tgt->qphints = kzalloc((ha->max_qpairs + 1) * 6252 - sizeof(struct qla_qpair_hint), GFP_KERNEL); 6251 + tgt->qphints = kcalloc(ha->max_qpairs + 1, 6252 + sizeof(struct qla_qpair_hint), 6253 + GFP_KERNEL); 6253 6254 if (!tgt->qphints) { 6254 6255 kfree(tgt); 6255 6256 ql_log(ql_log_warn, base_vha, 0x0197, ··· 7090 7089 if (!QLA_TGT_MODE_ENABLED()) 7091 7090 return 0; 7092 7091 7093 - ha->tgt.tgt_vp_map = kzalloc(sizeof(struct qla_tgt_vp_map) * 7094 - MAX_MULTI_ID_FABRIC, GFP_KERNEL); 7092 + ha->tgt.tgt_vp_map = kcalloc(MAX_MULTI_ID_FABRIC, 7093 + sizeof(struct qla_tgt_vp_map), 7094 + GFP_KERNEL); 7095 7095 if (!ha->tgt.tgt_vp_map) 7096 7096 return -ENOMEM; 7097 7097
+1 -1
drivers/scsi/scsi_debug.c
··· 3450 3450 return check_condition_result; 3451 3451 } 3452 3452 dnum = 2 * num; 3453 - arr = kzalloc(dnum * lb_size, GFP_ATOMIC); 3453 + arr = kcalloc(lb_size, dnum, GFP_ATOMIC); 3454 3454 if (NULL == arr) { 3455 3455 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, 3456 3456 INSUFF_RES_ASCQ);
+1 -1
drivers/scsi/ses.c
··· 747 747 buf = NULL; 748 748 } 749 749 page2_not_supported: 750 - scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL); 750 + scomp = kcalloc(components, sizeof(struct ses_component), GFP_KERNEL); 751 751 if (!scomp) 752 752 goto err_free; 753 753
+1 -1
drivers/scsi/sg.c
··· 1045 1045 else { 1046 1046 sg_req_info_t *rinfo; 1047 1047 1048 - rinfo = kzalloc(SZ_SG_REQ_INFO * SG_MAX_QUEUE, 1048 + rinfo = kcalloc(SG_MAX_QUEUE, SZ_SG_REQ_INFO, 1049 1049 GFP_KERNEL); 1050 1050 if (!rinfo) 1051 1051 return -ENOMEM;
+3 -2
drivers/scsi/smartpqi/smartpqi_init.c
··· 4252 4252 struct device *dev; 4253 4253 struct pqi_io_request *io_request; 4254 4254 4255 - ctrl_info->io_request_pool = kzalloc(ctrl_info->max_io_slots * 4256 - sizeof(ctrl_info->io_request_pool[0]), GFP_KERNEL); 4255 + ctrl_info->io_request_pool = 4256 + kcalloc(ctrl_info->max_io_slots, 4257 + sizeof(ctrl_info->io_request_pool[0]), GFP_KERNEL); 4257 4258 4258 4259 if (!ctrl_info->io_request_pool) { 4259 4260 dev_err(&ctrl_info->pci_dev->dev,
+1 -1
drivers/scsi/st.c
··· 3888 3888 tb->dma = need_dma; 3889 3889 tb->buffer_size = 0; 3890 3890 3891 - tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *), 3891 + tb->reserved_pages = kcalloc(max_sg, sizeof(struct page *), 3892 3892 GFP_KERNEL); 3893 3893 if (!tb->reserved_pages) { 3894 3894 kfree(tb);
+1 -1
drivers/sh/clk/cpg.c
··· 249 249 int k; 250 250 251 251 freq_table_size *= (nr_divs + 1); 252 - freq_table = kzalloc(freq_table_size * nr, GFP_KERNEL); 252 + freq_table = kcalloc(nr, freq_table_size, GFP_KERNEL); 253 253 if (!freq_table) { 254 254 pr_err("%s: unable to alloc memory\n", __func__); 255 255 return -ENOMEM;
+5 -5
drivers/sh/intc/core.c
··· 203 203 204 204 if (desc->num_resources) { 205 205 d->nr_windows = desc->num_resources; 206 - d->window = kzalloc(d->nr_windows * sizeof(*d->window), 206 + d->window = kcalloc(d->nr_windows, sizeof(*d->window), 207 207 GFP_NOWAIT); 208 208 if (!d->window) 209 209 goto err1; ··· 230 230 d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0; 231 231 d->nr_reg += hw->subgroups ? hw->nr_subgroups : 0; 232 232 233 - d->reg = kzalloc(d->nr_reg * sizeof(*d->reg), GFP_NOWAIT); 233 + d->reg = kcalloc(d->nr_reg, sizeof(*d->reg), GFP_NOWAIT); 234 234 if (!d->reg) 235 235 goto err2; 236 236 237 237 #ifdef CONFIG_SMP 238 - d->smp = kzalloc(d->nr_reg * sizeof(*d->smp), GFP_NOWAIT); 238 + d->smp = kcalloc(d->nr_reg, sizeof(*d->smp), GFP_NOWAIT); 239 239 if (!d->smp) 240 240 goto err3; 241 241 #endif ··· 253 253 } 254 254 255 255 if (hw->prio_regs) { 256 - d->prio = kzalloc(hw->nr_vectors * sizeof(*d->prio), 256 + d->prio = kcalloc(hw->nr_vectors, sizeof(*d->prio), 257 257 GFP_NOWAIT); 258 258 if (!d->prio) 259 259 goto err4; ··· 269 269 } 270 270 271 271 if (hw->sense_regs) { 272 - d->sense = kzalloc(hw->nr_vectors * sizeof(*d->sense), 272 + d->sense = kcalloc(hw->nr_vectors, sizeof(*d->sense), 273 273 GFP_NOWAIT); 274 274 if (!d->sense) 275 275 goto err5;
+1 -1
drivers/sh/maple/maple.c
··· 161 161 void *sendbuf = NULL; 162 162 163 163 if (length) { 164 - sendbuf = kzalloc(length * 4, GFP_KERNEL); 164 + sendbuf = kcalloc(length, 4, GFP_KERNEL); 165 165 if (!sendbuf) { 166 166 ret = -ENOMEM; 167 167 goto out;
+1 -1
drivers/slimbus/qcom-ctrl.c
··· 540 540 ctrl->tx.sl_sz = SLIM_MSGQ_BUF_LEN; 541 541 ctrl->rx.n = QCOM_RX_MSGS; 542 542 ctrl->rx.sl_sz = SLIM_MSGQ_BUF_LEN; 543 - ctrl->wr_comp = kzalloc(sizeof(struct completion *) * QCOM_TX_MSGS, 543 + ctrl->wr_comp = kcalloc(QCOM_TX_MSGS, sizeof(struct completion *), 544 544 GFP_KERNEL); 545 545 if (!ctrl->wr_comp) 546 546 return -ENOMEM;
+1 -1
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
··· 143 143 if (!max_maps) 144 144 return max_maps; 145 145 146 - *map = kzalloc(max_maps * sizeof(struct pinctrl_map), GFP_KERNEL); 146 + *map = kcalloc(max_maps, sizeof(struct pinctrl_map), GFP_KERNEL); 147 147 if (!*map) 148 148 return -ENOMEM; 149 149
+2 -2
drivers/staging/rtlwifi/efuse.c
··· 237 237 } 238 238 239 239 /* allocate memory for efuse_tbl and efuse_word */ 240 - efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] * 241 - sizeof(u8), GFP_ATOMIC); 240 + efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE], 241 + GFP_ATOMIC); 242 242 if (!efuse_tbl) 243 243 return; 244 244 efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC);
+1 -1
drivers/staging/unisys/visorhba/visorhba_main.c
··· 865 865 if (cmdrsp->scsi.no_disk_result == 0) 866 866 return; 867 867 868 - buf = kzalloc(sizeof(char) * 36, GFP_KERNEL); 868 + buf = kzalloc(36, GFP_KERNEL); 869 869 if (!buf) 870 870 return; 871 871
+1 -1
drivers/target/target_core_transport.c
··· 250 250 { 251 251 int rc; 252 252 253 - se_sess->sess_cmd_map = kzalloc(tag_num * tag_size, 253 + se_sess->sess_cmd_map = kcalloc(tag_size, tag_num, 254 254 GFP_KERNEL | __GFP_NOWARN | __GFP_RETRY_MAYFAIL); 255 255 if (!se_sess->sess_cmd_map) { 256 256 se_sess->sess_cmd_map = vzalloc(tag_num * tag_size);
+3 -2
drivers/target/target_core_user.c
··· 1717 1717 1718 1718 info = &udev->uio_info; 1719 1719 1720 - udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) * 1721 - sizeof(unsigned long), GFP_KERNEL); 1720 + udev->data_bitmap = kcalloc(BITS_TO_LONGS(udev->max_blocks), 1721 + sizeof(unsigned long), 1722 + GFP_KERNEL); 1722 1723 if (!udev->data_bitmap) { 1723 1724 ret = -ENOMEM; 1724 1725 goto err_bitmap_alloc;
+2 -2
drivers/thermal/int340x_thermal/acpi_thermal_rel.c
··· 96 96 } 97 97 98 98 *trt_count = p->package.count; 99 - trts = kzalloc(*trt_count * sizeof(struct trt), GFP_KERNEL); 99 + trts = kcalloc(*trt_count, sizeof(struct trt), GFP_KERNEL); 100 100 if (!trts) { 101 101 result = -ENOMEM; 102 102 goto end; ··· 178 178 179 179 /* ignore p->package.elements[0], as this is _ART Revision field */ 180 180 *art_count = p->package.count - 1; 181 - arts = kzalloc(*art_count * sizeof(struct art), GFP_KERNEL); 181 + arts = kcalloc(*art_count, sizeof(struct art), GFP_KERNEL); 182 182 if (!arts) { 183 183 result = -ENOMEM; 184 184 goto end;
+4 -3
drivers/thermal/int340x_thermal/int340x_thermal_zone.c
··· 239 239 if (ACPI_FAILURE(status)) 240 240 trip_cnt = 0; 241 241 else { 242 - int34x_thermal_zone->aux_trips = kzalloc( 243 - sizeof(*int34x_thermal_zone->aux_trips) * 244 - trip_cnt, GFP_KERNEL); 242 + int34x_thermal_zone->aux_trips = 243 + kcalloc(trip_cnt, 244 + sizeof(*int34x_thermal_zone->aux_trips), 245 + GFP_KERNEL); 245 246 if (!int34x_thermal_zone->aux_trips) { 246 247 ret = -ENOMEM; 247 248 goto err_trip_alloc;
+2 -2
drivers/thermal/of-thermal.c
··· 870 870 if (tz->ntrips == 0) /* must have at least one child */ 871 871 goto finish; 872 872 873 - tz->trips = kzalloc(tz->ntrips * sizeof(*tz->trips), GFP_KERNEL); 873 + tz->trips = kcalloc(tz->ntrips, sizeof(*tz->trips), GFP_KERNEL); 874 874 if (!tz->trips) { 875 875 ret = -ENOMEM; 876 876 goto free_tz; ··· 896 896 if (tz->num_tbps == 0) 897 897 goto finish; 898 898 899 - tz->tbps = kzalloc(tz->num_tbps * sizeof(*tz->tbps), GFP_KERNEL); 899 + tz->tbps = kcalloc(tz->num_tbps, sizeof(*tz->tbps), GFP_KERNEL); 900 900 if (!tz->tbps) { 901 901 ret = -ENOMEM; 902 902 goto free_trips;
+2 -1
drivers/thermal/x86_pkg_temp_thermal.c
··· 516 516 return -ENODEV; 517 517 518 518 max_packages = topology_max_packages(); 519 - packages = kzalloc(max_packages * sizeof(struct pkg_device *), GFP_KERNEL); 519 + packages = kcalloc(max_packages, sizeof(struct pkg_device *), 520 + GFP_KERNEL); 520 521 if (!packages) 521 522 return -ENOMEM; 522 523
+1 -1
drivers/tty/ehv_bytechan.c
··· 754 754 * array, then you can use pointer math (e.g. "bc - bcs") to get its 755 755 * tty index. 756 756 */ 757 - bcs = kzalloc(count * sizeof(struct ehv_bc_data), GFP_KERNEL); 757 + bcs = kcalloc(count, sizeof(struct ehv_bc_data), GFP_KERNEL); 758 758 if (!bcs) 759 759 return -ENOMEM; 760 760
+3 -2
drivers/tty/goldfish.c
··· 245 245 int ret; 246 246 struct tty_driver *tty; 247 247 248 - goldfish_ttys = kzalloc(sizeof(*goldfish_ttys) * 249 - goldfish_tty_line_count, GFP_KERNEL); 248 + goldfish_ttys = kcalloc(goldfish_tty_line_count, 249 + sizeof(*goldfish_ttys), 250 + GFP_KERNEL); 250 251 if (goldfish_ttys == NULL) { 251 252 ret = -ENOMEM; 252 253 goto err_alloc_goldfish_ttys_failed;
+1 -1
drivers/tty/hvc/hvc_iucv.c
··· 1252 1252 if (size > MAX_VMID_FILTER) 1253 1253 return -ENOSPC; 1254 1254 1255 - array = kzalloc(size * 8, GFP_KERNEL); 1255 + array = kcalloc(size, 8, GFP_KERNEL); 1256 1256 if (!array) 1257 1257 return -ENOMEM; 1258 1258
+1 -1
drivers/tty/serial/pch_uart.c
··· 991 991 992 992 priv->tx_dma_use = 1; 993 993 994 - priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC); 994 + priv->sg_tx_p = kcalloc(num, sizeof(struct scatterlist), GFP_ATOMIC); 995 995 if (!priv->sg_tx_p) { 996 996 dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__); 997 997 return 0;
+1 -1
drivers/tty/serial/serial_core.c
··· 2445 2445 * Maybe we should be using a slab cache for this, especially if 2446 2446 * we have a large number of ports to handle. 2447 2447 */ 2448 - drv->state = kzalloc(sizeof(struct uart_state) * drv->nr, GFP_KERNEL); 2448 + drv->state = kcalloc(drv->nr, sizeof(struct uart_state), GFP_KERNEL); 2449 2449 if (!drv->state) 2450 2450 goto out; 2451 2451
+3 -2
drivers/tty/serial/sunsab.c
··· 1125 1125 } 1126 1126 1127 1127 if (num_channels) { 1128 - sunsab_ports = kzalloc(sizeof(struct uart_sunsab_port) * 1129 - num_channels, GFP_KERNEL); 1128 + sunsab_ports = kcalloc(num_channels, 1129 + sizeof(struct uart_sunsab_port), 1130 + GFP_KERNEL); 1130 1131 if (!sunsab_ports) 1131 1132 return -ENOMEM; 1132 1133
+1 -1
drivers/uio/uio_pruss.c
··· 129 129 if (!gdev) 130 130 return -ENOMEM; 131 131 132 - gdev->info = kzalloc(sizeof(*p) * MAX_PRUSS_EVT, GFP_KERNEL); 132 + gdev->info = kcalloc(MAX_PRUSS_EVT, sizeof(*p), GFP_KERNEL); 133 133 if (!gdev->info) { 134 134 kfree(gdev); 135 135 return -ENOMEM;
+1 -1
drivers/usb/core/hub.c
··· 1376 1376 dev_info(hub_dev, "%d port%s detected\n", maxchild, 1377 1377 (maxchild == 1) ? "" : "s"); 1378 1378 1379 - hub->ports = kzalloc(maxchild * sizeof(struct usb_port *), GFP_KERNEL); 1379 + hub->ports = kcalloc(maxchild, sizeof(struct usb_port *), GFP_KERNEL); 1380 1380 if (!hub->ports) { 1381 1381 ret = -ENOMEM; 1382 1382 goto fail;
+6 -5
drivers/usb/dwc2/hcd.c
··· 5079 5079 dev_dbg(hsotg->dev, "hcfg=%08x\n", hcfg); 5080 5080 5081 5081 #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS 5082 - hsotg->frame_num_array = kzalloc(sizeof(*hsotg->frame_num_array) * 5083 - FRAME_NUM_ARRAY_SIZE, GFP_KERNEL); 5082 + hsotg->frame_num_array = kcalloc(FRAME_NUM_ARRAY_SIZE, 5083 + sizeof(*hsotg->frame_num_array), 5084 + GFP_KERNEL); 5084 5085 if (!hsotg->frame_num_array) 5085 5086 goto error1; 5086 - hsotg->last_frame_num_array = kzalloc( 5087 - sizeof(*hsotg->last_frame_num_array) * 5088 - FRAME_NUM_ARRAY_SIZE, GFP_KERNEL); 5087 + hsotg->last_frame_num_array = 5088 + kcalloc(FRAME_NUM_ARRAY_SIZE, 5089 + sizeof(*hsotg->last_frame_num_array), GFP_KERNEL); 5089 5090 if (!hsotg->last_frame_num_array) 5090 5091 goto error1; 5091 5092 #endif
+3 -3
drivers/usb/gadget/udc/bdc/bdc_ep.c
··· 138 138 __func__, ep, num_tabs); 139 139 140 140 /* Allocate memory for table array */ 141 - ep->bd_list.bd_table_array = kzalloc( 142 - num_tabs * sizeof(struct bd_table *), 143 - GFP_ATOMIC); 141 + ep->bd_list.bd_table_array = kcalloc(num_tabs, 142 + sizeof(struct bd_table *), 143 + GFP_ATOMIC); 144 144 if (!ep->bd_list.bd_table_array) 145 145 return -ENOMEM; 146 146
+1 -1
drivers/usb/gadget/udc/fsl_udc_core.c
··· 2246 2246 pdata = dev_get_platdata(&pdev->dev); 2247 2247 udc->phy_mode = pdata->phy_mode; 2248 2248 2249 - udc->eps = kzalloc(sizeof(struct fsl_ep) * udc->max_ep, GFP_KERNEL); 2249 + udc->eps = kcalloc(udc->max_ep, sizeof(struct fsl_ep), GFP_KERNEL); 2250 2250 if (!udc->eps) 2251 2251 return -1; 2252 2252
+3 -2
drivers/usb/host/ehci-sched.c
··· 117 117 if (utt->multi) { 118 118 tt_index = utt->hcpriv; 119 119 if (!tt_index) { /* Create the index array */ 120 - tt_index = kzalloc(utt->hub->maxchild * 121 - sizeof(*tt_index), GFP_ATOMIC); 120 + tt_index = kcalloc(utt->hub->maxchild, 121 + sizeof(*tt_index), 122 + GFP_ATOMIC); 122 123 if (!tt_index) 123 124 return ERR_PTR(-ENOMEM); 124 125 utt->hcpriv = tt_index;
+2 -2
drivers/usb/host/imx21-hcd.c
··· 741 741 if (urb_priv == NULL) 742 742 return -ENOMEM; 743 743 744 - urb_priv->isoc_td = kzalloc( 745 - sizeof(struct td) * urb->number_of_packets, mem_flags); 744 + urb_priv->isoc_td = kcalloc(urb->number_of_packets, sizeof(struct td), 745 + mem_flags); 746 746 if (urb_priv->isoc_td == NULL) { 747 747 ret = -ENOMEM; 748 748 goto alloc_td_failed;
+2 -1
drivers/usb/mon/mon_bin.c
··· 1024 1024 return -EINVAL; 1025 1025 1026 1026 size = CHUNK_ALIGN(arg); 1027 - vec = kzalloc(sizeof(struct mon_pgmap) * (size / CHUNK_SIZE), GFP_KERNEL); 1027 + vec = kcalloc(size / CHUNK_SIZE, sizeof(struct mon_pgmap), 1028 + GFP_KERNEL); 1028 1029 if (vec == NULL) { 1029 1030 ret = -ENOMEM; 1030 1031 break;
+1 -1
drivers/usb/renesas_usbhs/mod_gadget.c
··· 1068 1068 if (!gpriv) 1069 1069 return -ENOMEM; 1070 1070 1071 - uep = kzalloc(sizeof(struct usbhsg_uep) * pipe_size, GFP_KERNEL); 1071 + uep = kcalloc(pipe_size, sizeof(struct usbhsg_uep), GFP_KERNEL); 1072 1072 if (!uep) { 1073 1073 ret = -ENOMEM; 1074 1074 goto usbhs_mod_gadget_probe_err_gpriv;
+2 -1
drivers/usb/renesas_usbhs/pipe.c
··· 803 803 return -EINVAL; 804 804 } 805 805 806 - info->pipe = kzalloc(sizeof(struct usbhs_pipe) * pipe_size, GFP_KERNEL); 806 + info->pipe = kcalloc(pipe_size, sizeof(struct usbhs_pipe), 807 + GFP_KERNEL); 807 808 if (!info->pipe) 808 809 return -ENOMEM; 809 810
+2 -1
drivers/usb/wusbcore/wa-rpipe.c
··· 470 470 int wa_rpipes_create(struct wahc *wa) 471 471 { 472 472 wa->rpipes = le16_to_cpu(wa->wa_descr->wNumRPipes); 473 - wa->rpipe_bm = kzalloc(BITS_TO_LONGS(wa->rpipes)*sizeof(unsigned long), 473 + wa->rpipe_bm = kcalloc(BITS_TO_LONGS(wa->rpipes), 474 + sizeof(unsigned long), 474 475 GFP_KERNEL); 475 476 if (wa->rpipe_bm == NULL) 476 477 return -ENOMEM;
+9 -6
drivers/vhost/scsi.c
··· 1685 1685 for (i = 0; i < VHOST_SCSI_DEFAULT_TAGS; i++) { 1686 1686 tv_cmd = &((struct vhost_scsi_cmd *)se_sess->sess_cmd_map)[i]; 1687 1687 1688 - tv_cmd->tvc_sgl = kzalloc(sizeof(struct scatterlist) * 1689 - VHOST_SCSI_PREALLOC_SGLS, GFP_KERNEL); 1688 + tv_cmd->tvc_sgl = kcalloc(VHOST_SCSI_PREALLOC_SGLS, 1689 + sizeof(struct scatterlist), 1690 + GFP_KERNEL); 1690 1691 if (!tv_cmd->tvc_sgl) { 1691 1692 pr_err("Unable to allocate tv_cmd->tvc_sgl\n"); 1692 1693 goto out; 1693 1694 } 1694 1695 1695 - tv_cmd->tvc_upages = kzalloc(sizeof(struct page *) * 1696 - VHOST_SCSI_PREALLOC_UPAGES, GFP_KERNEL); 1696 + tv_cmd->tvc_upages = kcalloc(VHOST_SCSI_PREALLOC_UPAGES, 1697 + sizeof(struct page *), 1698 + GFP_KERNEL); 1697 1699 if (!tv_cmd->tvc_upages) { 1698 1700 pr_err("Unable to allocate tv_cmd->tvc_upages\n"); 1699 1701 goto out; 1700 1702 } 1701 1703 1702 - tv_cmd->tvc_prot_sgl = kzalloc(sizeof(struct scatterlist) * 1703 - VHOST_SCSI_PREALLOC_PROT_SGLS, GFP_KERNEL); 1704 + tv_cmd->tvc_prot_sgl = kcalloc(VHOST_SCSI_PREALLOC_PROT_SGLS, 1705 + sizeof(struct scatterlist), 1706 + GFP_KERNEL); 1704 1707 if (!tv_cmd->tvc_prot_sgl) { 1705 1708 pr_err("Unable to allocate tv_cmd->tvc_prot_sgl\n"); 1706 1709 goto out;
+1 -1
drivers/video/console/sticore.c
··· 649 649 unsigned char *n, *p, *q; 650 650 int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); 651 651 652 - n = kzalloc(4*size, STI_LOWMEM); 652 + n = kcalloc(4, size, STI_LOWMEM); 653 653 if (!n) 654 654 return NULL; 655 655 p = n + 3;
+1 -1
drivers/video/fbdev/broadsheetfb.c
··· 617 617 int tail_start_addr; 618 618 int start_sector_addr; 619 619 620 - sector_buffer = kzalloc(sizeof(char)*sector_size, GFP_KERNEL); 620 + sector_buffer = kzalloc(sector_size, GFP_KERNEL); 621 621 if (!sector_buffer) 622 622 return -ENOMEM; 623 623
+4 -3
drivers/video/fbdev/core/fbmon.c
··· 620 620 int num = 0, i, first = 1; 621 621 int ver, rev; 622 622 623 - mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); 623 + mode = kcalloc(50, sizeof(struct fb_videomode), GFP_KERNEL); 624 624 if (mode == NULL) 625 625 return NULL; 626 626 ··· 1055 1055 if (!(num + svd_n)) 1056 1056 return; 1057 1057 1058 - m = kzalloc((specs->modedb_len + num + svd_n) * 1059 - sizeof(struct fb_videomode), GFP_KERNEL); 1058 + m = kcalloc(specs->modedb_len + num + svd_n, 1059 + sizeof(struct fb_videomode), 1060 + GFP_KERNEL); 1060 1061 1061 1062 if (!m) 1062 1063 return;
+2 -2
drivers/video/fbdev/mmp/fb/mmpfb.c
··· 493 493 return 0; 494 494 } 495 495 /* put videomode list to info structure */ 496 - videomodes = kzalloc(sizeof(struct fb_videomode) * videomode_num, 497 - GFP_KERNEL); 496 + videomodes = kcalloc(videomode_num, sizeof(struct fb_videomode), 497 + GFP_KERNEL); 498 498 if (!videomodes) { 499 499 dev_err(fbi->dev, "can't malloc video modes\n"); 500 500 return -ENOMEM;
+2 -2
drivers/video/fbdev/omap2/omapfb/dss/manager.c
··· 42 42 43 43 num_managers = dss_feat_get_num_mgrs(); 44 44 45 - managers = kzalloc(sizeof(struct omap_overlay_manager) * num_managers, 46 - GFP_KERNEL); 45 + managers = kcalloc(num_managers, sizeof(struct omap_overlay_manager), 46 + GFP_KERNEL); 47 47 48 48 BUG_ON(managers == NULL); 49 49
+2 -2
drivers/video/fbdev/omap2/omapfb/dss/overlay.c
··· 59 59 60 60 num_overlays = dss_feat_get_num_ovls(); 61 61 62 - overlays = kzalloc(sizeof(struct omap_overlay) * num_overlays, 63 - GFP_KERNEL); 62 + overlays = kcalloc(num_overlays, sizeof(struct omap_overlay), 63 + GFP_KERNEL); 64 64 65 65 BUG_ON(overlays == NULL); 66 66
+4 -3
drivers/video/fbdev/uvesafb.c
··· 486 486 mode++; 487 487 } 488 488 489 - par->vbe_modes = kzalloc(sizeof(struct vbe_mode_ib) * 490 - par->vbe_modes_cnt, GFP_KERNEL); 489 + par->vbe_modes = kcalloc(par->vbe_modes_cnt, 490 + sizeof(struct vbe_mode_ib), 491 + GFP_KERNEL); 491 492 if (!par->vbe_modes) 492 493 return -ENOMEM; 493 494 ··· 859 858 * Convert the modelist into a modedb so that we can use it with 860 859 * fb_find_mode(). 861 860 */ 862 - mode = kzalloc(i * sizeof(*mode), GFP_KERNEL); 861 + mode = kcalloc(i, sizeof(*mode), GFP_KERNEL); 863 862 if (mode) { 864 863 i = 0; 865 864 list_for_each(pos, &info->modelist) {
+3 -2
drivers/video/of_display_timing.c
··· 181 181 goto entryfail; 182 182 } 183 183 184 - disp->timings = kzalloc(sizeof(struct display_timing *) * 185 - disp->num_timings, GFP_KERNEL); 184 + disp->timings = kcalloc(disp->num_timings, 185 + sizeof(struct display_timing *), 186 + GFP_KERNEL); 186 187 if (!disp->timings) { 187 188 pr_err("%pOF: could not allocate timings array\n", np); 188 189 goto entryfail;
+1 -1
drivers/virt/fsl_hypervisor.c
··· 223 223 * 'pages' is an array of struct page pointers that's initialized by 224 224 * get_user_pages(). 225 225 */ 226 - pages = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL); 226 + pages = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL); 227 227 if (!pages) { 228 228 pr_debug("fsl-hv: could not allocate page list\n"); 229 229 return -ENOMEM;
+1 -1
drivers/virtio/virtio_pci_common.c
··· 119 119 if (!vp_dev->msix_names) 120 120 goto error; 121 121 vp_dev->msix_affinity_masks 122 - = kzalloc(nvectors * sizeof *vp_dev->msix_affinity_masks, 122 + = kcalloc(nvectors, sizeof(*vp_dev->msix_affinity_masks), 123 123 GFP_KERNEL); 124 124 if (!vp_dev->msix_affinity_masks) 125 125 goto error;
+3 -3
drivers/xen/arm-device.c
··· 70 70 if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) 71 71 continue; 72 72 73 - gpfns = kzalloc(sizeof(xen_pfn_t) * nr, GFP_KERNEL); 74 - idxs = kzalloc(sizeof(xen_ulong_t) * nr, GFP_KERNEL); 75 - errs = kzalloc(sizeof(int) * nr, GFP_KERNEL); 73 + gpfns = kcalloc(nr, sizeof(xen_pfn_t), GFP_KERNEL); 74 + idxs = kcalloc(nr, sizeof(xen_ulong_t), GFP_KERNEL); 75 + errs = kcalloc(nr, sizeof(int), GFP_KERNEL); 76 76 if (!gpfns || !idxs || !errs) { 77 77 kfree(gpfns); 78 78 kfree(idxs);
+2 -2
fs/btrfs/check-integrity.c
··· 1603 1603 1604 1604 num_pages = (block_ctx->len + (u64)PAGE_SIZE - 1) >> 1605 1605 PAGE_SHIFT; 1606 - block_ctx->mem_to_free = kzalloc((sizeof(*block_ctx->datav) + 1607 - sizeof(*block_ctx->pagev)) * 1606 + block_ctx->mem_to_free = kcalloc(sizeof(*block_ctx->datav) + 1607 + sizeof(*block_ctx->pagev), 1608 1608 num_pages, GFP_NOFS); 1609 1609 if (!block_ctx->mem_to_free) 1610 1610 return -ENOMEM;
+1 -1
fs/cifs/cifssmb.c
··· 2077 2077 cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete) 2078 2078 { 2079 2079 struct page **pages = 2080 - kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS); 2080 + kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS); 2081 2081 if (pages) 2082 2082 return cifs_writedata_direct_alloc(pages, complete); 2083 2083
+1 -1
fs/cifs/file.c
··· 2900 2900 cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete) 2901 2901 { 2902 2902 struct page **pages = 2903 - kzalloc(sizeof(struct page *) * nr_pages, GFP_KERNEL); 2903 + kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); 2904 2904 struct cifs_readdata *ret = NULL; 2905 2905 2906 2906 if (pages) {
+4 -4
fs/ext4/extents.c
··· 577 577 down_read(&ei->i_data_sem); 578 578 depth = ext_depth(inode); 579 579 580 - path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1), 580 + path = kcalloc(depth + 1, sizeof(struct ext4_ext_path), 581 581 GFP_NOFS); 582 582 if (path == NULL) { 583 583 up_read(&ei->i_data_sem); ··· 879 879 } 880 880 if (!path) { 881 881 /* account possible depth increase */ 882 - path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 2), 882 + path = kcalloc(depth + 2, sizeof(struct ext4_ext_path), 883 883 GFP_NOFS); 884 884 if (unlikely(!path)) 885 885 return ERR_PTR(-ENOMEM); ··· 1063 1063 * We need this to handle errors and free blocks 1064 1064 * upon them. 1065 1065 */ 1066 - ablocks = kzalloc(sizeof(ext4_fsblk_t) * depth, GFP_NOFS); 1066 + ablocks = kcalloc(depth, sizeof(ext4_fsblk_t), GFP_NOFS); 1067 1067 if (!ablocks) 1068 1068 return -ENOMEM; 1069 1069 ··· 2921 2921 path[k].p_block = 2922 2922 le16_to_cpu(path[k].p_hdr->eh_entries)+1; 2923 2923 } else { 2924 - path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1), 2924 + path = kcalloc(depth + 1, sizeof(struct ext4_ext_path), 2925 2925 GFP_NOFS); 2926 2926 if (path == NULL) { 2927 2927 ext4_journal_stop(handle);
+1 -1
fs/nfs/flexfilelayout/flexfilelayout.c
··· 461 461 fh_count = be32_to_cpup(p); 462 462 463 463 fls->mirror_array[i]->fh_versions = 464 - kzalloc(fh_count * sizeof(struct nfs_fh), 464 + kcalloc(fh_count, sizeof(struct nfs_fh), 465 465 gfp_flags); 466 466 if (fls->mirror_array[i]->fh_versions == NULL) { 467 467 rc = -ENOMEM;
+2 -1
fs/nfs/flexfilelayout/flexfilelayoutdev.c
··· 99 99 version_count = be32_to_cpup(p); 100 100 dprintk("%s: version count %d\n", __func__, version_count); 101 101 102 - ds_versions = kzalloc(version_count * sizeof(struct nfs4_ff_ds_version), 102 + ds_versions = kcalloc(version_count, 103 + sizeof(struct nfs4_ff_ds_version), 103 104 gfp_flags); 104 105 if (!ds_versions) 105 106 goto out_scratch;
+3 -2
fs/nfsd/export.c
··· 404 404 if (fsloc->locations_count == 0) 405 405 return 0; 406 406 407 - fsloc->locations = kzalloc(fsloc->locations_count 408 - * sizeof(struct nfsd4_fs_location), GFP_KERNEL); 407 + fsloc->locations = kcalloc(fsloc->locations_count, 408 + sizeof(struct nfsd4_fs_location), 409 + GFP_KERNEL); 409 410 if (!fsloc->locations) 410 411 return -ENOMEM; 411 412 for (i=0; i < fsloc->locations_count; i++) {
+1 -1
fs/ocfs2/journal.c
··· 1383 1383 goto bail; 1384 1384 } 1385 1385 1386 - rm_quota = kzalloc(osb->max_slots * sizeof(int), GFP_NOFS); 1386 + rm_quota = kcalloc(osb->max_slots, sizeof(int), GFP_NOFS); 1387 1387 if (!rm_quota) { 1388 1388 status = -ENOMEM; 1389 1389 goto bail;
+5 -4
fs/ocfs2/sysfile.c
··· 69 69 spin_unlock(&osb->osb_lock); 70 70 71 71 if (unlikely(!local_system_inodes)) { 72 - local_system_inodes = kzalloc(sizeof(struct inode *) * 73 - NUM_LOCAL_SYSTEM_INODES * 74 - osb->max_slots, 75 - GFP_NOFS); 72 + local_system_inodes = 73 + kzalloc(array3_size(sizeof(struct inode *), 74 + NUM_LOCAL_SYSTEM_INODES, 75 + osb->max_slots), 76 + GFP_NOFS); 76 77 if (!local_system_inodes) { 77 78 mlog_errno(-ENOMEM); 78 79 /*
+1 -1
fs/overlayfs/namei.c
··· 612 612 { 613 613 char *n, *s; 614 614 615 - n = kzalloc(fh->len * 2, GFP_KERNEL); 615 + n = kcalloc(fh->len, 2, GFP_KERNEL); 616 616 if (!n) 617 617 return -ENOMEM; 618 618
+1 -1
fs/proc/proc_sysctl.c
··· 1426 1426 /* If there are mixed files and directories we need a new table */ 1427 1427 if (nr_dirs && nr_files) { 1428 1428 struct ctl_table *new; 1429 - files = kzalloc(sizeof(struct ctl_table) * (nr_files + 1), 1429 + files = kcalloc(nr_files + 1, sizeof(struct ctl_table), 1430 1430 GFP_KERNEL); 1431 1431 if (!files) 1432 1432 goto out;
+2 -1
fs/reiserfs/inode.c
··· 1044 1044 if (blocks_needed == 1) { 1045 1045 un = &unf_single; 1046 1046 } else { 1047 - un = kzalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_NOFS); 1047 + un = kcalloc(min(blocks_needed, max_to_insert), 1048 + UNFM_P_SIZE, GFP_NOFS); 1048 1049 if (!un) { 1049 1050 un = &unf_single; 1050 1051 blocks_needed = 1;
+4 -3
fs/udf/super.c
··· 1585 1585 struct udf_vds_record *new_loc; 1586 1586 unsigned int new_size = ALIGN(partnum, PART_DESC_ALLOC_STEP); 1587 1587 1588 - new_loc = kzalloc(sizeof(*new_loc) * new_size, GFP_KERNEL); 1588 + new_loc = kcalloc(new_size, sizeof(*new_loc), GFP_KERNEL); 1589 1589 if (!new_loc) 1590 1590 return ERR_PTR(-ENOMEM); 1591 1591 memcpy(new_loc, data->part_descs_loc, ··· 1644 1644 1645 1645 memset(data.vds, 0, sizeof(struct udf_vds_record) * VDS_POS_LENGTH); 1646 1646 data.size_part_descs = PART_DESC_ALLOC_STEP; 1647 - data.part_descs_loc = kzalloc(sizeof(*data.part_descs_loc) * 1648 - data.size_part_descs, GFP_KERNEL); 1647 + data.part_descs_loc = kcalloc(data.size_part_descs, 1648 + sizeof(*data.part_descs_loc), 1649 + GFP_KERNEL); 1649 1650 if (!data.part_descs_loc) 1650 1651 return -ENOMEM; 1651 1652
+1 -1
kernel/bpf/verifier.c
··· 5447 5447 insn->imm = 1; 5448 5448 } 5449 5449 5450 - func = kzalloc(sizeof(prog) * env->subprog_cnt, GFP_KERNEL); 5450 + func = kcalloc(env->subprog_cnt, sizeof(prog), GFP_KERNEL); 5451 5451 if (!func) 5452 5452 return -ENOMEM; 5453 5453
+1 -1
kernel/debug/kdb/kdb_main.c
··· 691 691 } 692 692 if (!s->usable) 693 693 return KDB_NOTIMP; 694 - s->command = kzalloc((s->count + 1) * sizeof(*(s->command)), GFP_KDB); 694 + s->command = kcalloc(s->count + 1, sizeof(*(s->command)), GFP_KDB); 695 695 if (!s->command) { 696 696 kdb_printf("Could not allocate new kdb_defcmd table for %s\n", 697 697 cmdstr);
+2 -1
kernel/events/uprobes.c
··· 1184 1184 if (unlikely(!area)) 1185 1185 goto out; 1186 1186 1187 - area->bitmap = kzalloc(BITS_TO_LONGS(UINSNS_PER_PAGE) * sizeof(long), GFP_KERNEL); 1187 + area->bitmap = kcalloc(BITS_TO_LONGS(UINSNS_PER_PAGE), sizeof(long), 1188 + GFP_KERNEL); 1188 1189 if (!area->bitmap) 1189 1190 goto free_area; 1190 1191
+4 -2
kernel/locking/locktorture.c
··· 989 989 } 990 990 991 991 if (nwriters_stress) { 992 - writer_tasks = kzalloc(cxt.nrealwriters_stress * sizeof(writer_tasks[0]), 992 + writer_tasks = kcalloc(cxt.nrealwriters_stress, 993 + sizeof(writer_tasks[0]), 993 994 GFP_KERNEL); 994 995 if (writer_tasks == NULL) { 995 996 VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory"); ··· 1000 999 } 1001 1000 1002 1001 if (cxt.cur_ops->readlock) { 1003 - reader_tasks = kzalloc(cxt.nrealreaders_stress * sizeof(reader_tasks[0]), 1002 + reader_tasks = kcalloc(cxt.nrealreaders_stress, 1003 + sizeof(reader_tasks[0]), 1004 1004 GFP_KERNEL); 1005 1005 if (reader_tasks == NULL) { 1006 1006 VERBOSE_TOROUT_ERRSTRING("reader_tasks: Out of memory");
+2 -2
kernel/sched/fair.c
··· 10215 10215 struct cfs_rq *cfs_rq; 10216 10216 int i; 10217 10217 10218 - tg->cfs_rq = kzalloc(sizeof(cfs_rq) * nr_cpu_ids, GFP_KERNEL); 10218 + tg->cfs_rq = kcalloc(nr_cpu_ids, sizeof(cfs_rq), GFP_KERNEL); 10219 10219 if (!tg->cfs_rq) 10220 10220 goto err; 10221 - tg->se = kzalloc(sizeof(se) * nr_cpu_ids, GFP_KERNEL); 10221 + tg->se = kcalloc(nr_cpu_ids, sizeof(se), GFP_KERNEL); 10222 10222 if (!tg->se) 10223 10223 goto err; 10224 10224
+2 -2
kernel/sched/rt.c
··· 183 183 struct sched_rt_entity *rt_se; 184 184 int i; 185 185 186 - tg->rt_rq = kzalloc(sizeof(rt_rq) * nr_cpu_ids, GFP_KERNEL); 186 + tg->rt_rq = kcalloc(nr_cpu_ids, sizeof(rt_rq), GFP_KERNEL); 187 187 if (!tg->rt_rq) 188 188 goto err; 189 - tg->rt_se = kzalloc(sizeof(rt_se) * nr_cpu_ids, GFP_KERNEL); 189 + tg->rt_se = kcalloc(nr_cpu_ids, sizeof(rt_se), GFP_KERNEL); 190 190 if (!tg->rt_se) 191 191 goto err; 192 192
+2 -1
kernel/sysctl.c
··· 3047 3047 if (IS_ERR(kbuf)) 3048 3048 return PTR_ERR(kbuf); 3049 3049 3050 - tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long), 3050 + tmp_bitmap = kcalloc(BITS_TO_LONGS(bitmap_len), 3051 + sizeof(unsigned long), 3051 3052 GFP_KERNEL); 3052 3053 if (!tmp_bitmap) { 3053 3054 kfree(kbuf);
+1 -1
kernel/trace/ftrace.c
··· 728 728 */ 729 729 size = FTRACE_PROFILE_HASH_SIZE; 730 730 731 - stat->hash = kzalloc(sizeof(struct hlist_head) * size, GFP_KERNEL); 731 + stat->hash = kcalloc(size, sizeof(struct hlist_head), GFP_KERNEL); 732 732 733 733 if (!stat->hash) 734 734 return -ENOMEM;
+2 -1
kernel/trace/trace.c
··· 4361 4361 4362 4362 if (mask == TRACE_ITER_RECORD_TGID) { 4363 4363 if (!tgid_map) 4364 - tgid_map = kzalloc((PID_MAX_DEFAULT + 1) * sizeof(*tgid_map), 4364 + tgid_map = kcalloc(PID_MAX_DEFAULT + 1, 4365 + sizeof(*tgid_map), 4365 4366 GFP_KERNEL); 4366 4367 if (!tgid_map) { 4367 4368 tr->trace_flags &= ~TRACE_ITER_RECORD_TGID;
+1 -1
kernel/workqueue.c
··· 5638 5638 * available. Build one from cpu_to_node() which should have been 5639 5639 * fully initialized by now. 5640 5640 */ 5641 - tbl = kzalloc(nr_node_ids * sizeof(tbl[0]), GFP_KERNEL); 5641 + tbl = kcalloc(nr_node_ids, sizeof(tbl[0]), GFP_KERNEL); 5642 5642 BUG_ON(!tbl); 5643 5643 5644 5644 for_each_node(node)
+1 -1
lib/lru_cache.c
··· 119 119 slot = kcalloc(e_count, sizeof(struct hlist_head), GFP_KERNEL); 120 120 if (!slot) 121 121 goto out_fail; 122 - element = kzalloc(e_count * sizeof(struct lc_element *), GFP_KERNEL); 122 + element = kcalloc(e_count, sizeof(struct lc_element *), GFP_KERNEL); 123 123 if (!element) 124 124 goto out_fail; 125 125
+1 -1
lib/mpi/mpiutil.c
··· 98 98 kzfree(a->d); 99 99 a->d = p; 100 100 } else { 101 - a->d = kzalloc(nlimbs * sizeof(mpi_limb_t), GFP_KERNEL); 101 + a->d = kcalloc(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL); 102 102 if (!a->d) 103 103 return -ENOMEM; 104 104 }
+2 -1
mm/slab.c
··· 4338 4338 if (x[0] == x[1]) { 4339 4339 /* Increase the buffer size */ 4340 4340 mutex_unlock(&slab_mutex); 4341 - m->private = kzalloc(x[0] * 4 * sizeof(unsigned long), GFP_KERNEL); 4341 + m->private = kcalloc(x[0] * 4, sizeof(unsigned long), 4342 + GFP_KERNEL); 4342 4343 if (!m->private) { 4343 4344 /* Too bad, we are really out */ 4344 4345 m->private = x;
+4 -3
mm/slub.c
··· 3623 3623 #ifdef CONFIG_SLUB_DEBUG 3624 3624 void *addr = page_address(page); 3625 3625 void *p; 3626 - unsigned long *map = kzalloc(BITS_TO_LONGS(page->objects) * 3627 - sizeof(long), GFP_ATOMIC); 3626 + unsigned long *map = kcalloc(BITS_TO_LONGS(page->objects), 3627 + sizeof(long), 3628 + GFP_ATOMIC); 3628 3629 if (!map) 3629 3630 return; 3630 3631 slab_err(s, page, text, s->name); ··· 4753 4752 int x; 4754 4753 unsigned long *nodes; 4755 4754 4756 - nodes = kzalloc(sizeof(unsigned long) * nr_node_ids, GFP_KERNEL); 4755 + nodes = kcalloc(nr_node_ids, sizeof(unsigned long), GFP_KERNEL); 4757 4756 if (!nodes) 4758 4757 return -ENOMEM; 4759 4758
+1 -1
net/bridge/br_multicast.c
··· 333 333 mdb->max = max; 334 334 mdb->old = old; 335 335 336 - mdb->mhash = kzalloc(max * sizeof(*mdb->mhash), GFP_ATOMIC); 336 + mdb->mhash = kcalloc(max, sizeof(*mdb->mhash), GFP_ATOMIC); 337 337 if (!mdb->mhash) { 338 338 kfree(mdb); 339 339 return -ENOMEM;
+2 -1
net/can/bcm.c
··· 1105 1105 } 1106 1106 1107 1107 /* create and init array for received CAN frames */ 1108 - op->last_frames = kzalloc(msg_head->nframes * op->cfsiz, 1108 + op->last_frames = kcalloc(msg_head->nframes, 1109 + op->cfsiz, 1109 1110 GFP_KERNEL); 1110 1111 if (!op->last_frames) { 1111 1112 kfree(op->frames);
+2 -2
net/core/ethtool.c
··· 911 911 memset(&info, 0, sizeof(info)); 912 912 info.cmd = ETHTOOL_GSSET_INFO; 913 913 914 - info_buf = kzalloc(n_bits * sizeof(u32), GFP_USER); 914 + info_buf = kcalloc(n_bits, sizeof(u32), GFP_USER); 915 915 if (!info_buf) 916 916 return -ENOMEM; 917 917 ··· 1017 1017 if (info.cmd == ETHTOOL_GRXCLSRLALL) { 1018 1018 if (info.rule_cnt > 0) { 1019 1019 if (info.rule_cnt <= KMALLOC_MAX_SIZE / sizeof(u32)) 1020 - rule_buf = kzalloc(info.rule_cnt * sizeof(u32), 1020 + rule_buf = kcalloc(info.rule_cnt, sizeof(u32), 1021 1021 GFP_USER); 1022 1022 if (!rule_buf) 1023 1023 return -ENOMEM;
+1 -1
net/ieee802154/nl-phy.c
··· 38 38 { 39 39 void *hdr; 40 40 int i, pages = 0; 41 - uint32_t *buf = kzalloc(32 * sizeof(uint32_t), GFP_KERNEL); 41 + uint32_t *buf = kcalloc(32, sizeof(uint32_t), GFP_KERNEL); 42 42 43 43 pr_debug("%s\n", __func__); 44 44
+1 -1
net/ipv4/fib_frontend.c
··· 567 567 struct nlattr *mx; 568 568 int len = 0; 569 569 570 - mx = kzalloc(3 * nla_total_size(4), GFP_KERNEL); 570 + mx = kcalloc(3, nla_total_size(4), GFP_KERNEL); 571 571 if (!mx) 572 572 return -ENOMEM; 573 573
+1 -1
net/ipv4/route.c
··· 649 649 650 650 hash = rcu_dereference(nh->nh_exceptions); 651 651 if (!hash) { 652 - hash = kzalloc(FNHE_HASH_SIZE * sizeof(*hash), GFP_ATOMIC); 652 + hash = kcalloc(FNHE_HASH_SIZE, sizeof(*hash), GFP_ATOMIC); 653 653 if (!hash) 654 654 goto out_unlock; 655 655 rcu_assign_pointer(nh->nh_exceptions, hash);
+1 -1
net/ipv6/icmp.c
··· 956 956 int err, i, j; 957 957 958 958 net->ipv6.icmp_sk = 959 - kzalloc(nr_cpu_ids * sizeof(struct sock *), GFP_KERNEL); 959 + kcalloc(nr_cpu_ids, sizeof(struct sock *), GFP_KERNEL); 960 960 if (!net->ipv6.icmp_sk) 961 961 return -ENOMEM; 962 962
+1 -1
net/mac80211/chan.c
··· 1186 1186 lockdep_assert_held(&local->mtx); 1187 1187 lockdep_assert_held(&local->chanctx_mtx); 1188 1188 1189 - vif_chsw = kzalloc(sizeof(vif_chsw[0]) * n_vifs, GFP_KERNEL); 1189 + vif_chsw = kcalloc(n_vifs, sizeof(vif_chsw[0]), GFP_KERNEL); 1190 1190 if (!vif_chsw) 1191 1191 return -ENOMEM; 1192 1192
+1 -1
net/mac80211/rc80211_minstrel.c
··· 592 592 max_rates = sband->n_bitrates; 593 593 } 594 594 595 - mi->r = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp); 595 + mi->r = kcalloc(max_rates, sizeof(struct minstrel_rate), gfp); 596 596 if (!mi->r) 597 597 goto error; 598 598
+1 -1
net/mac80211/rc80211_minstrel_ht.c
··· 1313 1313 if (!msp) 1314 1314 return NULL; 1315 1315 1316 - msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp); 1316 + msp->ratelist = kcalloc(max_rates, sizeof(struct minstrel_rate), gfp); 1317 1317 if (!msp->ratelist) 1318 1318 goto error; 1319 1319
+1 -1
net/mac80211/scan.c
··· 1157 1157 } 1158 1158 } 1159 1159 1160 - ie = kzalloc(num_bands * iebufsz, GFP_KERNEL); 1160 + ie = kcalloc(iebufsz, num_bands, GFP_KERNEL); 1161 1161 if (!ie) { 1162 1162 ret = -ENOMEM; 1163 1163 goto out;
+3 -2
net/mac80211/util.c
··· 1803 1803 if (WARN_ON(res)) 1804 1804 return res; 1805 1805 1806 - funcs = kzalloc((sdata->local->hw.max_nan_de_entries + 1) * 1807 - sizeof(*funcs), GFP_KERNEL); 1806 + funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1, 1807 + sizeof(*funcs), 1808 + GFP_KERNEL); 1808 1809 if (!funcs) 1809 1810 return -ENOMEM; 1810 1811
+1 -1
net/netfilter/nf_tables_api.c
··· 5303 5303 if (err < 0) 5304 5304 return err; 5305 5305 5306 - ops = kzalloc(sizeof(struct nf_hook_ops) * n, GFP_KERNEL); 5306 + ops = kcalloc(n, sizeof(struct nf_hook_ops), GFP_KERNEL); 5307 5307 if (!ops) 5308 5308 return -ENOMEM; 5309 5309
+1 -1
net/netrom/af_netrom.c
··· 1395 1395 return -1; 1396 1396 } 1397 1397 1398 - dev_nr = kzalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL); 1398 + dev_nr = kcalloc(nr_ndevs, sizeof(struct net_device *), GFP_KERNEL); 1399 1399 if (dev_nr == NULL) { 1400 1400 printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n"); 1401 1401 return -1;
+1 -1
net/openvswitch/vport.c
··· 47 47 */ 48 48 int ovs_vport_init(void) 49 49 { 50 - dev_table = kzalloc(VPORT_HASH_BUCKETS * sizeof(struct hlist_head), 50 + dev_table = kcalloc(VPORT_HASH_BUCKETS, sizeof(struct hlist_head), 51 51 GFP_KERNEL); 52 52 if (!dev_table) 53 53 return -ENOMEM;
+2 -1
net/rds/ib.c
··· 163 163 rds_ibdev->max_initiator_depth = device->attrs.max_qp_init_rd_atom; 164 164 rds_ibdev->max_responder_resources = device->attrs.max_qp_rd_atom; 165 165 166 - rds_ibdev->vector_load = kzalloc(sizeof(int) * device->num_comp_vectors, 166 + rds_ibdev->vector_load = kcalloc(device->num_comp_vectors, 167 + sizeof(int), 167 168 GFP_KERNEL); 168 169 if (!rds_ibdev->vector_load) { 169 170 pr_err("RDS/IB: %s failed to allocate vector memory\n",
+2 -1
net/rose/af_rose.c
··· 1514 1514 1515 1515 rose_callsign = null_ax25_address; 1516 1516 1517 - dev_rose = kzalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); 1517 + dev_rose = kcalloc(rose_ndevs, sizeof(struct net_device *), 1518 + GFP_KERNEL); 1518 1519 if (dev_rose == NULL) { 1519 1520 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); 1520 1521 rc = -ENOMEM;
+3 -2
net/sctp/auth.c
··· 482 482 return 0; 483 483 484 484 /* Allocated the array of pointers to transorms */ 485 - ep->auth_hmacs = kzalloc(sizeof(struct crypto_shash *) * 486 - SCTP_AUTH_NUM_HMACS, gfp); 485 + ep->auth_hmacs = kcalloc(SCTP_AUTH_NUM_HMACS, 486 + sizeof(struct crypto_shash *), 487 + gfp); 487 488 if (!ep->auth_hmacs) 488 489 return -ENOMEM; 489 490
+3 -3
net/smc/smc_wr.c
··· 584 584 GFP_KERNEL); 585 585 if (!link->wr_rx_sges) 586 586 goto no_mem_wr_tx_sges; 587 - link->wr_tx_mask = kzalloc( 588 - BITS_TO_LONGS(SMC_WR_BUF_CNT) * sizeof(*link->wr_tx_mask), 589 - GFP_KERNEL); 587 + link->wr_tx_mask = kcalloc(BITS_TO_LONGS(SMC_WR_BUF_CNT), 588 + sizeof(*link->wr_tx_mask), 589 + GFP_KERNEL); 590 590 if (!link->wr_tx_mask) 591 591 goto no_mem_wr_rx_sges; 592 592 link->wr_tx_pends = kcalloc(SMC_WR_BUF_CNT,
+1 -1
net/sunrpc/auth_gss/gss_rpc_upcall.c
··· 224 224 static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg) 225 225 { 226 226 arg->npages = DIV_ROUND_UP(NGROUPS_MAX * 4, PAGE_SIZE); 227 - arg->pages = kzalloc(arg->npages * sizeof(struct page *), GFP_KERNEL); 227 + arg->pages = kcalloc(arg->npages, sizeof(struct page *), GFP_KERNEL); 228 228 /* 229 229 * XXX: actual pages are allocated by xdr layer in 230 230 * xdr_partial_copy_from_skb.
+1 -1
net/sunrpc/cache.c
··· 1683 1683 if (cd == NULL) 1684 1684 return ERR_PTR(-ENOMEM); 1685 1685 1686 - cd->hash_table = kzalloc(cd->hash_size * sizeof(struct hlist_head), 1686 + cd->hash_table = kcalloc(cd->hash_size, sizeof(struct hlist_head), 1687 1687 GFP_KERNEL); 1688 1688 if (cd->hash_table == NULL) { 1689 1689 kfree(cd);
+2 -2
net/wireless/nl80211.c
··· 10833 10833 struct nlattr **tb; 10834 10834 int err; 10835 10835 10836 - tb = kzalloc(NUM_NL80211_ATTR * sizeof(*tb), GFP_KERNEL); 10836 + tb = kcalloc(NUM_NL80211_ATTR, sizeof(*tb), GFP_KERNEL); 10837 10837 if (!tb) 10838 10838 return -ENOMEM; 10839 10839 ··· 11793 11793 11794 11794 func->srf_num_macs = n_entries; 11795 11795 func->srf_macs = 11796 - kzalloc(sizeof(*func->srf_macs) * n_entries, 11796 + kcalloc(n_entries, sizeof(*func->srf_macs), 11797 11797 GFP_KERNEL); 11798 11798 if (!func->srf_macs) { 11799 11799 err = -ENOMEM;
+1 -1
security/apparmor/policy_unpack.c
··· 475 475 /* currently 4 exec bits and entries 0-3 are reserved iupcx */ 476 476 if (size > 16 - 4) 477 477 goto fail; 478 - profile->file.trans.table = kzalloc(sizeof(char *) * size, 478 + profile->file.trans.table = kcalloc(size, sizeof(char *), 479 479 GFP_KERNEL); 480 480 if (!profile->file.trans.table) 481 481 goto fail;
+1 -1
security/selinux/ss/services.c
··· 2118 2118 int rc = 0; 2119 2119 struct policy_file file = { data, len }, *fp = &file; 2120 2120 2121 - oldpolicydb = kzalloc(2 * sizeof(*oldpolicydb), GFP_KERNEL); 2121 + oldpolicydb = kcalloc(2, sizeof(*oldpolicydb), GFP_KERNEL); 2122 2122 if (!oldpolicydb) { 2123 2123 rc = -ENOMEM; 2124 2124 goto out;
+1 -1
sound/firewire/fireface/ff-protocol-ff400.c
··· 147 147 __le32 *reg; 148 148 int i; 149 149 150 - reg = kzalloc(sizeof(__le32) * 18, GFP_KERNEL); 150 + reg = kcalloc(18, sizeof(__le32), GFP_KERNEL); 151 151 if (reg == NULL) 152 152 return -ENOMEM; 153 153
+9 -9
sound/pci/ctxfi/ctatc.c
··· 275 275 276 276 /* Get AMIXER resource */ 277 277 n_amixer = (n_amixer < 2) ? 2 : n_amixer; 278 - apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); 278 + apcm->amixers = kcalloc(n_amixer, sizeof(void *), GFP_KERNEL); 279 279 if (!apcm->amixers) { 280 280 err = -ENOMEM; 281 281 goto error1; ··· 543 543 } 544 544 545 545 if (n_srcc) { 546 - apcm->srccs = kzalloc(sizeof(void *)*n_srcc, GFP_KERNEL); 546 + apcm->srccs = kcalloc(n_srcc, sizeof(void *), GFP_KERNEL); 547 547 if (!apcm->srccs) 548 548 return -ENOMEM; 549 549 } 550 550 if (n_amixer) { 551 - apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); 551 + apcm->amixers = kcalloc(n_amixer, sizeof(void *), GFP_KERNEL); 552 552 if (!apcm->amixers) { 553 553 err = -ENOMEM; 554 554 goto error1; 555 555 } 556 556 } 557 - apcm->srcimps = kzalloc(sizeof(void *)*n_srcimp, GFP_KERNEL); 557 + apcm->srcimps = kcalloc(n_srcimp, sizeof(void *), GFP_KERNEL); 558 558 if (!apcm->srcimps) { 559 559 err = -ENOMEM; 560 560 goto error1; ··· 819 819 820 820 /* Get AMIXER resource */ 821 821 n_amixer = (n_amixer < 2) ? 2 : n_amixer; 822 - apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL); 822 + apcm->amixers = kcalloc(n_amixer, sizeof(void *), GFP_KERNEL); 823 823 if (!apcm->amixers) { 824 824 err = -ENOMEM; 825 825 goto error1; ··· 1378 1378 num_daios = ((atc->model == CTSB1270) ? 8 : 7); 1379 1379 num_srcs = ((atc->model == CTSB1270) ? 6 : 4); 1380 1380 1381 - atc->daios = kzalloc(sizeof(void *)*num_daios, GFP_KERNEL); 1381 + atc->daios = kcalloc(num_daios, sizeof(void *), GFP_KERNEL); 1382 1382 if (!atc->daios) 1383 1383 return -ENOMEM; 1384 1384 1385 - atc->srcs = kzalloc(sizeof(void *)*num_srcs, GFP_KERNEL); 1385 + atc->srcs = kcalloc(num_srcs, sizeof(void *), GFP_KERNEL); 1386 1386 if (!atc->srcs) 1387 1387 return -ENOMEM; 1388 1388 1389 - atc->srcimps = kzalloc(sizeof(void *)*num_srcs, GFP_KERNEL); 1389 + atc->srcimps = kcalloc(num_srcs, sizeof(void *), GFP_KERNEL); 1390 1390 if (!atc->srcimps) 1391 1391 return -ENOMEM; 1392 1392 1393 - atc->pcm = kzalloc(sizeof(void *)*(2*4), GFP_KERNEL); 1393 + atc->pcm = kcalloc(2 * 4, sizeof(void *), GFP_KERNEL); 1394 1394 if (!atc->pcm) 1395 1395 return -ENOMEM; 1396 1396
+2 -1
sound/pci/ctxfi/ctdaio.c
··· 398 398 if (err) 399 399 return err; 400 400 401 - dao->imappers = kzalloc(sizeof(void *)*desc->msr*2, GFP_KERNEL); 401 + dao->imappers = kzalloc(array3_size(sizeof(void *), desc->msr, 2), 402 + GFP_KERNEL); 402 403 if (!dao->imappers) { 403 404 err = -ENOMEM; 404 405 goto error1;
+3 -2
sound/pci/ctxfi/ctmixer.c
··· 910 910 if (!mixer) 911 911 return -ENOMEM; 912 912 913 - mixer->amixers = kzalloc(sizeof(void *)*(NUM_CT_AMIXERS*CHN_NUM), 913 + mixer->amixers = kcalloc(NUM_CT_AMIXERS * CHN_NUM, sizeof(void *), 914 914 GFP_KERNEL); 915 915 if (!mixer->amixers) { 916 916 err = -ENOMEM; 917 917 goto error1; 918 918 } 919 - mixer->sums = kzalloc(sizeof(void *)*(NUM_CT_SUMS*CHN_NUM), GFP_KERNEL); 919 + mixer->sums = kcalloc(NUM_CT_SUMS * CHN_NUM, sizeof(void *), 920 + GFP_KERNEL); 920 921 if (!mixer->sums) { 921 922 err = -ENOMEM; 922 923 goto error2;
+1 -1
sound/pci/ctxfi/ctsrc.c
··· 679 679 return err; 680 680 681 681 /* Reserve memory for imapper nodes */ 682 - srcimp->imappers = kzalloc(sizeof(struct imapper)*desc->msr, 682 + srcimp->imappers = kcalloc(desc->msr, sizeof(struct imapper), 683 683 GFP_KERNEL); 684 684 if (!srcimp->imappers) { 685 685 err = -ENOMEM;
+3 -1
sound/pci/hda/patch_ca0132.c
··· 7482 7482 spec->chip_init_verbs = ca0132_init_verbs0; 7483 7483 if (spec->quirk == QUIRK_SBZ) 7484 7484 spec->sbz_init_verbs = sbz_init_verbs; 7485 - spec->spec_init_verbs = kzalloc(sizeof(struct hda_verb) * NUM_SPEC_VERBS, GFP_KERNEL); 7485 + spec->spec_init_verbs = kcalloc(NUM_SPEC_VERBS, 7486 + sizeof(struct hda_verb), 7487 + GFP_KERNEL); 7486 7488 if (!spec->spec_init_verbs) 7487 7489 return -ENOMEM; 7488 7490
+1 -1
sound/soc/codecs/wm_adsp.c
··· 1899 1899 adsp_warn(dsp, "Algorithm list end %x 0x%x != 0xbedead\n", 1900 1900 pos + len, be32_to_cpu(val)); 1901 1901 1902 - alg = kzalloc(len * 2, GFP_KERNEL | GFP_DMA); 1902 + alg = kcalloc(len, 2, GFP_KERNEL | GFP_DMA); 1903 1903 if (!alg) 1904 1904 return ERR_PTR(-ENOMEM); 1905 1905
+2 -2
sound/soc/intel/common/sst-ipc.c
··· 121 121 { 122 122 int i; 123 123 124 - ipc->msg = kzalloc(sizeof(struct ipc_message) * 125 - IPC_EMPTY_LIST_SIZE, GFP_KERNEL); 124 + ipc->msg = kcalloc(IPC_EMPTY_LIST_SIZE, sizeof(struct ipc_message), 125 + GFP_KERNEL); 126 126 if (ipc->msg == NULL) 127 127 return -ENOMEM; 128 128
+2 -2
sound/soc/soc-core.c
··· 373 373 if (!rtd->dai_link->ops) 374 374 rtd->dai_link->ops = &null_snd_soc_ops; 375 375 376 - rtd->codec_dais = kzalloc(sizeof(struct snd_soc_dai *) * 377 - dai_link->num_codecs, 376 + rtd->codec_dais = kcalloc(dai_link->num_codecs, 377 + sizeof(struct snd_soc_dai *), 378 378 GFP_KERNEL); 379 379 if (!rtd->codec_dais) { 380 380 kfree(rtd);
+1 -1
sound/soc/soc-dapm.c
··· 3055 3055 continue; 3056 3056 3057 3057 if (w->num_kcontrols) { 3058 - w->kcontrols = kzalloc(w->num_kcontrols * 3058 + w->kcontrols = kcalloc(w->num_kcontrols, 3059 3059 sizeof(struct snd_kcontrol *), 3060 3060 GFP_KERNEL); 3061 3061 if (!w->kcontrols) {
+1 -1
sound/soc/soc-topology.c
··· 885 885 int i, ret; 886 886 887 887 se->dobj.control.dtexts = 888 - kzalloc(sizeof(char *) * ec->items, GFP_KERNEL); 888 + kcalloc(ec->items, sizeof(char *), GFP_KERNEL); 889 889 if (se->dobj.control.dtexts == NULL) 890 890 return -ENOMEM; 891 891
+6 -4
sound/usb/6fire/pcm.c
··· 591 591 int i; 592 592 593 593 for (i = 0; i < PCM_N_URBS; i++) { 594 - rt->out_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB 595 - * PCM_MAX_PACKET_SIZE, GFP_KERNEL); 594 + rt->out_urbs[i].buffer = kcalloc(PCM_MAX_PACKET_SIZE, 595 + PCM_N_PACKETS_PER_URB, 596 + GFP_KERNEL); 596 597 if (!rt->out_urbs[i].buffer) 597 598 return -ENOMEM; 598 - rt->in_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB 599 - * PCM_MAX_PACKET_SIZE, GFP_KERNEL); 599 + rt->in_urbs[i].buffer = kcalloc(PCM_MAX_PACKET_SIZE, 600 + PCM_N_PACKETS_PER_URB, 601 + GFP_KERNEL); 600 602 if (!rt->in_urbs[i].buffer) 601 603 return -ENOMEM; 602 604 }
+2 -2
sound/usb/line6/capture.c
··· 264 264 struct usb_line6 *line6 = line6pcm->line6; 265 265 int i; 266 266 267 - line6pcm->in.urbs = kzalloc( 268 - sizeof(struct urb *) * line6->iso_buffers, GFP_KERNEL); 267 + line6pcm->in.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *), 268 + GFP_KERNEL); 269 269 if (line6pcm->in.urbs == NULL) 270 270 return -ENOMEM; 271 271
+2 -2
sound/usb/line6/playback.c
··· 409 409 struct usb_line6 *line6 = line6pcm->line6; 410 410 int i; 411 411 412 - line6pcm->out.urbs = kzalloc( 413 - sizeof(struct urb *) * line6->iso_buffers, GFP_KERNEL); 412 + line6pcm->out.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *), 413 + GFP_KERNEL); 414 414 if (line6pcm->out.urbs == NULL) 415 415 return -ENOMEM; 416 416
+1 -1
virt/kvm/arm/vgic/vgic-v4.c
··· 126 126 127 127 nr_vcpus = atomic_read(&kvm->online_vcpus); 128 128 129 - dist->its_vm.vpes = kzalloc(sizeof(*dist->its_vm.vpes) * nr_vcpus, 129 + dist->its_vm.vpes = kcalloc(nr_vcpus, sizeof(*dist->its_vm.vpes), 130 130 GFP_KERNEL); 131 131 if (!dist->its_vm.vpes) 132 132 return -ENOMEM;