aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2018-06-12 17:03:40 -0400
committerKees Cook <keescook@chromium.org>2018-06-12 19:19:22 -0400
commit6396bb221514d2876fd6dc0aa2a1f240d99b37bb (patch)
treec5c501e859b93de096b1f01160135612ed765059
parent6da2ec56059c3c7a7e5f729e6349e74ace1e5c57 (diff)
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>
-rw-r--r--arch/arm/mach-footbridge/dc21285.c2
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c2
-rw-r--r--arch/arm/mach-omap1/mcbsp.c2
-rw-r--r--arch/arm/mach-omap2/hsmmc.c2
-rw-r--r--arch/arm/mach-omap2/omap_device.c4
-rw-r--r--arch/arm/mach-omap2/prm_common.c9
-rw-r--r--arch/arm/mach-vexpress/spc.c2
-rw-r--r--arch/arm/mm/dma-mapping.c4
-rw-r--r--arch/arm64/kernel/armv8_deprecated.c4
-rw-r--r--arch/arm64/mm/context.c2
-rw-r--r--arch/ia64/kernel/topology.c6
-rw-r--r--arch/ia64/sn/kernel/io_common.c2
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c2
-rw-r--r--arch/mips/alchemy/common/clock.c2
-rw-r--r--arch/mips/alchemy/common/dbdma.c2
-rw-r--r--arch/mips/alchemy/common/platform.c4
-rw-r--r--arch/mips/alchemy/devboards/platform.c4
-rw-r--r--arch/mips/bmips/dma.c2
-rw-r--r--arch/mips/txx9/rbtx4939/setup.c2
-rw-r--r--arch/powerpc/kernel/vdso.c4
-rw-r--r--arch/powerpc/mm/numa.c2
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c2
-rw-r--r--arch/powerpc/net/bpf_jit_comp64.c2
-rw-r--r--arch/powerpc/oprofile/cell/spu_profiler.c4
-rw-r--r--arch/powerpc/platforms/4xx/pci.c2
-rw-r--r--arch/powerpc/platforms/powernv/opal-sysparam.c8
-rw-r--r--arch/powerpc/sysdev/mpic.c4
-rw-r--r--arch/powerpc/sysdev/xive/native.c2
-rw-r--r--arch/s390/appldata/appldata_base.c2
-rw-r--r--arch/s390/kernel/vdso.c4
-rw-r--r--arch/sh/drivers/dma/dmabrg.c2
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.c2
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c3
-rw-r--r--arch/x86/events/amd/iommu.c2
-rw-r--r--arch/x86/events/intel/uncore.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/if.c2
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/pci/xen.c2
-rw-r--r--arch/x86/platform/uv/uv_time.c2
-rw-r--r--block/bio.c3
-rw-r--r--block/blk-tag.c4
-rw-r--r--drivers/acpi/acpi_platform.c2
-rw-r--r--drivers/acpi/sysfs.c6
-rw-r--r--drivers/android/binder_alloc.c4
-rw-r--r--drivers/ata/libata-core.c2
-rw-r--r--drivers/ata/libata-pmp.c2
-rw-r--r--drivers/atm/fore200e.c3
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/block/drbd/drbd_main.c3
-rw-r--r--drivers/block/null_blk.c9
-rw-r--r--drivers/block/ps3vram.c5
-rw-r--r--drivers/block/rsxx/core.c3
-rw-r--r--drivers/block/rsxx/dma.c2
-rw-r--r--drivers/block/xen-blkback/xenbus.c3
-rw-r--r--drivers/block/xen-blkfront.c23
-rw-r--r--drivers/char/agp/amd-k7-agp.c3
-rw-r--r--drivers/char/agp/ati-agp.c3
-rw-r--r--drivers/char/agp/sworks-agp.c2
-rw-r--r--drivers/char/ipmi/ipmi_ssif.c3
-rw-r--r--drivers/clk/renesas/clk-r8a7740.c2
-rw-r--r--drivers/clk/renesas/clk-r8a7779.c2
-rw-r--r--drivers/clk/renesas/clk-rcar-gen2.c2
-rw-r--r--drivers/clk/renesas/clk-rz.c2
-rw-r--r--drivers/clk/st/clkgen-fsyn.c2
-rw-r--r--drivers/clk/st/clkgen-pll.c2
-rw-r--r--drivers/clk/sunxi/clk-usb.c2
-rw-r--r--drivers/clk/tegra/clk.c7
-rw-r--r--drivers/clk/ti/apll.c2
-rw-r--r--drivers/clk/ti/divider.c4
-rw-r--r--drivers/clk/ti/dpll.c2
-rw-r--r--drivers/clocksource/sh_cmt.c2
-rw-r--r--drivers/clocksource/sh_mtu2.c2
-rw-r--r--drivers/clocksource/sh_tmu.c2
-rw-r--r--drivers/cpufreq/acpi-cpufreq.c4
-rw-r--r--drivers/cpufreq/arm_big_little.c2
-rw-r--r--drivers/cpufreq/cppc_cpufreq.c3
-rw-r--r--drivers/cpufreq/ia64-acpi-cpufreq.c4
-rw-r--r--drivers/cpufreq/longhaul.c4
-rw-r--r--drivers/cpufreq/pxa3xx-cpufreq.c2
-rw-r--r--drivers/cpufreq/s3c24xx-cpufreq.c2
-rw-r--r--drivers/cpufreq/sfi-cpufreq.c4
-rw-r--r--drivers/cpufreq/spear-cpufreq.c2
-rw-r--r--drivers/crypto/amcc/crypto4xx_core.c8
-rw-r--r--drivers/crypto/inside-secure/safexcel_hash.c2
-rw-r--r--drivers/crypto/marvell/hash.c2
-rw-r--r--drivers/crypto/n2_core.c4
-rw-r--r--drivers/crypto/qat/qat_common/qat_uclo.c5
-rw-r--r--drivers/dma/ioat/init.c4
-rw-r--r--drivers/dma/mv_xor.c2
-rw-r--r--drivers/dma/pl330.c4
-rw-r--r--drivers/dma/sh/shdma-base.c5
-rw-r--r--drivers/dma/xilinx/zynqmp_dma.c2
-rw-r--r--drivers/edac/amd64_edac.c2
-rw-r--r--drivers/edac/i7core_edac.c2
-rw-r--r--drivers/extcon/extcon.c24
-rw-r--r--drivers/firmware/dell_rbu.c2
-rw-r--r--drivers/firmware/efi/capsule.c2
-rw-r--r--drivers/firmware/efi/runtime-map.c2
-rw-r--r--drivers/fmc/fmc-sdb.c4
-rw-r--r--drivers/gpio/gpio-ml-ioh.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_test.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/atom.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ci_dpm.c9
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_dpm.c5
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si_dpm.c9
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/basics/logger.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/basics/vector.c4
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c6
-rw-r--r--drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c3
-rw-r--r--drivers/gpu/drm/amd/display/modules/color/color_gamma.c10
-rw-r--r--drivers/gpu/drm/amd/display/modules/freesync/freesync.c3
-rw-r--r--drivers/gpu/drm/amd/display/modules/stats/stats.c12
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c2
-rw-r--r--drivers/gpu/drm/i915/gvt/vgpu.c2
-rw-r--r--drivers/gpu/drm/i915/intel_hdcp.c2
-rw-r--r--drivers/gpu/drm/i915/selftests/intel_uncore.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvif/fifo.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvif/object.c2
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/core/event.c3
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_gem.c2
-rw-r--r--drivers/gpu/drm/radeon/atom.c2
-rw-r--r--drivers/gpu/drm/radeon/btc_dpm.c4
-rw-r--r--drivers/gpu/drm/radeon/ci_dpm.c9
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c5
-rw-r--r--drivers/gpu/drm/radeon/ni_dpm.c9
-rw-r--r--drivers/gpu/drm/radeon/r600_dpm.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c39
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_test.c2
-rw-r--r--drivers/gpu/drm/radeon/rs780_dpm.c5
-rw-r--r--drivers/gpu/drm/radeon/rv6xx_dpm.c5
-rw-r--r--drivers/gpu/drm/radeon/rv770_dpm.c5
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c9
-rw-r--r--drivers/gpu/drm/radeon/sumo_dpm.c5
-rw-r--r--drivers/gpu/drm/radeon/trinity_dpm.c5
-rw-r--r--drivers/gpu/drm/selftests/test-drm_mm.c4
-rw-r--r--drivers/hid/hid-debug.c4
-rw-r--r--drivers/hv/hv.c2
-rw-r--r--drivers/hv/ring_buffer.c2
-rw-r--r--drivers/hwmon/acpi_power_meter.c7
-rw-r--r--drivers/hwmon/coretemp.c2
-rw-r--r--drivers/hwmon/i5k_amb.c5
-rw-r--r--drivers/hwmon/ibmpex.c2
-rw-r--r--drivers/i2c/busses/i2c-amd756-s4882.c4
-rw-r--r--drivers/i2c/busses/i2c-nforce2-s4985.c4
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c2
-rw-r--r--drivers/i2c/i2c-stub.c5
-rw-r--r--drivers/ide/hpt366.c2
-rw-r--r--drivers/ide/it821x.c2
-rw-r--r--drivers/iio/imu/adis_buffer.c2
-rw-r--r--drivers/iio/inkern.c2
-rw-r--r--drivers/infiniband/core/cache.c5
-rw-r--r--drivers/infiniband/core/device.c4
-rw-r--r--drivers/infiniband/core/iwpm_util.c10
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_hal.c4
-rw-r--r--drivers/infiniband/hw/cxgb4/device.c7
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c8
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_hw_v2.c2
-rw-r--r--drivers/infiniband/hw/mlx4/mad.c3
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_profile.c2
-rw-r--r--drivers/infiniband/hw/nes/nes_mgt.c3
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c5
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_hw.c2
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_main.c11
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_verbs.c12
-rw-r--r--drivers/infiniband/hw/qedr/main.c4
-rw-r--r--drivers/infiniband/hw/qedr/verbs.c4
-rw-r--r--drivers/infiniband/hw/qib/qib_iba7322.c5
-rw-r--r--drivers/infiniband/hw/qib/qib_init.c4
-rw-r--r--drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c2
-rw-r--r--drivers/infiniband/hw/usnic/usnic_vnic.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c7
-rw-r--r--drivers/infiniband/ulp/isert/ib_isert.c5
-rw-r--r--drivers/input/keyboard/omap4-keypad.c3
-rw-r--r--drivers/iommu/dmar.c2
-rw-r--r--drivers/iommu/intel-iommu.c4
-rw-r--r--drivers/iommu/omap-iommu.c2
-rw-r--r--drivers/ipack/carriers/tpci200.c4
-rw-r--r--drivers/irqchip/irq-alpine-msi.c3
-rw-r--r--drivers/irqchip/irq-gic-v2m.c2
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c15
-rw-r--r--drivers/irqchip/irq-gic-v3.c5
-rw-r--r--drivers/irqchip/irq-partition-percpu.c2
-rw-r--r--drivers/irqchip/irq-s3c24xx.c2
-rw-r--r--drivers/isdn/capi/capi.c2
-rw-r--r--drivers/isdn/gigaset/capi.c2
-rw-r--r--drivers/isdn/gigaset/i4l.c2
-rw-r--r--drivers/isdn/hardware/avm/b1.c2
-rw-r--r--drivers/isdn/hisax/fsm.c4
-rw-r--r--drivers/isdn/i4l/isdn_common.c4
-rw-r--r--drivers/isdn/mISDN/fsm.c6
-rw-r--r--drivers/lightnvm/pblk-init.c2
-rw-r--r--drivers/mailbox/pcc.c3
-rw-r--r--drivers/md/bcache/super.c7
-rw-r--r--drivers/md/dm-crypt.c5
-rw-r--r--drivers/md/md-bitmap.c2
-rw-r--r--drivers/md/md-cluster.c6
-rw-r--r--drivers/md/md-multipath.c3
-rw-r--r--drivers/md/raid0.c10
-rw-r--r--drivers/md/raid1.c9
-rw-r--r--drivers/md/raid10.c13
-rw-r--r--drivers/md/raid5.c15
-rw-r--r--drivers/media/dvb-frontends/dib7000p.c4
-rw-r--r--drivers/media/dvb-frontends/dib8000.c4
-rw-r--r--drivers/media/dvb-frontends/dib9000.c4
-rw-r--r--drivers/media/usb/au0828/au0828-video.c6
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-core.c8
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-vbi.c4
-rw-r--r--drivers/media/usb/go7007/go7007-fw.c2
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-hdw.c2
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-std.c2
-rw-r--r--drivers/media/usb/stk1160/stk1160-video.c6
-rw-r--r--drivers/media/usb/stkwebcam/stk-webcam.c5
-rw-r--r--drivers/media/usb/usbtv/usbtv-video.c2
-rw-r--r--drivers/mfd/cros_ec_dev.c7
-rw-r--r--drivers/mfd/mfd-core.c2
-rw-r--r--drivers/mfd/timberdale.c4
-rw-r--r--drivers/misc/altera-stapl/altera.c6
-rw-r--r--drivers/misc/cxl/guest.c2
-rw-r--r--drivers/misc/cxl/of.c2
-rw-r--r--drivers/misc/genwqe/card_ddcb.c9
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c8
-rw-r--r--drivers/misc/sgi-xp/xpc_partition.c2
-rw-r--r--drivers/misc/sgi-xp/xpnet.c5
-rw-r--r--drivers/misc/sram.c2
-rw-r--r--drivers/mtd/ar7part.c2
-rw-r--r--drivers/mtd/bcm47xxpart.c2
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c5
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c2
-rw-r--r--drivers/mtd/devices/docg3.c2
-rw-r--r--drivers/mtd/maps/physmap_of_core.c4
-rw-r--r--drivers/mtd/nand/onenand/onenand_base.c6
-rw-r--r--drivers/mtd/ofpart.c4
-rw-r--r--drivers/mtd/parsers/parser_trx.c2
-rw-r--r--drivers/mtd/parsers/sharpslpart.c5
-rw-r--r--drivers/mtd/sm_ftl.c4
-rw-r--r--drivers/mtd/tests/pagetest.c2
-rw-r--r--drivers/mtd/ubi/wl.c2
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/can/grcan.c4
-rw-r--r--drivers/net/can/slcan.c2
-rw-r--r--drivers/net/ethernet/broadcom/bcm63xx_enet.c4
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c13
-rw-r--r--drivers/net/ethernet/broadcom/cnic.c10
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c5
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.c4
-rw-r--r--drivers/net/ethernet/calxeda/xgmac.c4
-rw-r--r--drivers/net/ethernet/cavium/thunder/nicvf_queues.c4
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c4
-rw-r--r--drivers/net/ethernet/cortina/gemini.c4
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_enet.c3
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c2
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c7
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c4
-rw-r--r--drivers/net/ethernet/jme.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/alloc.c4
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c15
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c20
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/resource_tracker.c16
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c3
-rw-r--r--drivers/net/ethernet/micrel/ksz884x.c2
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-config.c8
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-main.c4
-rw-r--r--drivers/net/ethernet/pasemi/pasemi_mac.c10
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_debug.c5
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_dev.c16
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_init_ops.c4
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_l2.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c10
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c8
-rw-r--r--drivers/net/ethernet/socionext/netsec.c2
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_wireless.c5
-rw-r--r--drivers/net/phy/dp83640.c5
-rw-r--r--drivers/net/slip/slip.c2
-rw-r--r--drivers/net/team/team.c2
-rw-r--r--drivers/net/usb/smsc95xx.c2
-rw-r--r--drivers/net/virtio_net.c8
-rw-r--r--drivers/net/wan/fsl_ucc_hdlc.c6
-rw-r--r--drivers/net/wireless/ath/ath10k/htt_rx.c2
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-tlv.c2
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c2
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c7
-rw-r--r--drivers/net/wireless/broadcom/b43/phy_n.c2
-rw-r--r--drivers/net/wireless/broadcom/b43legacy/main.c4
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c5
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c2
-rw-r--r--drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c7
-rw-r--r--drivers/net/wireless/intel/iwlegacy/common.c13
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/scan.c2
-rw-r--r--drivers/net/wireless/intersil/p54/eeprom.c12
-rw-r--r--drivers/net/wireless/intersil/prism54/oid_mgt.c2
-rw-r--r--drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c4
-rw-r--r--drivers/net/wireless/marvell/mwifiex/sdio.c9
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/commands.c2
-rw-r--r--drivers/net/wireless/ralink/rt2x00/rt2x00debug.c2
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/efuse.c4
-rw-r--r--drivers/net/wireless/realtek/rtlwifi/usb.c2
-rw-r--r--drivers/net/wireless/st/cw1200/queue.c10
-rw-r--r--drivers/net/wireless/st/cw1200/scan.c6
-rw-r--r--drivers/nvmem/rockchip-efuse.c6
-rw-r--r--drivers/nvmem/sunxi_sid.c2
-rw-r--r--drivers/of/platform.c2
-rw-r--r--drivers/of/unittest.c2
-rw-r--r--drivers/opp/ti-opp-supply.c4
-rw-r--r--drivers/pci/msi.c4
-rw-r--r--drivers/pci/pci-sysfs.c2
-rw-r--r--drivers/pcmcia/pd6729.c2
-rw-r--r--drivers/pinctrl/bcm/pinctrl-bcm2835.c4
-rw-r--r--drivers/pinctrl/freescale/pinctrl-mxs.c2
-rw-r--r--drivers/pinctrl/pinctrl-lantiq.c3
-rw-r--r--drivers/pinctrl/sirf/pinctrl-sirf.c2
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.c2
-rw-r--r--drivers/pinctrl/sunxi/pinctrl-sunxi.c2
-rw-r--r--drivers/pinctrl/vt8500/pinctrl-wmt.c2
-rw-r--r--drivers/platform/x86/alienware-wmi.c6
-rw-r--r--drivers/platform/x86/intel_ips.c12
-rw-r--r--drivers/platform/x86/panasonic-laptop.c2
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c2
-rw-r--r--drivers/power/supply/wm97xx_battery.c2
-rw-r--r--drivers/power/supply/z2_battery.c2
-rw-r--r--drivers/powercap/powercap_sys.c9
-rw-r--r--drivers/rapidio/rio-scan.c6
-rw-r--r--drivers/regulator/s2mps11.c2
-rw-r--r--drivers/s390/block/dcssblk.c6
-rw-r--r--drivers/s390/char/keyboard.c2
-rw-r--r--drivers/s390/char/vmur.c2
-rw-r--r--drivers/s390/char/zcore.c2
-rw-r--r--drivers/s390/cio/qdio_setup.c2
-rw-r--r--drivers/s390/cio/qdio_thinint.c5
-rw-r--r--drivers/s390/crypto/pkey_api.c2
-rw-r--r--drivers/s390/net/ctcm_main.c2
-rw-r--r--drivers/s390/net/qeth_core_main.c27
-rw-r--r--drivers/scsi/BusLogic.c2
-rw-r--r--drivers/scsi/aacraid/linit.c4
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_core.c4
-rw-r--r--drivers/scsi/aic94xx/aic94xx_hwi.c5
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c2
-rw-r--r--drivers/scsi/be2iscsi/be_main.c40
-rw-r--r--drivers/scsi/bfa/bfad_attr.c2
-rw-r--r--drivers/scsi/bfa/bfad_bsg.c5
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c2
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c8
-rw-r--r--drivers/scsi/csiostor/csio_wr.c4
-rw-r--r--drivers/scsi/esas2r/esas2r_init.c11
-rw-r--r--drivers/scsi/hpsa.c22
-rw-r--r--drivers/scsi/ipr.c10
-rw-r--r--drivers/scsi/libsas/sas_expander.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c7
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c50
-rw-r--r--drivers/scsi/lpfc/lpfc_vport.c2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c8
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fusion.c2
-rw-r--r--drivers/scsi/osst.c2
-rw-r--r--drivers/scsi/pm8001/pm8001_ctl.c2
-rw-r--r--drivers/scsi/pmcraid.c5
-rw-r--r--drivers/scsi/qedi/qedi_main.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c10
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c5
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c14
-rw-r--r--drivers/scsi/qla2xxx/qla_target.c10
-rw-r--r--drivers/scsi/scsi_debug.c2
-rw-r--r--drivers/scsi/ses.c2
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/scsi/smartpqi/smartpqi_init.c5
-rw-r--r--drivers/scsi/st.c2
-rw-r--r--drivers/sh/clk/cpg.c2
-rw-r--r--drivers/sh/intc/core.c10
-rw-r--r--drivers/sh/maple/maple.c2
-rw-r--r--drivers/slimbus/qcom-ctrl.c2
-rw-r--r--drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c2
-rw-r--r--drivers/staging/rtlwifi/efuse.c4
-rw-r--r--drivers/staging/unisys/visorhba/visorhba_main.c2
-rw-r--r--drivers/target/target_core_transport.c2
-rw-r--r--drivers/target/target_core_user.c5
-rw-r--r--drivers/thermal/int340x_thermal/acpi_thermal_rel.c4
-rw-r--r--drivers/thermal/int340x_thermal/int340x_thermal_zone.c7
-rw-r--r--drivers/thermal/of-thermal.c4
-rw-r--r--drivers/thermal/x86_pkg_temp_thermal.c3
-rw-r--r--drivers/tty/ehv_bytechan.c2
-rw-r--r--drivers/tty/goldfish.c5
-rw-r--r--drivers/tty/hvc/hvc_iucv.c2
-rw-r--r--drivers/tty/serial/pch_uart.c2
-rw-r--r--drivers/tty/serial/serial_core.c2
-rw-r--r--drivers/tty/serial/sunsab.c5
-rw-r--r--drivers/uio/uio_pruss.c2
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/dwc2/hcd.c11
-rw-r--r--drivers/usb/gadget/udc/bdc/bdc_ep.c6
-rw-r--r--drivers/usb/gadget/udc/fsl_udc_core.c2
-rw-r--r--drivers/usb/host/ehci-sched.c5
-rw-r--r--drivers/usb/host/imx21-hcd.c4
-rw-r--r--drivers/usb/mon/mon_bin.c3
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c2
-rw-r--r--drivers/usb/renesas_usbhs/pipe.c3
-rw-r--r--drivers/usb/wusbcore/wa-rpipe.c3
-rw-r--r--drivers/vhost/scsi.c15
-rw-r--r--drivers/video/console/sticore.c2
-rw-r--r--drivers/video/fbdev/broadsheetfb.c2
-rw-r--r--drivers/video/fbdev/core/fbmon.c7
-rw-r--r--drivers/video/fbdev/mmp/fb/mmpfb.c4
-rw-r--r--drivers/video/fbdev/omap2/omapfb/dss/manager.c4
-rw-r--r--drivers/video/fbdev/omap2/omapfb/dss/overlay.c4
-rw-r--r--drivers/video/fbdev/uvesafb.c7
-rw-r--r--drivers/video/of_display_timing.c5
-rw-r--r--drivers/virt/fsl_hypervisor.c2
-rw-r--r--drivers/virtio/virtio_pci_common.c2
-rw-r--r--drivers/xen/arm-device.c6
-rw-r--r--fs/btrfs/check-integrity.c4
-rw-r--r--fs/cifs/cifssmb.c2
-rw-r--r--fs/cifs/file.c2
-rw-r--r--fs/ext4/extents.c8
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayout.c2
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayoutdev.c3
-rw-r--r--fs/nfsd/export.c5
-rw-r--r--fs/ocfs2/journal.c2
-rw-r--r--fs/ocfs2/sysfile.c9
-rw-r--r--fs/overlayfs/namei.c2
-rw-r--r--fs/proc/proc_sysctl.c2
-rw-r--r--fs/reiserfs/inode.c3
-rw-r--r--fs/udf/super.c7
-rw-r--r--kernel/bpf/verifier.c2
-rw-r--r--kernel/debug/kdb/kdb_main.c2
-rw-r--r--kernel/events/uprobes.c3
-rw-r--r--kernel/locking/locktorture.c6
-rw-r--r--kernel/sched/fair.c4
-rw-r--r--kernel/sched/rt.c4
-rw-r--r--kernel/sysctl.c3
-rw-r--r--kernel/trace/ftrace.c2
-rw-r--r--kernel/trace/trace.c3
-rw-r--r--kernel/workqueue.c2
-rw-r--r--lib/lru_cache.c2
-rw-r--r--lib/mpi/mpiutil.c2
-rw-r--r--mm/slab.c3
-rw-r--r--mm/slub.c7
-rw-r--r--net/bridge/br_multicast.c2
-rw-r--r--net/can/bcm.c3
-rw-r--r--net/core/ethtool.c4
-rw-r--r--net/ieee802154/nl-phy.c2
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv6/icmp.c2
-rw-r--r--net/mac80211/chan.c2
-rw-r--r--net/mac80211/rc80211_minstrel.c2
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c2
-rw-r--r--net/mac80211/scan.c2
-rw-r--r--net/mac80211/util.c5
-rw-r--r--net/netfilter/nf_tables_api.c2
-rw-r--r--net/netfilter/nfnetlink_cthelper.c5
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/openvswitch/vport.c2
-rw-r--r--net/rds/ib.c3
-rw-r--r--net/rose/af_rose.c3
-rw-r--r--net/sctp/auth.c5
-rw-r--r--net/smc/smc_wr.c6
-rw-r--r--net/sunrpc/auth_gss/gss_rpc_upcall.c2
-rw-r--r--net/sunrpc/cache.c2
-rw-r--r--net/wireless/nl80211.c4
-rw-r--r--security/apparmor/policy_unpack.c2
-rw-r--r--security/selinux/ss/services.c2
-rw-r--r--sound/firewire/fireface/ff-protocol-ff400.c2
-rw-r--r--sound/pci/ctxfi/ctatc.c18
-rw-r--r--sound/pci/ctxfi/ctdaio.c3
-rw-r--r--sound/pci/ctxfi/ctmixer.c5
-rw-r--r--sound/pci/ctxfi/ctsrc.c2
-rw-r--r--sound/pci/hda/patch_ca0132.c4
-rw-r--r--sound/soc/codecs/wm_adsp.c2
-rw-r--r--sound/soc/intel/common/sst-ipc.c4
-rw-r--r--sound/soc/soc-core.c4
-rw-r--r--sound/soc/soc-dapm.c2
-rw-r--r--sound/soc/soc-topology.c2
-rw-r--r--sound/usb/6fire/pcm.c10
-rw-r--r--sound/usb/line6/capture.c4
-rw-r--r--sound/usb/line6/playback.c4
-rw-r--r--virt/kvm/arm/vgic/vgic-v4.c2
484 files changed, 1177 insertions, 977 deletions
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index e7b350f18f5f..16d71bac0061 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -252,7 +252,7 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys)
252 if (nr || !footbridge_cfn_mode()) 252 if (nr || !footbridge_cfn_mode())
253 return 0; 253 return 0;
254 254
255 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL); 255 res = kcalloc(2, sizeof(struct resource), GFP_KERNEL);
256 if (!res) { 256 if (!res) {
257 printk("out of memory for root bus resources"); 257 printk("out of memory for root bus resources");
258 return 0; 258 return 0;
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index bcf3df59f71b..6835b17113e5 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -421,7 +421,7 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
421 if (nr >= 1) 421 if (nr >= 1)
422 return 0; 422 return 0;
423 423
424 res = kzalloc(sizeof(*res) * 2, GFP_KERNEL); 424 res = kcalloc(2, sizeof(*res), GFP_KERNEL);
425 if (res == NULL) { 425 if (res == NULL) {
426 /* 426 /*
427 * If we're out of memory this early, something is wrong, 427 * If we're out of memory this early, something is wrong,
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index 8ed67f8d1762..27e22e702f96 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -389,7 +389,7 @@ static void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
389{ 389{
390 int i; 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 GFP_KERNEL); 393 GFP_KERNEL);
394 if (!omap_mcbsp_devices) { 394 if (!omap_mcbsp_devices) {
395 printk(KERN_ERR "Could not register McBSP devices\n"); 395 printk(KERN_ERR "Could not register McBSP devices\n");
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index b064066d431c..9344035d537f 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -35,7 +35,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
35{ 35{
36 char *hc_name; 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 if (!hc_name) { 39 if (!hc_name) {
40 kfree(hc_name); 40 kfree(hc_name);
41 return -ENOMEM; 41 return -ENOMEM;
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 3b829a50d1db..06b6bca3a179 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -155,7 +155,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
155 if (!omap_hwmod_parse_module_range(NULL, node, &res)) 155 if (!omap_hwmod_parse_module_range(NULL, node, &res))
156 return -ENODEV; 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 if (!hwmods) { 159 if (!hwmods) {
160 ret = -ENOMEM; 160 ret = -ENOMEM;
161 goto odbfd_exit; 161 goto odbfd_exit;
@@ -405,7 +405,7 @@ omap_device_copy_resources(struct omap_hwmod *oh,
405 goto error; 405 goto error;
406 } 406 }
407 407
408 res = kzalloc(sizeof(*res) * 2, GFP_KERNEL); 408 res = kcalloc(2, sizeof(*res), GFP_KERNEL);
409 if (!res) 409 if (!res)
410 return -ENOMEM; 410 return -ENOMEM;
411 411
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 021b5a8b9c0a..058a37e6d11c 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -285,10 +285,11 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
285 285
286 prcm_irq_setup = irq_setup; 286 prcm_irq_setup = irq_setup;
287 287
288 prcm_irq_chips = kzalloc(sizeof(void *) * nr_regs, GFP_KERNEL); 288 prcm_irq_chips = kcalloc(nr_regs, sizeof(void *), GFP_KERNEL);
289 prcm_irq_setup->saved_mask = kzalloc(sizeof(u32) * nr_regs, GFP_KERNEL); 289 prcm_irq_setup->saved_mask = kcalloc(nr_regs, sizeof(u32),
290 prcm_irq_setup->priority_mask = kzalloc(sizeof(u32) * nr_regs, 290 GFP_KERNEL);
291 GFP_KERNEL); 291 prcm_irq_setup->priority_mask = kcalloc(nr_regs, sizeof(u32),
292 GFP_KERNEL);
292 293
293 if (!prcm_irq_chips || !prcm_irq_setup->saved_mask || 294 if (!prcm_irq_chips || !prcm_irq_setup->saved_mask ||
294 !prcm_irq_setup->priority_mask) 295 !prcm_irq_setup->priority_mask)
diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c
index 21c064267af5..0f5381d13494 100644
--- a/arch/arm/mach-vexpress/spc.c
+++ b/arch/arm/mach-vexpress/spc.c
@@ -403,7 +403,7 @@ static int ve_spc_populate_opps(uint32_t cluster)
403 uint32_t data = 0, off, ret, idx; 403 uint32_t data = 0, off, ret, idx;
404 struct ve_spc_opp *opps; 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 if (!opps) 407 if (!opps)
408 return -ENOMEM; 408 return -ENOMEM;
409 409
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index af27f1c22d93..be0fa7e39c26 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -2162,8 +2162,8 @@ arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size)
2162 goto err; 2162 goto err;
2163 2163
2164 mapping->bitmap_size = bitmap_size; 2164 mapping->bitmap_size = bitmap_size;
2165 mapping->bitmaps = kzalloc(extensions * sizeof(unsigned long *), 2165 mapping->bitmaps = kcalloc(extensions, sizeof(unsigned long *),
2166 GFP_KERNEL); 2166 GFP_KERNEL);
2167 if (!mapping->bitmaps) 2167 if (!mapping->bitmaps)
2168 goto err2; 2168 goto err2;
2169 2169
diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
index 97d45d5151d4..d4707abb2f16 100644
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -234,8 +234,8 @@ static void __init register_insn_emulation_sysctl(void)
234 struct insn_emulation *insn; 234 struct insn_emulation *insn;
235 struct ctl_table *insns_sysctl, *sysctl; 235 struct ctl_table *insns_sysctl, *sysctl;
236 236
237 insns_sysctl = kzalloc(sizeof(*sysctl) * (nr_insn_emulated + 1), 237 insns_sysctl = kcalloc(nr_insn_emulated + 1, sizeof(*sysctl),
238 GFP_KERNEL); 238 GFP_KERNEL);
239 239
240 raw_spin_lock_irqsave(&insn_emulation_lock, flags); 240 raw_spin_lock_irqsave(&insn_emulation_lock, flags);
241 list_for_each_entry(insn, &insn_emulation, node) { 241 list_for_each_entry(insn, &insn_emulation, node) {
diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c
index 301417ae2ba8..c127f94da8e2 100644
--- a/arch/arm64/mm/context.c
+++ b/arch/arm64/mm/context.c
@@ -263,7 +263,7 @@ static int asids_init(void)
263 */ 263 */
264 WARN_ON(NUM_USER_ASIDS - 1 <= num_possible_cpus()); 264 WARN_ON(NUM_USER_ASIDS - 1 <= num_possible_cpus());
265 atomic64_set(&asid_generation, ASID_FIRST_VERSION); 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 GFP_KERNEL); 267 GFP_KERNEL);
268 if (!asid_map) 268 if (!asid_map)
269 panic("Failed to allocate bitmap for %lu ASIDs\n", 269 panic("Failed to allocate bitmap for %lu ASIDs\n",
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index d76529cbff20..9b820f7a6a98 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -85,7 +85,7 @@ static int __init topology_init(void)
85 } 85 }
86#endif 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 if (!sysfs_cpus) 89 if (!sysfs_cpus)
90 panic("kzalloc in topology_init failed - NR_CPUS too big?"); 90 panic("kzalloc in topology_init failed - NR_CPUS too big?");
91 91
@@ -319,8 +319,8 @@ static int cpu_cache_sysfs_init(unsigned int cpu)
319 return -1; 319 return -1;
320 } 320 }
321 321
322 this_cache=kzalloc(sizeof(struct cache_info)*unique_caches, 322 this_cache=kcalloc(unique_caches, sizeof(struct cache_info),
323 GFP_KERNEL); 323 GFP_KERNEL);
324 if (this_cache == NULL) 324 if (this_cache == NULL)
325 return -ENOMEM; 325 return -ENOMEM;
326 326
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 8479e9a7ce16..102aabad6d20 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -132,7 +132,7 @@ static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
132 printk_once(KERN_WARNING 132 printk_once(KERN_WARNING
133 "PROM version < 4.50 -- implementing old PROM flush WAR\n"); 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 BUG_ON(!war_list); 136 BUG_ON(!war_list);
137 137
138 SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST, 138 SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 8dbbef4a4f47..7195df1da121 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -184,7 +184,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
184 /* Setup the PMU ATE map */ 184 /* Setup the PMU ATE map */
185 soft->pbi_int_ate_resource.lowest_free_index = 0; 185 soft->pbi_int_ate_resource.lowest_free_index = 0;
186 soft->pbi_int_ate_resource.ate = 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 if (!soft->pbi_int_ate_resource.ate) { 189 if (!soft->pbi_int_ate_resource.ate) {
190 kfree(soft); 190 kfree(soft);
diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
index 6b6f6851df92..d129475fd40d 100644
--- a/arch/mips/alchemy/common/clock.c
+++ b/arch/mips/alchemy/common/clock.c
@@ -985,7 +985,7 @@ static int __init alchemy_clk_setup_imux(int ctype)
985 return -ENODEV; 985 return -ENODEV;
986 } 986 }
987 987
988 a = kzalloc((sizeof(*a)) * 6, GFP_KERNEL); 988 a = kcalloc(6, sizeof(*a), GFP_KERNEL);
989 if (!a) 989 if (!a)
990 return -ENOMEM; 990 return -ENOMEM;
991 991
diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c
index 24b04758cce5..4ca2c28878e0 100644
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@ -1050,7 +1050,7 @@ static int __init dbdma_setup(unsigned int irq, dbdev_tab_t *idtable)
1050{ 1050{
1051 int ret; 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 if (!dbdev_tab) 1054 if (!dbdev_tab)
1055 return -ENOMEM; 1055 return -ENOMEM;
1056 1056
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index d77a64f4c78b..1454d9f6ab2d 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -115,7 +115,7 @@ static void __init alchemy_setup_uarts(int ctype)
115 uartclk = clk_get_rate(clk); 115 uartclk = clk_get_rate(clk);
116 clk_put(clk); 116 clk_put(clk);
117 117
118 ports = kzalloc(s * (c + 1), GFP_KERNEL); 118 ports = kcalloc(s, (c + 1), GFP_KERNEL);
119 if (!ports) { 119 if (!ports) {
120 printk(KERN_INFO "Alchemy: no memory for UART data\n"); 120 printk(KERN_INFO "Alchemy: no memory for UART data\n");
121 return; 121 return;
@@ -198,7 +198,7 @@ static unsigned long alchemy_ehci_data[][2] __initdata = {
198 198
199static int __init _new_usbres(struct resource **r, struct platform_device **d) 199static 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 if (!*r) 202 if (!*r)
203 return -ENOMEM; 203 return -ENOMEM;
204 *d = kzalloc(sizeof(struct platform_device), GFP_KERNEL); 204 *d = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
diff --git a/arch/mips/alchemy/devboards/platform.c b/arch/mips/alchemy/devboards/platform.c
index 4640edab207c..203854ddd1bb 100644
--- a/arch/mips/alchemy/devboards/platform.c
+++ b/arch/mips/alchemy/devboards/platform.c
@@ -103,7 +103,7 @@ int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start,
103 if (stschg_irq) 103 if (stschg_irq)
104 cnt++; 104 cnt++;
105 105
106 sr = kzalloc(sizeof(struct resource) * cnt, GFP_KERNEL); 106 sr = kcalloc(cnt, sizeof(struct resource), GFP_KERNEL);
107 if (!sr) 107 if (!sr)
108 return -ENOMEM; 108 return -ENOMEM;
109 109
@@ -178,7 +178,7 @@ int __init db1x_register_norflash(unsigned long size, int width,
178 return -EINVAL; 178 return -EINVAL;
179 179
180 ret = -ENOMEM; 180 ret = -ENOMEM;
181 parts = kzalloc(sizeof(struct mtd_partition) * 5, GFP_KERNEL); 181 parts = kcalloc(5, sizeof(struct mtd_partition), GFP_KERNEL);
182 if (!parts) 182 if (!parts)
183 goto out; 183 goto out;
184 184
diff --git a/arch/mips/bmips/dma.c b/arch/mips/bmips/dma.c
index 04790f4e1805..6dec30842b2f 100644
--- a/arch/mips/bmips/dma.c
+++ b/arch/mips/bmips/dma.c
@@ -94,7 +94,7 @@ static int __init bmips_init_dma_ranges(void)
94 goto out_bad; 94 goto out_bad;
95 95
96 /* add a dummy (zero) entry at the end as a sentinel */ 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 GFP_KERNEL); 98 GFP_KERNEL);
99 if (!bmips_dma_ranges) 99 if (!bmips_dma_ranges)
100 goto out_bad; 100 goto out_bad;
diff --git a/arch/mips/txx9/rbtx4939/setup.c b/arch/mips/txx9/rbtx4939/setup.c
index fd26fadc8617..ef29a9c2ffd6 100644
--- a/arch/mips/txx9/rbtx4939/setup.c
+++ b/arch/mips/txx9/rbtx4939/setup.c
@@ -219,7 +219,7 @@ static int __init rbtx4939_led_probe(struct platform_device *pdev)
219 "nand-disk", 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 GFP_KERNEL); 223 GFP_KERNEL);
224 if (!leds_data) 224 if (!leds_data)
225 return -ENOMEM; 225 return -ENOMEM;
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index b44ec104a5a1..d2205b97628c 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -791,7 +791,7 @@ static int __init vdso_init(void)
791 791
792#ifdef CONFIG_VDSO32 792#ifdef CONFIG_VDSO32
793 /* Make sure pages are in the correct state */ 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 GFP_KERNEL); 795 GFP_KERNEL);
796 BUG_ON(vdso32_pagelist == NULL); 796 BUG_ON(vdso32_pagelist == NULL);
797 for (i = 0; i < vdso32_pages; i++) { 797 for (i = 0; i < vdso32_pages; i++) {
@@ -805,7 +805,7 @@ static int __init vdso_init(void)
805#endif 805#endif
806 806
807#ifdef CONFIG_PPC64 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 GFP_KERNEL); 809 GFP_KERNEL);
810 BUG_ON(vdso64_pagelist == NULL); 810 BUG_ON(vdso64_pagelist == NULL);
811 for (i = 0; i < vdso64_pages; i++) { 811 for (i = 0; i < vdso64_pages; i++) {
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 57a5029b4521..0c7e05d89244 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1316,7 +1316,7 @@ int numa_update_cpu_topology(bool cpus_locked)
1316 if (!weight) 1316 if (!weight)
1317 return 0; 1317 return 0;
1318 1318
1319 updates = kzalloc(weight * (sizeof(*updates)), GFP_KERNEL); 1319 updates = kcalloc(weight, sizeof(*updates), GFP_KERNEL);
1320 if (!updates) 1320 if (!updates)
1321 return 0; 1321 return 0;
1322 1322
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index a9636d8cba15..5b061fc81df3 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -566,7 +566,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
566 if (!bpf_jit_enable) 566 if (!bpf_jit_enable)
567 return; 567 return;
568 568
569 addrs = kzalloc((flen+1) * sizeof(*addrs), GFP_KERNEL); 569 addrs = kcalloc(flen + 1, sizeof(*addrs), GFP_KERNEL);
570 if (addrs == NULL) 570 if (addrs == NULL)
571 return; 571 return;
572 572
diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c
index f1c95779843b..380cbf9a40d9 100644
--- a/arch/powerpc/net/bpf_jit_comp64.c
+++ b/arch/powerpc/net/bpf_jit_comp64.c
@@ -949,7 +949,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
949 goto skip_init_ctx; 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 if (addrs == NULL) { 953 if (addrs == NULL) {
954 fp = org_fp; 954 fp = org_fp;
955 goto out_addrs; 955 goto out_addrs;
diff --git a/arch/powerpc/oprofile/cell/spu_profiler.c b/arch/powerpc/oprofile/cell/spu_profiler.c
index 5182f2936af2..4e099e556645 100644
--- a/arch/powerpc/oprofile/cell/spu_profiler.c
+++ b/arch/powerpc/oprofile/cell/spu_profiler.c
@@ -210,8 +210,8 @@ int start_spu_profiling_cycles(unsigned int cycles_reset)
210 timer.function = profile_spus; 210 timer.function = profile_spus;
211 211
212 /* Allocate arrays for collecting SPU PC samples */ 212 /* Allocate arrays for collecting SPU PC samples */
213 samples = kzalloc(SPUS_PER_NODE * 213 samples = kcalloc(SPUS_PER_NODE * TRACE_ARRAY_SIZE, sizeof(u32),
214 TRACE_ARRAY_SIZE * sizeof(u32), GFP_KERNEL); 214 GFP_KERNEL);
215 215
216 if (!samples) 216 if (!samples)
217 return -ENOMEM; 217 return -ENOMEM;
diff --git a/arch/powerpc/platforms/4xx/pci.c b/arch/powerpc/platforms/4xx/pci.c
index 73e6b36bcd51..5aca523551ae 100644
--- a/arch/powerpc/platforms/4xx/pci.c
+++ b/arch/powerpc/platforms/4xx/pci.c
@@ -1449,7 +1449,7 @@ static int __init ppc4xx_pciex_check_core_init(struct device_node *np)
1449 count = ppc4xx_pciex_hwops->core_init(np); 1449 count = ppc4xx_pciex_hwops->core_init(np);
1450 if (count > 0) { 1450 if (count > 0) {
1451 ppc4xx_pciex_ports = 1451 ppc4xx_pciex_ports =
1452 kzalloc(count * sizeof(struct ppc4xx_pciex_port), 1452 kcalloc(count, sizeof(struct ppc4xx_pciex_port),
1453 GFP_KERNEL); 1453 GFP_KERNEL);
1454 if (ppc4xx_pciex_ports) { 1454 if (ppc4xx_pciex_ports) {
1455 ppc4xx_pciex_port_count = count; 1455 ppc4xx_pciex_port_count = count;
diff --git a/arch/powerpc/platforms/powernv/opal-sysparam.c b/arch/powerpc/platforms/powernv/opal-sysparam.c
index 6fd4092798d5..9aa87df114fd 100644
--- a/arch/powerpc/platforms/powernv/opal-sysparam.c
+++ b/arch/powerpc/platforms/powernv/opal-sysparam.c
@@ -198,21 +198,21 @@ void __init opal_sys_param_init(void)
198 goto out_param_buf; 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 if (!id) { 202 if (!id) {
203 pr_err("SYSPARAM: Failed to allocate memory to read parameter " 203 pr_err("SYSPARAM: Failed to allocate memory to read parameter "
204 "id\n"); 204 "id\n");
205 goto out_param_buf; 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 if (!size) { 209 if (!size) {
210 pr_err("SYSPARAM: Failed to allocate memory to read parameter " 210 pr_err("SYSPARAM: Failed to allocate memory to read parameter "
211 "size\n"); 211 "size\n");
212 goto out_free_id; 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 if (!perm) { 216 if (!perm) {
217 pr_err("SYSPARAM: Failed to allocate memory to read supported " 217 pr_err("SYSPARAM: Failed to allocate memory to read supported "
218 "action on the parameter"); 218 "action on the parameter");
@@ -235,7 +235,7 @@ void __init opal_sys_param_init(void)
235 goto out_free_perm; 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 if (!attr) { 239 if (!attr) {
240 pr_err("SYSPARAM: Failed to allocate memory for parameter " 240 pr_err("SYSPARAM: Failed to allocate memory for parameter "
241 "attributes\n"); 241 "attributes\n");
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index df062a154ca8..353b43972bbf 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -544,7 +544,7 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
544 printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n"); 544 printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n");
545 545
546 /* Allocate fixups array */ 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 BUG_ON(mpic->fixups == NULL); 548 BUG_ON(mpic->fixups == NULL);
549 549
550 /* Init spinlock */ 550 /* Init spinlock */
@@ -1324,7 +1324,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1324 if (psrc) { 1324 if (psrc) {
1325 /* Allocate a bitmap with one bit per interrupt */ 1325 /* Allocate a bitmap with one bit per interrupt */
1326 unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1); 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 BUG_ON(mpic->protected == NULL); 1328 BUG_ON(mpic->protected == NULL);
1329 for (i = 0; i < psize/sizeof(u32); i++) { 1329 for (i = 0; i < psize/sizeof(u32); i++) {
1330 if (psrc[i] > intvec_top) 1330 if (psrc[i] > intvec_top)
diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c
index 83bcd72b21cf..311185b9960a 100644
--- a/arch/powerpc/sysdev/xive/native.c
+++ b/arch/powerpc/sysdev/xive/native.c
@@ -489,7 +489,7 @@ static bool xive_parse_provisioning(struct device_node *np)
489 if (rc == 0) 489 if (rc == 0)
490 return true; 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 GFP_KERNEL); 493 GFP_KERNEL);
494 if (WARN_ON(!xive_provision_chips)) 494 if (WARN_ON(!xive_provision_chips))
495 return false; 495 return false;
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index cb6e8066b1ad..ee6a9c387c87 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -391,7 +391,7 @@ int appldata_register_ops(struct appldata_ops *ops)
391 if (ops->size > APPLDATA_MAX_REC_SIZE) 391 if (ops->size > APPLDATA_MAX_REC_SIZE)
392 return -EINVAL; 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 if (!ops->ctl_table) 395 if (!ops->ctl_table)
396 return -ENOMEM; 396 return -ENOMEM;
397 397
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c
index f3a1c7c6824e..09abae40f917 100644
--- a/arch/s390/kernel/vdso.c
+++ b/arch/s390/kernel/vdso.c
@@ -285,7 +285,7 @@ static int __init vdso_init(void)
285 + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1; 285 + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1;
286 286
287 /* Make sure pages are in the correct state */ 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 GFP_KERNEL); 289 GFP_KERNEL);
290 BUG_ON(vdso32_pagelist == NULL); 290 BUG_ON(vdso32_pagelist == NULL);
291 for (i = 0; i < vdso32_pages - 1; i++) { 291 for (i = 0; i < vdso32_pages - 1; i++) {
@@ -303,7 +303,7 @@ static int __init vdso_init(void)
303 + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1; 303 + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1;
304 304
305 /* Make sure pages are in the correct state */ 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 GFP_KERNEL); 307 GFP_KERNEL);
308 BUG_ON(vdso64_pagelist == NULL); 308 BUG_ON(vdso64_pagelist == NULL);
309 for (i = 0; i < vdso64_pages - 1; i++) { 309 for (i = 0; i < vdso64_pages - 1; i++) {
diff --git a/arch/sh/drivers/dma/dmabrg.c b/arch/sh/drivers/dma/dmabrg.c
index c0dd904483c7..e5a57a109d6c 100644
--- a/arch/sh/drivers/dma/dmabrg.c
+++ b/arch/sh/drivers/dma/dmabrg.c
@@ -154,7 +154,7 @@ static int __init dmabrg_init(void)
154 unsigned long or; 154 unsigned long or;
155 int ret; 155 int ret;
156 156
157 dmabrg_handlers = kzalloc(10 * sizeof(struct dmabrg_handler), 157 dmabrg_handlers = kcalloc(10, sizeof(struct dmabrg_handler),
158 GFP_KERNEL); 158 GFP_KERNEL);
159 if (!dmabrg_handlers) 159 if (!dmabrg_handlers)
160 return -ENOMEM; 160 return -ENOMEM;
diff --git a/arch/sh/drivers/pci/pcie-sh7786.c b/arch/sh/drivers/pci/pcie-sh7786.c
index 382e7ecf4c82..3d81a8b80942 100644
--- a/arch/sh/drivers/pci/pcie-sh7786.c
+++ b/arch/sh/drivers/pci/pcie-sh7786.c
@@ -561,7 +561,7 @@ static int __init sh7786_pcie_init(void)
561 if (unlikely(nr_ports == 0)) 561 if (unlikely(nr_ports == 0))
562 return -ENODEV; 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 GFP_KERNEL); 565 GFP_KERNEL);
566 if (unlikely(!sh7786_pcie_ports)) 566 if (unlikely(!sh7786_pcie_ports))
567 return -ENOMEM; 567 return -ENOMEM;
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 33e351704f9f..63baa8aa9414 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -565,7 +565,8 @@ SYSCALL_DEFINE5(utrap_install, utrap_entry_t, type,
565 } 565 }
566 if (!current_thread_info()->utraps) { 566 if (!current_thread_info()->utraps) {
567 current_thread_info()->utraps = 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 if (!current_thread_info()->utraps) 570 if (!current_thread_info()->utraps)
570 return -ENOMEM; 571 return -ENOMEM;
571 current_thread_info()->utraps[0] = 1; 572 current_thread_info()->utraps[0] = 1;
diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
index 38b5d41b0c37..3210fee27e7f 100644
--- a/arch/x86/events/amd/iommu.c
+++ b/arch/x86/events/amd/iommu.c
@@ -387,7 +387,7 @@ static __init int _init_events_attrs(void)
387 while (amd_iommu_v2_event_descs[i].attr.attr.name) 387 while (amd_iommu_v2_event_descs[i].attr.attr.name)
388 i++; 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 if (!attrs) 391 if (!attrs)
392 return -ENOMEM; 392 return -ENOMEM;
393 393
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index e15cfad4f89b..27a461414b30 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -868,7 +868,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
868 size_t size; 868 size_t size;
869 int i, j; 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 if (!pmus) 872 if (!pmus)
873 return -ENOMEM; 873 return -ENOMEM;
874 874
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index cd76380af79f..e4cf6ff1c2e1 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1457,7 +1457,7 @@ static int __mcheck_cpu_mce_banks_init(void)
1457 int i; 1457 int i;
1458 u8 num_banks = mca_cfg.banks; 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 if (!mce_banks) 1461 if (!mce_banks)
1462 return -ENOMEM; 1462 return -ENOMEM;
1463 1463
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index f591b01930db..dd33c357548f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -1384,7 +1384,7 @@ int mce_threshold_create_device(unsigned int cpu)
1384 if (bp) 1384 if (bp)
1385 return 0; 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 GFP_KERNEL); 1388 GFP_KERNEL);
1389 if (!bp) 1389 if (!bp)
1390 return -ENOMEM; 1390 return -ENOMEM;
diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c
index c610f47373e4..4021d3859499 100644
--- a/arch/x86/kernel/cpu/mtrr/if.c
+++ b/arch/x86/kernel/cpu/mtrr/if.c
@@ -43,7 +43,7 @@ mtrr_file_add(unsigned long base, unsigned long size,
43 43
44 max = num_var_ranges; 44 max = num_var_ranges;
45 if (fcount == NULL) { 45 if (fcount == NULL) {
46 fcount = kzalloc(max * sizeof *fcount, GFP_KERNEL); 46 fcount = kcalloc(max, sizeof(*fcount), GFP_KERNEL);
47 if (!fcount) 47 if (!fcount)
48 return -ENOMEM; 48 return -ENOMEM;
49 FILE_FCOUNT(file) = fcount; 49 FILE_FCOUNT(file) = fcount;
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index ddccdea0b63b..346b24883911 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -610,7 +610,7 @@ static void hpet_msi_capability_lookup(unsigned int start_timer)
610 if (!hpet_domain) 610 if (!hpet_domain)
611 return; 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 if (!hpet_devs) 614 if (!hpet_devs)
615 return; 615 return;
616 616
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 9542a746dc50..9112d1cb397b 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -168,7 +168,7 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
168 if (type == PCI_CAP_ID_MSI && nvec > 1) 168 if (type == PCI_CAP_ID_MSI && nvec > 1)
169 return 1; 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 if (!v) 172 if (!v)
173 return -ENOMEM; 173 return -ENOMEM;
174 174
diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c
index b082d71b08ee..a36b368eea08 100644
--- a/arch/x86/platform/uv/uv_time.c
+++ b/arch/x86/platform/uv/uv_time.c
@@ -158,7 +158,7 @@ static __init int uv_rtc_allocate_timers(void)
158{ 158{
159 int cpu; 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 if (!blade_info) 162 if (!blade_info)
163 return -ENOMEM; 163 return -ENOMEM;
164 164
diff --git a/block/bio.c b/block/bio.c
index db9a40e9a136..9710e275f230 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -2091,7 +2091,8 @@ static int __init init_bio(void)
2091{ 2091{
2092 bio_slab_max = 2; 2092 bio_slab_max = 2;
2093 bio_slab_nr = 0; 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 if (!bio_slabs) 2096 if (!bio_slabs)
2096 panic("bio: can't allocate bios\n"); 2097 panic("bio: can't allocate bios\n");
2097 2098
diff --git a/block/blk-tag.c b/block/blk-tag.c
index 09f19c6c52ce..24b20d86bcbc 100644
--- a/block/blk-tag.c
+++ b/block/blk-tag.c
@@ -99,12 +99,12 @@ init_tag_map(struct request_queue *q, struct blk_queue_tag *tags, int depth)
99 __func__, depth); 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 if (!tag_index) 103 if (!tag_index)
104 goto fail; 104 goto fail;
105 105
106 nr_ulongs = ALIGN(depth, BITS_PER_LONG) / BITS_PER_LONG; 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 if (!tag_map) 108 if (!tag_map)
109 goto fail; 109 goto fail;
110 110
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 88cd949003f3..eaa60c94205a 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -82,7 +82,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
82 if (count < 0) { 82 if (count < 0) {
83 return NULL; 83 return NULL;
84 } else if (count > 0) { 84 } else if (count > 0) {
85 resources = kzalloc(count * sizeof(struct resource), 85 resources = kcalloc(count, sizeof(struct resource),
86 GFP_KERNEL); 86 GFP_KERNEL);
87 if (!resources) { 87 if (!resources) {
88 dev_err(&adev->dev, "No memory for resources\n"); 88 dev_err(&adev->dev, "No memory for resources\n");
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 4fc59c3bc673..41324f0b1bee 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -857,12 +857,12 @@ void acpi_irq_stats_init(void)
857 num_gpes = acpi_current_gpe_count; 857 num_gpes = acpi_current_gpe_count;
858 num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; 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 GFP_KERNEL); 861 GFP_KERNEL);
862 if (all_attrs == NULL) 862 if (all_attrs == NULL)
863 return; 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 GFP_KERNEL); 866 GFP_KERNEL);
867 if (all_counters == NULL) 867 if (all_counters == NULL)
868 goto fail; 868 goto fail;
@@ -871,7 +871,7 @@ void acpi_irq_stats_init(void)
871 if (ACPI_FAILURE(status)) 871 if (ACPI_FAILURE(status))
872 goto fail; 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 GFP_KERNEL); 875 GFP_KERNEL);
876 if (counter_attrs == NULL) 876 if (counter_attrs == NULL)
877 goto fail; 877 goto fail;
diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c
index 4f382d51def1..2628806c64a2 100644
--- a/drivers/android/binder_alloc.c
+++ b/drivers/android/binder_alloc.c
@@ -692,8 +692,8 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc,
692 } 692 }
693 } 693 }
694#endif 694#endif
695 alloc->pages = kzalloc(sizeof(alloc->pages[0]) * 695 alloc->pages = kcalloc((vma->vm_end - vma->vm_start) / PAGE_SIZE,
696 ((vma->vm_end - vma->vm_start) / PAGE_SIZE), 696 sizeof(alloc->pages[0]),
697 GFP_KERNEL); 697 GFP_KERNEL);
698 if (alloc->pages == NULL) { 698 if (alloc->pages == NULL) {
699 ret = -ENOMEM; 699 ret = -ENOMEM;
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c41b9eeabe7c..27d15ed7fa3d 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6987,7 +6987,7 @@ static void __init ata_parse_force_param(void)
6987 if (*p == ',') 6987 if (*p == ',')
6988 size++; 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 if (!ata_force_tbl) { 6991 if (!ata_force_tbl) {
6992 printk(KERN_WARNING "ata: failed to extend force table, " 6992 printk(KERN_WARNING "ata: failed to extend force table, "
6993 "libata.force ignored\n"); 6993 "libata.force ignored\n");
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index 85aa76116a30..2ae1799f4992 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -340,7 +340,7 @@ static int sata_pmp_init_links (struct ata_port *ap, int nr_ports)
340 int i, err; 340 int i, err;
341 341
342 if (!pmp_link) { 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 GFP_NOIO); 344 GFP_NOIO);
345 if (!pmp_link) 345 if (!pmp_link)
346 return -ENOMEM; 346 return -ENOMEM;
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 6ebc4e4820fc..99a38115b0a8 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2094,7 +2094,8 @@ static int fore200e_alloc_rx_buf(struct fore200e *fore200e)
2094 DPRINTK(2, "rx buffers %d / %d are being allocated\n", scheme, magn); 2094 DPRINTK(2, "rx buffers %d / %d are being allocated\n", scheme, magn);
2095 2095
2096 /* allocate the array of receive buffers */ 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 if (buffer == NULL) 2100 if (buffer == NULL)
2100 return -ENOMEM; 2101 return -ENOMEM;
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index be076606d30e..ff81a576347e 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -1618,7 +1618,7 @@ static int rx_init(struct atm_dev *dev)
1618 skb_queue_head_init(&iadev->rx_dma_q); 1618 skb_queue_head_init(&iadev->rx_dma_q);
1619 iadev->rx_free_desc_qhead = NULL; 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 if (!iadev->rx_open) { 1622 if (!iadev->rx_open) {
1623 printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n", 1623 printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n",
1624 dev->number); 1624 dev->number);
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 7655d6133139..a80809bd3057 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -511,7 +511,8 @@ static void drbd_calc_cpu_mask(cpumask_var_t *cpu_mask)
511{ 511{
512 unsigned int *resources_per_cpu, min_index = ~0; 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 if (resources_per_cpu) { 516 if (resources_per_cpu) {
516 struct drbd_resource *resource; 517 struct drbd_resource *resource;
517 unsigned int cpu, min = ~0; 518 unsigned int cpu, min = ~0;
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 2bdadd7f1454..7948049f6c43 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -1575,12 +1575,12 @@ static int setup_commands(struct nullb_queue *nq)
1575 struct nullb_cmd *cmd; 1575 struct nullb_cmd *cmd;
1576 int i, tag_size; 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 if (!nq->cmds) 1579 if (!nq->cmds)
1580 return -ENOMEM; 1580 return -ENOMEM;
1581 1581
1582 tag_size = ALIGN(nq->queue_depth, BITS_PER_LONG) / BITS_PER_LONG; 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 if (!nq->tag_map) { 1584 if (!nq->tag_map) {
1585 kfree(nq->cmds); 1585 kfree(nq->cmds);
1586 return -ENOMEM; 1586 return -ENOMEM;
@@ -1598,8 +1598,9 @@ static int setup_commands(struct nullb_queue *nq)
1598 1598
1599static int setup_queues(struct nullb *nullb) 1599static int setup_queues(struct nullb *nullb)
1600{ 1600{
1601 nullb->queues = kzalloc(nullb->dev->submit_queues * 1601 nullb->queues = kcalloc(nullb->dev->submit_queues,
1602 sizeof(struct nullb_queue), GFP_KERNEL); 1602 sizeof(struct nullb_queue),
1603 GFP_KERNEL);
1603 if (!nullb->queues) 1604 if (!nullb->queues)
1604 return -ENOMEM; 1605 return -ENOMEM;
1605 1606
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index 8fa4533a1249..1e3d5de9d838 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -407,8 +407,9 @@ static int ps3vram_cache_init(struct ps3_system_bus_device *dev)
407 407
408 priv->cache.page_count = CACHE_PAGE_COUNT; 408 priv->cache.page_count = CACHE_PAGE_COUNT;
409 priv->cache.page_size = CACHE_PAGE_SIZE; 409 priv->cache.page_size = CACHE_PAGE_SIZE;
410 priv->cache.tags = kzalloc(sizeof(struct ps3vram_tag) * 410 priv->cache.tags = kcalloc(CACHE_PAGE_COUNT,
411 CACHE_PAGE_COUNT, GFP_KERNEL); 411 sizeof(struct ps3vram_tag),
412 GFP_KERNEL);
412 if (!priv->cache.tags) 413 if (!priv->cache.tags)
413 return -ENOMEM; 414 return -ENOMEM;
414 415
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 09537bee387f..b7d71914a32a 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -873,7 +873,8 @@ static int rsxx_pci_probe(struct pci_dev *dev,
873 dev_info(CARD_TO_DEV(card), 873 dev_info(CARD_TO_DEV(card),
874 "Failed reading the number of DMA targets\n"); 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 if (!card->ctrl) { 878 if (!card->ctrl) {
878 st = -ENOMEM; 879 st = -ENOMEM;
879 goto failed_dma_setup; 880 goto failed_dma_setup;
diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c
index beaccf197a5a..8fbc1bf6db3d 100644
--- a/drivers/block/rsxx/dma.c
+++ b/drivers/block/rsxx/dma.c
@@ -1038,7 +1038,7 @@ int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card)
1038 struct rsxx_dma *dma; 1038 struct rsxx_dma *dma;
1039 struct list_head *issued_dmas; 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 GFP_KERNEL); 1042 GFP_KERNEL);
1043 if (!issued_dmas) 1043 if (!issued_dmas)
1044 return -ENOMEM; 1044 return -ENOMEM;
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 66412eededda..a4bc74e72c39 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -139,7 +139,8 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif)
139{ 139{
140 unsigned int r; 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 if (!blkif->rings) 144 if (!blkif->rings)
144 return -ENOMEM; 145 return -ENOMEM;
145 146
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index ae00a82f350b..b5cedccb5d7d 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1906,7 +1906,9 @@ static int negotiate_mq(struct blkfront_info *info)
1906 if (!info->nr_rings) 1906 if (!info->nr_rings)
1907 info->nr_rings = 1; 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 if (!info->rinfo) { 1912 if (!info->rinfo) {
1911 xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure"); 1913 xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure");
1912 return -ENOMEM; 1914 return -ENOMEM;
@@ -2216,15 +2218,18 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
2216 } 2218 }
2217 2219
2218 for (i = 0; i < BLK_RING_SIZE(info); i++) { 2220 for (i = 0; i < BLK_RING_SIZE(info); i++) {
2219 rinfo->shadow[i].grants_used = kzalloc( 2221 rinfo->shadow[i].grants_used =
2220 sizeof(rinfo->shadow[i].grants_used[0]) * grants, 2222 kcalloc(grants,
2221 GFP_NOIO); 2223 sizeof(rinfo->shadow[i].grants_used[0]),
2222 rinfo->shadow[i].sg = kzalloc(sizeof(rinfo->shadow[i].sg[0]) * psegs, GFP_NOIO);
2223 if (info->max_indirect_segments)
2224 rinfo->shadow[i].indirect_grants = kzalloc(
2225 sizeof(rinfo->shadow[i].indirect_grants[0]) *
2226 INDIRECT_GREFS(grants),
2227 GFP_NOIO); 2224 GFP_NOIO);
2225 rinfo->shadow[i].sg = kcalloc(psegs,
2226 sizeof(rinfo->shadow[i].sg[0]),
2227 GFP_NOIO);
2228 if (info->max_indirect_segments)
2229 rinfo->shadow[i].indirect_grants =
2230 kcalloc(INDIRECT_GREFS(grants),
2231 sizeof(rinfo->shadow[i].indirect_grants[0]),
2232 GFP_NOIO);
2228 if ((rinfo->shadow[i].grants_used == NULL) || 2233 if ((rinfo->shadow[i].grants_used == NULL) ||
2229 (rinfo->shadow[i].sg == NULL) || 2234 (rinfo->shadow[i].sg == NULL) ||
2230 (info->max_indirect_segments && 2235 (info->max_indirect_segments &&
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index b450544dcaf0..6914e4f0ce98 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -85,7 +85,8 @@ static int amd_create_gatt_pages(int nr_tables)
85 int retval = 0; 85 int retval = 0;
86 int i; 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 if (tables == NULL) 90 if (tables == NULL)
90 return -ENOMEM; 91 return -ENOMEM;
91 92
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 88b4cbee4dac..20bf5f78a362 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -108,7 +108,8 @@ static int ati_create_gatt_pages(int nr_tables)
108 int retval = 0; 108 int retval = 0;
109 int i; 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 if (tables == NULL) 113 if (tables == NULL)
113 return -ENOMEM; 114 return -ENOMEM;
114 115
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 4dbdd3bc9bb8..7729414100ff 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -96,7 +96,7 @@ static int serverworks_create_gatt_pages(int nr_tables)
96 int retval = 0; 96 int retval = 0;
97 int i; 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 GFP_KERNEL); 100 GFP_KERNEL);
101 if (tables == NULL) 101 if (tables == NULL)
102 return -ENOMEM; 102 return -ENOMEM;
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index 22f634eb09fd..18e4650c233b 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -1757,7 +1757,8 @@ static unsigned short *ssif_address_list(void)
1757 list_for_each_entry(info, &ssif_infos, link) 1757 list_for_each_entry(info, &ssif_infos, link)
1758 count++; 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 if (!address_list) 1762 if (!address_list)
1762 return NULL; 1763 return NULL;
1763 1764
diff --git a/drivers/clk/renesas/clk-r8a7740.c b/drivers/clk/renesas/clk-r8a7740.c
index d074f8e982d0..a7a30d2eca41 100644
--- a/drivers/clk/renesas/clk-r8a7740.c
+++ b/drivers/clk/renesas/clk-r8a7740.c
@@ -161,7 +161,7 @@ static void __init r8a7740_cpg_clocks_init(struct device_node *np)
161 } 161 }
162 162
163 cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 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 if (cpg == NULL || clks == NULL) { 165 if (cpg == NULL || clks == NULL) {
166 /* We're leaking memory on purpose, there's no point in cleaning 166 /* We're leaking memory on purpose, there's no point in cleaning
167 * up as the system won't boot anyway. 167 * up as the system won't boot anyway.
diff --git a/drivers/clk/renesas/clk-r8a7779.c b/drivers/clk/renesas/clk-r8a7779.c
index 27fbfafaf2cd..5adcca4656c3 100644
--- a/drivers/clk/renesas/clk-r8a7779.c
+++ b/drivers/clk/renesas/clk-r8a7779.c
@@ -138,7 +138,7 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
138 } 138 }
139 139
140 cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 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 if (cpg == NULL || clks == NULL) { 142 if (cpg == NULL || clks == NULL) {
143 /* We're leaking memory on purpose, there's no point in cleaning 143 /* We're leaking memory on purpose, there's no point in cleaning
144 * up as the system won't boot anyway. 144 * up as the system won't boot anyway.
diff --git a/drivers/clk/renesas/clk-rcar-gen2.c b/drivers/clk/renesas/clk-rcar-gen2.c
index ee32a022e6da..bccd62f2cb09 100644
--- a/drivers/clk/renesas/clk-rcar-gen2.c
+++ b/drivers/clk/renesas/clk-rcar-gen2.c
@@ -417,7 +417,7 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)
417 } 417 }
418 418
419 cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 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 if (cpg == NULL || clks == NULL) { 421 if (cpg == NULL || clks == NULL) {
422 /* We're leaking memory on purpose, there's no point in cleaning 422 /* We're leaking memory on purpose, there's no point in cleaning
423 * up as the system won't boot anyway. 423 * up as the system won't boot anyway.
diff --git a/drivers/clk/renesas/clk-rz.c b/drivers/clk/renesas/clk-rz.c
index 67dd712aa723..ac2f86d626b6 100644
--- a/drivers/clk/renesas/clk-rz.c
+++ b/drivers/clk/renesas/clk-rz.c
@@ -97,7 +97,7 @@ static void __init rz_cpg_clocks_init(struct device_node *np)
97 return; 97 return;
98 98
99 cpg = kzalloc(sizeof(*cpg), GFP_KERNEL); 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 BUG_ON(!cpg || !clks); 101 BUG_ON(!cpg || !clks);
102 102
103 cpg->data.clks = clks; 103 cpg->data.clks = clks;
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
index 14819d919df1..a79d81985c4e 100644
--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -874,7 +874,7 @@ static void __init st_of_create_quadfs_fsynths(
874 return; 874 return;
875 875
876 clk_data->clk_num = QUADFS_MAX_CHAN; 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 GFP_KERNEL); 878 GFP_KERNEL);
879 879
880 if (!clk_data->clks) { 880 if (!clk_data->clks) {
diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c
index 25bda48a5d35..7a7106dc80bf 100644
--- a/drivers/clk/st/clkgen-pll.c
+++ b/drivers/clk/st/clkgen-pll.c
@@ -738,7 +738,7 @@ static void __init clkgen_c32_pll_setup(struct device_node *np,
738 return; 738 return;
739 739
740 clk_data->clk_num = num_odfs; 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 GFP_KERNEL); 742 GFP_KERNEL);
743 743
744 if (!clk_data->clks) 744 if (!clk_data->clks)
diff --git a/drivers/clk/sunxi/clk-usb.c b/drivers/clk/sunxi/clk-usb.c
index fe0c3d169377..917fc27a33dd 100644
--- a/drivers/clk/sunxi/clk-usb.c
+++ b/drivers/clk/sunxi/clk-usb.c
@@ -122,7 +122,7 @@ static void __init sunxi_usb_clk_setup(struct device_node *node,
122 if (!clk_data) 122 if (!clk_data)
123 return; 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 if (!clk_data->clks) { 126 if (!clk_data->clks) {
127 kfree(clk_data); 127 kfree(clk_data);
128 return; 128 return;
diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c
index 593d76a114f9..ffaf17f71860 100644
--- a/drivers/clk/tegra/clk.c
+++ b/drivers/clk/tegra/clk.c
@@ -216,14 +216,15 @@ struct clk ** __init tegra_clk_init(void __iomem *regs, int num, int banks)
216 if (WARN_ON(banks > ARRAY_SIZE(periph_regs))) 216 if (WARN_ON(banks > ARRAY_SIZE(periph_regs)))
217 return NULL; 217 return NULL;
218 218
219 periph_clk_enb_refcnt = kzalloc(32 * banks * 219 periph_clk_enb_refcnt = kcalloc(32 * banks,
220 sizeof(*periph_clk_enb_refcnt), GFP_KERNEL); 220 sizeof(*periph_clk_enb_refcnt),
221 GFP_KERNEL);
221 if (!periph_clk_enb_refcnt) 222 if (!periph_clk_enb_refcnt)
222 return NULL; 223 return NULL;
223 224
224 periph_banks = banks; 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 if (!clks) 228 if (!clks)
228 kfree(periph_clk_enb_refcnt); 229 kfree(periph_clk_enb_refcnt);
229 230
diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c
index 9498e9363b57..61c126a5d26a 100644
--- a/drivers/clk/ti/apll.c
+++ b/drivers/clk/ti/apll.c
@@ -206,7 +206,7 @@ static void __init of_dra7_apll_setup(struct device_node *node)
206 goto cleanup; 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 if (!parent_names) 210 if (!parent_names)
211 goto cleanup; 211 goto cleanup;
212 212
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c
index aaa277dd6d99..ccfb4d9a152a 100644
--- a/drivers/clk/ti/divider.c
+++ b/drivers/clk/ti/divider.c
@@ -366,7 +366,7 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
366 366
367 num_dividers = i; 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 if (!tmp) 370 if (!tmp)
371 return -ENOMEM; 371 return -ENOMEM;
372 372
@@ -496,7 +496,7 @@ __init ti_clk_get_div_table(struct device_node *node)
496 return ERR_PTR(-EINVAL); 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 if (!table) 501 if (!table)
502 return ERR_PTR(-ENOMEM); 502 return ERR_PTR(-ENOMEM);
diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c
index 7d33ca9042cb..dc86d07d0921 100644
--- a/drivers/clk/ti/dpll.c
+++ b/drivers/clk/ti/dpll.c
@@ -309,7 +309,7 @@ static void __init of_ti_dpll_setup(struct device_node *node,
309 goto cleanup; 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 if (!parent_names) 313 if (!parent_names)
314 goto cleanup; 314 goto cleanup;
315 315
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 70b3cf8e23d0..bbbf37c471a3 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -1000,7 +1000,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
1000 1000
1001 /* Allocate and setup the channels. */ 1001 /* Allocate and setup the channels. */
1002 cmt->num_channels = hweight8(cmt->hw_channels); 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 GFP_KERNEL); 1004 GFP_KERNEL);
1005 if (cmt->channels == NULL) { 1005 if (cmt->channels == NULL) {
1006 ret = -ENOMEM; 1006 ret = -ENOMEM;
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 53aa7e92a7d7..6812e099b6a3 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -418,7 +418,7 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
418 /* Allocate and setup the channels. */ 418 /* Allocate and setup the channels. */
419 mtu->num_channels = 3; 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 GFP_KERNEL); 422 GFP_KERNEL);
423 if (mtu->channels == NULL) { 423 if (mtu->channels == NULL) {
424 ret = -ENOMEM; 424 ret = -ENOMEM;
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 31d881621e41..c74a6c543ca2 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -569,7 +569,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
569 } 569 }
570 570
571 /* Allocate and setup the channels. */ 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 GFP_KERNEL); 573 GFP_KERNEL);
574 if (tmu->channels == NULL) { 574 if (tmu->channels == NULL) {
575 ret = -ENOMEM; 575 ret = -ENOMEM;
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 9449657d72f0..8ff1c9123834 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -759,8 +759,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
759 goto err_unreg; 759 goto err_unreg;
760 } 760 }
761 761
762 freq_table = kzalloc(sizeof(*freq_table) * 762 freq_table = kcalloc(perf->state_count + 1, sizeof(*freq_table),
763 (perf->state_count+1), GFP_KERNEL); 763 GFP_KERNEL);
764 if (!freq_table) { 764 if (!freq_table) {
765 result = -ENOMEM; 765 result = -ENOMEM;
766 goto err_unreg; 766 goto err_unreg;
diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 1d7ef5fc1977..cf62a1f64dd7 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -280,7 +280,7 @@ static int merge_cluster_tables(void)
280 for (i = 0; i < MAX_CLUSTERS; i++) 280 for (i = 0; i < MAX_CLUSTERS; i++)
281 count += get_table_count(freq_table[i]); 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 if (!table) 284 if (!table)
285 return -ENOMEM; 285 return -ENOMEM;
286 286
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 3464580ac3ca..a9d3eec32795 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -313,7 +313,8 @@ static int __init cppc_cpufreq_init(void)
313 if (acpi_disabled) 313 if (acpi_disabled)
314 return -ENODEV; 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 if (!all_cpu_data) 318 if (!all_cpu_data)
318 return -ENOMEM; 319 return -ENOMEM;
319 320
diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c b/drivers/cpufreq/ia64-acpi-cpufreq.c
index 7974a2fdb760..dd5440d3372d 100644
--- a/drivers/cpufreq/ia64-acpi-cpufreq.c
+++ b/drivers/cpufreq/ia64-acpi-cpufreq.c
@@ -241,8 +241,8 @@ acpi_cpufreq_cpu_init (
241 } 241 }
242 242
243 /* alloc freq_table */ 243 /* alloc freq_table */
244 freq_table = kzalloc(sizeof(*freq_table) * 244 freq_table = kcalloc(data->acpi_data.state_count + 1,
245 (data->acpi_data.state_count + 1), 245 sizeof(*freq_table),
246 GFP_KERNEL); 246 GFP_KERNEL);
247 if (!freq_table) { 247 if (!freq_table) {
248 result = -ENOMEM; 248 result = -ENOMEM;
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
index 61a4c5b08219..279bd9e9fa95 100644
--- a/drivers/cpufreq/longhaul.c
+++ b/drivers/cpufreq/longhaul.c
@@ -474,8 +474,8 @@ static int longhaul_get_ranges(void)
474 return -EINVAL; 474 return -EINVAL;
475 } 475 }
476 476
477 longhaul_table = kzalloc((numscales + 1) * sizeof(*longhaul_table), 477 longhaul_table = kcalloc(numscales + 1, sizeof(*longhaul_table),
478 GFP_KERNEL); 478 GFP_KERNEL);
479 if (!longhaul_table) 479 if (!longhaul_table)
480 return -ENOMEM; 480 return -ENOMEM;
481 481
diff --git a/drivers/cpufreq/pxa3xx-cpufreq.c b/drivers/cpufreq/pxa3xx-cpufreq.c
index 7acc7fa4536d..9daa2cc318bb 100644
--- a/drivers/cpufreq/pxa3xx-cpufreq.c
+++ b/drivers/cpufreq/pxa3xx-cpufreq.c
@@ -93,7 +93,7 @@ static int setup_freqs_table(struct cpufreq_policy *policy,
93 struct cpufreq_frequency_table *table; 93 struct cpufreq_frequency_table *table;
94 int i; 94 int i;
95 95
96 table = kzalloc((num + 1) * sizeof(*table), GFP_KERNEL); 96 table = kcalloc(num + 1, sizeof(*table), GFP_KERNEL);
97 if (table == NULL) 97 if (table == NULL)
98 return -ENOMEM; 98 return -ENOMEM;
99 99
diff --git a/drivers/cpufreq/s3c24xx-cpufreq.c b/drivers/cpufreq/s3c24xx-cpufreq.c
index 909bd6e27639..3b291a2b0cb3 100644
--- a/drivers/cpufreq/s3c24xx-cpufreq.c
+++ b/drivers/cpufreq/s3c24xx-cpufreq.c
@@ -562,7 +562,7 @@ static int s3c_cpufreq_build_freq(void)
562 size = cpu_cur.info->calc_freqtable(&cpu_cur, NULL, 0); 562 size = cpu_cur.info->calc_freqtable(&cpu_cur, NULL, 0);
563 size++; 563 size++;
564 564
565 ftab = kzalloc(sizeof(*ftab) * size, GFP_KERNEL); 565 ftab = kcalloc(size, sizeof(*ftab), GFP_KERNEL);
566 if (!ftab) 566 if (!ftab)
567 return -ENOMEM; 567 return -ENOMEM;
568 568
diff --git a/drivers/cpufreq/sfi-cpufreq.c b/drivers/cpufreq/sfi-cpufreq.c
index 9767afe05da2..978770432b13 100644
--- a/drivers/cpufreq/sfi-cpufreq.c
+++ b/drivers/cpufreq/sfi-cpufreq.c
@@ -95,8 +95,8 @@ static int __init sfi_cpufreq_init(void)
95 if (ret) 95 if (ret)
96 return ret; 96 return ret;
97 97
98 freq_table = kzalloc(sizeof(*freq_table) * 98 freq_table = kcalloc(num_freq_table_entries + 1, sizeof(*freq_table),
99 (num_freq_table_entries + 1), GFP_KERNEL); 99 GFP_KERNEL);
100 if (!freq_table) { 100 if (!freq_table) {
101 ret = -ENOMEM; 101 ret = -ENOMEM;
102 goto err_free_array; 102 goto err_free_array;
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
index 195f27f9c1cb..4074e2615522 100644
--- a/drivers/cpufreq/spear-cpufreq.c
+++ b/drivers/cpufreq/spear-cpufreq.c
@@ -195,7 +195,7 @@ static int spear_cpufreq_probe(struct platform_device *pdev)
195 cnt = prop->length / sizeof(u32); 195 cnt = prop->length / sizeof(u32);
196 val = prop->value; 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 if (!freq_tbl) { 199 if (!freq_tbl) {
200 ret = -ENOMEM; 200 ret = -ENOMEM;
201 goto out_put_node; 201 goto out_put_node;
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 9cb234c72549..05981ccd9901 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -141,11 +141,11 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
141 141
142int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size) 142int 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 if (ctx->sa_in == NULL) 145 if (ctx->sa_in == NULL)
146 return -ENOMEM; 146 return -ENOMEM;
147 147
148 ctx->sa_out = kzalloc(size * 4, GFP_ATOMIC); 148 ctx->sa_out = kcalloc(size, 4, GFP_ATOMIC);
149 if (ctx->sa_out == NULL) { 149 if (ctx->sa_out == NULL) {
150 kfree(ctx->sa_in); 150 kfree(ctx->sa_in);
151 ctx->sa_in = NULL; 151 ctx->sa_in = NULL;
@@ -180,8 +180,8 @@ static u32 crypto4xx_build_pdr(struct crypto4xx_device *dev)
180 if (!dev->pdr) 180 if (!dev->pdr)
181 return -ENOMEM; 181 return -ENOMEM;
182 182
183 dev->pdr_uinfo = kzalloc(sizeof(struct pd_uinfo) * PPC4XX_NUM_PD, 183 dev->pdr_uinfo = kcalloc(PPC4XX_NUM_PD, sizeof(struct pd_uinfo),
184 GFP_KERNEL); 184 GFP_KERNEL);
185 if (!dev->pdr_uinfo) { 185 if (!dev->pdr_uinfo) {
186 dma_free_coherent(dev->core_dev->device, 186 dma_free_coherent(dev->core_dev->device,
187 sizeof(struct ce_pd) * PPC4XX_NUM_PD, 187 sizeof(struct ce_pd) * PPC4XX_NUM_PD,
diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
index d138d6b8fec5..c77b0e1655a8 100644
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -922,7 +922,7 @@ int safexcel_hmac_setkey(const char *alg, const u8 *key, unsigned int keylen,
922 crypto_ahash_clear_flags(tfm, ~0); 922 crypto_ahash_clear_flags(tfm, ~0);
923 blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm)); 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 if (!ipad) { 926 if (!ipad) {
927 ret = -ENOMEM; 927 ret = -ENOMEM;
928 goto free_request; 928 goto free_request;
diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c
index e61b08566093..e34d80b6b7e5 100644
--- a/drivers/crypto/marvell/hash.c
+++ b/drivers/crypto/marvell/hash.c
@@ -1198,7 +1198,7 @@ static int mv_cesa_ahmac_setkey(const char *hash_alg_name,
1198 1198
1199 blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm)); 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 if (!ipad) { 1202 if (!ipad) {
1203 ret = -ENOMEM; 1203 ret = -ENOMEM;
1204 goto free_req; 1204 goto free_req;
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 80e9c842aad4..ab6235b7ff22 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -1919,12 +1919,12 @@ static int grab_global_resources(void)
1919 goto out_hvapi_release; 1919 goto out_hvapi_release;
1920 1920
1921 err = -ENOMEM; 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 GFP_KERNEL); 1923 GFP_KERNEL);
1924 if (!cpu_to_cwq) 1924 if (!cpu_to_cwq)
1925 goto out_queue_cache_destroy; 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 GFP_KERNEL); 1928 GFP_KERNEL);
1929 if (!cpu_to_mau) 1929 if (!cpu_to_mau)
1930 goto out_free_cwq_table; 1930 goto out_free_cwq_table;
diff --git a/drivers/crypto/qat/qat_common/qat_uclo.c b/drivers/crypto/qat/qat_common/qat_uclo.c
index 98d22c2096e3..6bd8f6a2a24f 100644
--- a/drivers/crypto/qat/qat_common/qat_uclo.c
+++ b/drivers/crypto/qat/qat_common/qat_uclo.c
@@ -1162,8 +1162,9 @@ static int qat_uclo_map_suof(struct icp_qat_fw_loader_handle *handle,
1162 suof_handle->img_table.num_simgs = suof_ptr->num_chunks - 1; 1162 suof_handle->img_table.num_simgs = suof_ptr->num_chunks - 1;
1163 1163
1164 if (suof_handle->img_table.num_simgs != 0) { 1164 if (suof_handle->img_table.num_simgs != 0) {
1165 suof_img_hdr = kzalloc(suof_handle->img_table.num_simgs * 1165 suof_img_hdr = kcalloc(suof_handle->img_table.num_simgs,
1166 sizeof(img_header), GFP_KERNEL); 1166 sizeof(img_header),
1167 GFP_KERNEL);
1167 if (!suof_img_hdr) 1168 if (!suof_img_hdr)
1168 return -ENOMEM; 1169 return -ENOMEM;
1169 suof_handle->img_table.simg_hdr = suof_img_hdr; 1170 suof_handle->img_table.simg_hdr = suof_img_hdr;
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index 7792a9186f9c..4fa4c06c9edb 100644
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -322,10 +322,10 @@ static int ioat_dma_self_test(struct ioatdma_device *ioat_dma)
322 unsigned long tmo; 322 unsigned long tmo;
323 unsigned long flags; 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 if (!src) 326 if (!src)
327 return -ENOMEM; 327 return -ENOMEM;
328 dest = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); 328 dest = kzalloc(IOAT_TEST_SIZE, GFP_KERNEL);
329 if (!dest) { 329 if (!dest) {
330 kfree(src); 330 kfree(src);
331 return -ENOMEM; 331 return -ENOMEM;
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 4528b560dc4c..969534c1a6c6 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -781,7 +781,7 @@ static int mv_chan_memcpy_self_test(struct mv_xor_chan *mv_chan)
781 if (!src) 781 if (!src)
782 return -ENOMEM; 782 return -ENOMEM;
783 783
784 dest = kzalloc(sizeof(u8) * PAGE_SIZE, GFP_KERNEL); 784 dest = kzalloc(PAGE_SIZE, GFP_KERNEL);
785 if (!dest) { 785 if (!dest) {
786 kfree(src); 786 kfree(src);
787 return -ENOMEM; 787 return -ENOMEM;
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 6237069001c4..defcdde4d358 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -1866,7 +1866,7 @@ static int dmac_alloc_threads(struct pl330_dmac *pl330)
1866 int i; 1866 int i;
1867 1867
1868 /* Allocate 1 Manager and 'chans' Channel threads */ 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 GFP_KERNEL); 1870 GFP_KERNEL);
1871 if (!pl330->channels) 1871 if (!pl330->channels)
1872 return -ENOMEM; 1872 return -ENOMEM;
@@ -2990,7 +2990,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
2990 2990
2991 pl330->num_peripherals = num_chan; 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 if (!pl330->peripherals) { 2994 if (!pl330->peripherals) {
2995 ret = -ENOMEM; 2995 ret = -ENOMEM;
2996 goto probe_err2; 2996 goto probe_err2;
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 12fa48e380cf..6b5626e299b2 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -1045,8 +1045,9 @@ EXPORT_SYMBOL(shdma_cleanup);
1045 1045
1046static int __init shdma_enter(void) 1046static int __init shdma_enter(void)
1047{ 1047{
1048 shdma_slave_used = kzalloc(DIV_ROUND_UP(slave_num, BITS_PER_LONG) * 1048 shdma_slave_used = kcalloc(DIV_ROUND_UP(slave_num, BITS_PER_LONG),
1049 sizeof(long), GFP_KERNEL); 1049 sizeof(long),
1050 GFP_KERNEL);
1050 if (!shdma_slave_used) 1051 if (!shdma_slave_used)
1051 return -ENOMEM; 1052 return -ENOMEM;
1052 return 0; 1053 return 0;
diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index f14645817ed8..c74a88b65039 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -471,7 +471,7 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
471 if (ret < 0) 471 if (ret < 0)
472 return ret; 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 GFP_KERNEL); 475 GFP_KERNEL);
476 if (!chan->sw_desc_pool) 476 if (!chan->sw_desc_pool)
477 return -ENOMEM; 477 return -ENOMEM;
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 329cb96f886f..18aeabb1d5ee 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -3451,7 +3451,7 @@ static int __init amd64_edac_init(void)
3451 opstate_init(); 3451 opstate_init();
3452 3452
3453 err = -ENOMEM; 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 if (!ecc_stngs) 3455 if (!ecc_stngs)
3456 goto err_free; 3456 goto err_free;
3457 3457
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 4d0ea3563d47..8ed4dd9c571b 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -461,7 +461,7 @@ static struct i7core_dev *alloc_i7core_dev(u8 socket,
461 if (!i7core_dev) 461 if (!i7core_dev)
462 return NULL; 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 GFP_KERNEL); 465 GFP_KERNEL);
466 if (!i7core_dev->pdev) { 466 if (!i7core_dev->pdev) {
467 kfree(i7core_dev); 467 kfree(i7core_dev);
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 8bff5fd18185..af83ad58819c 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1126,8 +1126,9 @@ int extcon_dev_register(struct extcon_dev *edev)
1126 char *str; 1126 char *str;
1127 struct extcon_cable *cable; 1127 struct extcon_cable *cable;
1128 1128
1129 edev->cables = kzalloc(sizeof(struct extcon_cable) * 1129 edev->cables = kcalloc(edev->max_supported,
1130 edev->max_supported, GFP_KERNEL); 1130 sizeof(struct extcon_cable),
1131 GFP_KERNEL);
1131 if (!edev->cables) { 1132 if (!edev->cables) {
1132 ret = -ENOMEM; 1133 ret = -ENOMEM;
1133 goto err_sysfs_alloc; 1134 goto err_sysfs_alloc;
@@ -1136,7 +1137,7 @@ int extcon_dev_register(struct extcon_dev *edev)
1136 cable = &edev->cables[index]; 1137 cable = &edev->cables[index];
1137 1138
1138 snprintf(buf, 10, "cable.%d", index); 1139 snprintf(buf, 10, "cable.%d", index);
1139 str = kzalloc(sizeof(char) * (strlen(buf) + 1), 1140 str = kzalloc(strlen(buf) + 1,
1140 GFP_KERNEL); 1141 GFP_KERNEL);
1141 if (!str) { 1142 if (!str) {
1142 for (index--; index >= 0; index--) { 1143 for (index--; index >= 0; index--) {
@@ -1177,15 +1178,17 @@ int extcon_dev_register(struct extcon_dev *edev)
1177 for (index = 0; edev->mutually_exclusive[index]; index++) 1178 for (index = 0; edev->mutually_exclusive[index]; index++)
1178 ; 1179 ;
1179 1180
1180 edev->attrs_muex = kzalloc(sizeof(struct attribute *) * 1181 edev->attrs_muex = kcalloc(index + 1,
1181 (index + 1), GFP_KERNEL); 1182 sizeof(struct attribute *),
1183 GFP_KERNEL);
1182 if (!edev->attrs_muex) { 1184 if (!edev->attrs_muex) {
1183 ret = -ENOMEM; 1185 ret = -ENOMEM;
1184 goto err_muex; 1186 goto err_muex;
1185 } 1187 }
1186 1188
1187 edev->d_attrs_muex = kzalloc(sizeof(struct device_attribute) * 1189 edev->d_attrs_muex = kcalloc(index,
1188 index, GFP_KERNEL); 1190 sizeof(struct device_attribute),
1191 GFP_KERNEL);
1189 if (!edev->d_attrs_muex) { 1192 if (!edev->d_attrs_muex) {
1190 ret = -ENOMEM; 1193 ret = -ENOMEM;
1191 kfree(edev->attrs_muex); 1194 kfree(edev->attrs_muex);
@@ -1194,7 +1197,7 @@ int extcon_dev_register(struct extcon_dev *edev)
1194 1197
1195 for (index = 0; edev->mutually_exclusive[index]; index++) { 1198 for (index = 0; edev->mutually_exclusive[index]; index++) {
1196 sprintf(buf, "0x%x", edev->mutually_exclusive[index]); 1199 sprintf(buf, "0x%x", edev->mutually_exclusive[index]);
1197 name = kzalloc(sizeof(char) * (strlen(buf) + 1), 1200 name = kzalloc(strlen(buf) + 1,
1198 GFP_KERNEL); 1201 GFP_KERNEL);
1199 if (!name) { 1202 if (!name) {
1200 for (index--; index >= 0; index--) { 1203 for (index--; index >= 0; index--) {
@@ -1220,8 +1223,9 @@ int extcon_dev_register(struct extcon_dev *edev)
1220 1223
1221 if (edev->max_supported) { 1224 if (edev->max_supported) {
1222 edev->extcon_dev_type.groups = 1225 edev->extcon_dev_type.groups =
1223 kzalloc(sizeof(struct attribute_group *) * 1226 kcalloc(edev->max_supported + 2,
1224 (edev->max_supported + 2), GFP_KERNEL); 1227 sizeof(struct attribute_group *),
1228 GFP_KERNEL);
1225 if (!edev->extcon_dev_type.groups) { 1229 if (!edev->extcon_dev_type.groups) {
1226 ret = -ENOMEM; 1230 ret = -ENOMEM;
1227 goto err_alloc_groups; 1231 goto err_alloc_groups;
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
index 2f452f1f7c8a..fb8af5cb7c9b 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/firmware/dell_rbu.c
@@ -146,7 +146,7 @@ static int create_packet(void *data, size_t length)
146 packet_array_size = max( 146 packet_array_size = max(
147 (unsigned int)(allocation_floor / rbu_data.packetsize), 147 (unsigned int)(allocation_floor / rbu_data.packetsize),
148 (unsigned int)1); 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 GFP_KERNEL); 150 GFP_KERNEL);
151 151
152 if (!invalid_addr_packet_array) { 152 if (!invalid_addr_packet_array) {
diff --git a/drivers/firmware/efi/capsule.c b/drivers/firmware/efi/capsule.c
index 901b9306bf94..4938c29b7c5d 100644
--- a/drivers/firmware/efi/capsule.c
+++ b/drivers/firmware/efi/capsule.c
@@ -231,7 +231,7 @@ int efi_capsule_update(efi_capsule_header_t *capsule, phys_addr_t *pages)
231 count = DIV_ROUND_UP(imagesize, PAGE_SIZE); 231 count = DIV_ROUND_UP(imagesize, PAGE_SIZE);
232 sg_count = sg_pages_num(count); 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 if (!sg_pages) 235 if (!sg_pages)
236 return -ENOMEM; 236 return -ENOMEM;
237 237
diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c
index f377609ff141..84a11d0a8023 100644
--- a/drivers/firmware/efi/runtime-map.c
+++ b/drivers/firmware/efi/runtime-map.c
@@ -166,7 +166,7 @@ int __init efi_runtime_map_init(struct kobject *efi_kobj)
166 if (!efi_enabled(EFI_MEMMAP)) 166 if (!efi_enabled(EFI_MEMMAP))
167 return 0; 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 if (!map_entries) { 170 if (!map_entries) {
171 ret = -ENOMEM; 171 ret = -ENOMEM;
172 goto out; 172 goto out;
diff --git a/drivers/fmc/fmc-sdb.c b/drivers/fmc/fmc-sdb.c
index ffdc1762b580..d0e65b86dc22 100644
--- a/drivers/fmc/fmc-sdb.c
+++ b/drivers/fmc/fmc-sdb.c
@@ -48,8 +48,8 @@ static struct sdb_array *__fmc_scan_sdb_tree(struct fmc_device *fmc,
48 arr = kzalloc(sizeof(*arr), GFP_KERNEL); 48 arr = kzalloc(sizeof(*arr), GFP_KERNEL);
49 if (!arr) 49 if (!arr)
50 return ERR_PTR(-ENOMEM); 50 return ERR_PTR(-ENOMEM);
51 arr->record = kzalloc(sizeof(arr->record[0]) * n, GFP_KERNEL); 51 arr->record = kcalloc(n, sizeof(arr->record[0]), GFP_KERNEL);
52 arr->subtree = kzalloc(sizeof(arr->subtree[0]) * n, GFP_KERNEL); 52 arr->subtree = kcalloc(n, sizeof(arr->subtree[0]), GFP_KERNEL);
53 if (!arr->record || !arr->subtree) { 53 if (!arr->record || !arr->subtree) {
54 kfree(arr->record); 54 kfree(arr->record);
55 kfree(arr->subtree); 55 kfree(arr->subtree);
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
index e2bee27eb526..b23d9a36be1f 100644
--- a/drivers/gpio/gpio-ml-ioh.c
+++ b/drivers/gpio/gpio-ml-ioh.c
@@ -443,7 +443,7 @@ static int ioh_gpio_probe(struct pci_dev *pdev,
443 goto err_iomap; 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 if (chip_save == NULL) { 447 if (chip_save == NULL) {
448 ret = -ENOMEM; 448 ret = -ENOMEM;
449 goto err_kzalloc; 449 goto err_kzalloc;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
index 428e5eb3444f..f4c474a95875 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
@@ -310,20 +310,20 @@ static int acp_hw_init(void *handle)
310 pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false); 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 GFP_KERNEL); 314 GFP_KERNEL);
315 315
316 if (adev->acp.acp_cell == NULL) 316 if (adev->acp.acp_cell == NULL)
317 return -ENOMEM; 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 if (adev->acp.acp_res == NULL) { 321 if (adev->acp.acp_res == NULL) {
322 kfree(adev->acp.acp_cell); 322 kfree(adev->acp.acp_cell);
323 return -ENOMEM; 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 if (i2s_pdata == NULL) { 327 if (i2s_pdata == NULL) {
328 kfree(adev->acp.acp_res); 328 kfree(adev->acp.acp_res);
329 kfree(adev->acp.acp_cell); 329 kfree(adev->acp.acp_cell);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
index def1010ac05e..77ad59ade85c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
@@ -452,7 +452,7 @@ int amdgpu_parse_extended_power_table(struct amdgpu_device *adev)
452 ATOM_PPLIB_PhaseSheddingLimits_Record *entry; 452 ATOM_PPLIB_PhaseSheddingLimits_Record *entry;
453 453
454 adev->pm.dpm.dyn_state.phase_shedding_limits_table.entries = 454 adev->pm.dpm.dyn_state.phase_shedding_limits_table.entries =
455 kzalloc(psl->ucNumEntries * 455 kcalloc(psl->ucNumEntries,
456 sizeof(struct amdgpu_phase_shedding_limits_entry), 456 sizeof(struct amdgpu_phase_shedding_limits_entry),
457 GFP_KERNEL); 457 GFP_KERNEL);
458 if (!adev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) { 458 if (!adev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
index d167e8ab76d3..e3878256743a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
@@ -53,7 +53,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
53 n -= adev->irq.ih.ring_size; 53 n -= adev->irq.ih.ring_size;
54 n /= size; 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 if (!gtt_obj) { 57 if (!gtt_obj) {
58 DRM_ERROR("Failed to allocate %d pointers\n", n); 58 DRM_ERROR("Failed to allocate %d pointers\n", n);
59 r = 1; 59 r = 1;
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 69500a8b4e2d..e9934de1b9cf 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -1221,7 +1221,7 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,
1221 ectx.abort = false; 1221 ectx.abort = false;
1222 ectx.last_jump = 0; 1222 ectx.last_jump = 0;
1223 if (ws) 1223 if (ws)
1224 ectx.ws = kzalloc(4 * ws, GFP_KERNEL); 1224 ectx.ws = kcalloc(4, ws, GFP_KERNEL);
1225 else 1225 else
1226 ectx.ws = NULL; 1226 ectx.ws = NULL;
1227 1227
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index a266dcf5daed..7fbad2f5f0bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -5679,8 +5679,9 @@ static int ci_parse_power_table(struct amdgpu_device *adev)
5679 (mode_info->atom_context->bios + data_offset + 5679 (mode_info->atom_context->bios + data_offset +
5680 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 5680 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
5681 5681
5682 adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) * 5682 adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
5683 state_array->ucNumEntries, GFP_KERNEL); 5683 sizeof(struct amdgpu_ps),
5684 GFP_KERNEL);
5684 if (!adev->pm.dpm.ps) 5685 if (!adev->pm.dpm.ps)
5685 return -ENOMEM; 5686 return -ENOMEM;
5686 power_state_offset = (u8 *)state_array->states; 5687 power_state_offset = (u8 *)state_array->states;
@@ -5927,7 +5928,9 @@ static int ci_dpm_init(struct amdgpu_device *adev)
5927 ci_set_private_data_variables_based_on_pptable(adev); 5928 ci_set_private_data_variables_based_on_pptable(adev);
5928 5929
5929 adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 5930 adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
5930 kzalloc(4 * sizeof(struct amdgpu_clock_voltage_dependency_entry), GFP_KERNEL); 5931 kcalloc(4,
5932 sizeof(struct amdgpu_clock_voltage_dependency_entry),
5933 GFP_KERNEL);
5931 if (!adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 5934 if (!adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
5932 ci_dpm_fini(adev); 5935 ci_dpm_fini(adev);
5933 return -ENOMEM; 5936 return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
index 17f7f074cedc..7a1e77c93bf1 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -2727,8 +2727,9 @@ static int kv_parse_power_table(struct amdgpu_device *adev)
2727 (mode_info->atom_context->bios + data_offset + 2727 (mode_info->atom_context->bios + data_offset +
2728 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 2728 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
2729 2729
2730 adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) * 2730 adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
2731 state_array->ucNumEntries, GFP_KERNEL); 2731 sizeof(struct amdgpu_ps),
2732 GFP_KERNEL);
2732 if (!adev->pm.dpm.ps) 2733 if (!adev->pm.dpm.ps)
2733 return -ENOMEM; 2734 return -ENOMEM;
2734 power_state_offset = (u8 *)state_array->states; 2735 power_state_offset = (u8 *)state_array->states;
diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
index b12d7c9d42a0..5c97a3671726 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
@@ -7242,8 +7242,9 @@ static int si_parse_power_table(struct amdgpu_device *adev)
7242 (mode_info->atom_context->bios + data_offset + 7242 (mode_info->atom_context->bios + data_offset +
7243 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 7243 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
7244 7244
7245 adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) * 7245 adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
7246 state_array->ucNumEntries, GFP_KERNEL); 7246 sizeof(struct amdgpu_ps),
7247 GFP_KERNEL);
7247 if (!adev->pm.dpm.ps) 7248 if (!adev->pm.dpm.ps)
7248 return -ENOMEM; 7249 return -ENOMEM;
7249 power_state_offset = (u8 *)state_array->states; 7250 power_state_offset = (u8 *)state_array->states;
@@ -7346,7 +7347,9 @@ static int si_dpm_init(struct amdgpu_device *adev)
7346 return ret; 7347 return ret;
7347 7348
7348 adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 7349 adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
7349 kzalloc(4 * sizeof(struct amdgpu_clock_voltage_dependency_entry), GFP_KERNEL); 7350 kcalloc(4,
7351 sizeof(struct amdgpu_clock_voltage_dependency_entry),
7352 GFP_KERNEL);
7350 if (!adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 7353 if (!adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
7351 amdgpu_free_extended_power_table(adev); 7354 amdgpu_free_extended_power_table(adev);
7352 return -ENOMEM; 7355 return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index bd449351803f..ec304b1a5973 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -435,7 +435,7 @@ bool dm_helpers_submit_i2c(
435 return false; 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 if (!msgs) 440 if (!msgs)
441 return false; 441 return false;
diff --git a/drivers/gpu/drm/amd/display/dc/basics/logger.c b/drivers/gpu/drm/amd/display/dc/basics/logger.c
index 738a818d58d1..0866874ae8c6 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/logger.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/logger.c
@@ -364,7 +364,7 @@ void dm_logger_open(
364 entry->type = log_type; 364 entry->type = log_type;
365 entry->logger = logger; 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 GFP_KERNEL); 368 GFP_KERNEL);
369 369
370 entry->buf_offset = 0; 370 entry->buf_offset = 0;
diff --git a/drivers/gpu/drm/amd/display/dc/basics/vector.c b/drivers/gpu/drm/amd/display/dc/basics/vector.c
index 217b8f1f7bf6..d28e9cf0e961 100644
--- a/drivers/gpu/drm/amd/display/dc/basics/vector.c
+++ b/drivers/gpu/drm/amd/display/dc/basics/vector.c
@@ -40,7 +40,7 @@ bool dal_vector_construct(
40 return false; 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 if (vector->container == NULL) 44 if (vector->container == NULL)
45 return false; 45 return false;
46 vector->capacity = capacity; 46 vector->capacity = capacity;
@@ -67,7 +67,7 @@ bool dal_vector_presized_costruct(
67 return false; 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 if (vector->container == NULL) 72 if (vector->container == NULL)
73 return false; 73 return false;
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
index 599c7ab6befe..88b09dd758ba 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
@@ -1079,13 +1079,15 @@ static void get_ss_info_from_atombios(
1079 if (*ss_entries_num == 0) 1079 if (*ss_entries_num == 0)
1080 return; 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 GFP_KERNEL); 1084 GFP_KERNEL);
1084 ss_info_cur = ss_info; 1085 ss_info_cur = ss_info;
1085 if (ss_info == NULL) 1086 if (ss_info == NULL)
1086 return; 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 GFP_KERNEL); 1091 GFP_KERNEL);
1090 if (ss_data == NULL) 1092 if (ss_data == NULL)
1091 goto out_free_info; 1093 goto out_free_info;
diff --git a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
index 80038e0e610f..ab5483c0c502 100644
--- a/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
+++ b/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
@@ -98,7 +98,8 @@ struct gpio_service *dal_gpio_service_create(
98 if (number_of_bits) { 98 if (number_of_bits) {
99 uint32_t index_of_uint = 0; 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 GFP_KERNEL); 103 GFP_KERNEL);
103 104
104 if (!slot) { 105 if (!slot) {
diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
index 0cd111d59018..2533274e9cef 100644
--- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
+++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c
@@ -1413,13 +1413,15 @@ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf,
1413 1413
1414 output_tf->type = TF_TYPE_DISTRIBUTED_POINTS; 1414 output_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
1415 1415
1416 rgb_user = kzalloc(sizeof(*rgb_user) * (GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS), 1416 rgb_user = kcalloc(GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS,
1417 GFP_KERNEL); 1417 sizeof(*rgb_user),
1418 GFP_KERNEL);
1418 if (!rgb_user) 1419 if (!rgb_user)
1419 goto rgb_user_alloc_fail; 1420 goto rgb_user_alloc_fail;
1420 1421
1421 rgb_regamma = kzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + _EXTRA_POINTS), 1422 rgb_regamma = kcalloc(MAX_HW_POINTS + _EXTRA_POINTS,
1422 GFP_KERNEL); 1423 sizeof(*rgb_regamma),
1424 GFP_KERNEL);
1423 if (!rgb_regamma) 1425 if (!rgb_regamma)
1424 goto rgb_regamma_alloc_fail; 1426 goto rgb_regamma_alloc_fail;
1425 1427
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 27d4003aa2c7..fa344ceafc17 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -155,7 +155,8 @@ struct mod_freesync *mod_freesync_create(struct dc *dc)
155 if (core_freesync == NULL) 155 if (core_freesync == NULL)
156 goto fail_alloc_context; 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 GFP_KERNEL); 160 GFP_KERNEL);
160 161
161 if (core_freesync->map == NULL) 162 if (core_freesync->map == NULL)
diff --git a/drivers/gpu/drm/amd/display/modules/stats/stats.c b/drivers/gpu/drm/amd/display/modules/stats/stats.c
index 3f7d47fdc367..710852ad03f3 100644
--- a/drivers/gpu/drm/amd/display/modules/stats/stats.c
+++ b/drivers/gpu/drm/amd/display/modules/stats/stats.c
@@ -141,19 +141,17 @@ struct mod_stats *mod_stats_create(struct dc *dc)
141 else 141 else
142 core_stats->entries = reg_data; 142 core_stats->entries = reg_data;
143 } 143 }
144 core_stats->time = kzalloc( 144 core_stats->time = kcalloc(core_stats->entries,
145 sizeof(struct stats_time_cache) * 145 sizeof(struct stats_time_cache),
146 core_stats->entries,
147 GFP_KERNEL); 146 GFP_KERNEL);
148 147
149 if (core_stats->time == NULL) 148 if (core_stats->time == NULL)
150 goto fail_construct_time; 149 goto fail_construct_time;
151 150
152 core_stats->event_entries = DAL_STATS_EVENT_ENTRIES_DEFAULT; 151 core_stats->event_entries = DAL_STATS_EVENT_ENTRIES_DEFAULT;
153 core_stats->events = kzalloc( 152 core_stats->events = kcalloc(core_stats->event_entries,
154 sizeof(struct stats_event_cache) * 153 sizeof(struct stats_event_cache),
155 core_stats->event_entries, 154 GFP_KERNEL);
156 GFP_KERNEL);
157 155
158 if (core_stats->events == NULL) 156 if (core_stats->events == NULL)
159 goto fail_construct_events; 157 goto fail_construct_events;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
index 0af13c154328..e45a1fcc7f08 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
@@ -50,7 +50,7 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr)
50 return 0; 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 if (hwmgr->ps == NULL) 54 if (hwmgr->ps == NULL)
55 return -ENOMEM; 55 return -ENOMEM;
56 56
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index 2e0a02a80fe4..572a18c2bfb5 100644
--- a/drivers/gpu/drm/i915/gvt/vgpu.c
+++ b/drivers/gpu/drm/i915/gvt/vgpu.c
@@ -121,7 +121,7 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt)
121 high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE; 121 high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE;
122 num_types = sizeof(vgpu_types) / sizeof(vgpu_types[0]); 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 GFP_KERNEL); 125 GFP_KERNEL);
126 if (!gvt->types) 126 if (!gvt->types)
127 return -ENOMEM; 127 return -ENOMEM;
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 2db5da550a1c..0cc6a861bcf8 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -429,7 +429,7 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port,
429 if (num_downstream == 0) 429 if (num_downstream == 0)
430 return -EINVAL; 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 if (!ksv_fifo) 433 if (!ksv_fifo)
434 return -ENOMEM; 434 return -ENOMEM;
435 435
diff --git a/drivers/gpu/drm/i915/selftests/intel_uncore.c b/drivers/gpu/drm/i915/selftests/intel_uncore.c
index f76f2597df5c..47bc5b2ddb56 100644
--- a/drivers/gpu/drm/i915/selftests/intel_uncore.c
+++ b/drivers/gpu/drm/i915/selftests/intel_uncore.c
@@ -137,7 +137,7 @@ static int intel_uncore_check_forcewake_domains(struct drm_i915_private *dev_pri
137 if (!IS_ENABLED(CONFIG_DRM_I915_SELFTEST_BROKEN)) 137 if (!IS_ENABLED(CONFIG_DRM_I915_SELFTEST_BROKEN))
138 return 0; 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 GFP_KERNEL); 141 GFP_KERNEL);
142 if (!valid) 142 if (!valid)
143 return -ENOMEM; 143 return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvif/fifo.c b/drivers/gpu/drm/nouveau/nvif/fifo.c
index 99d4fd17543c..e84a2e2ff043 100644
--- a/drivers/gpu/drm/nouveau/nvif/fifo.c
+++ b/drivers/gpu/drm/nouveau/nvif/fifo.c
@@ -50,8 +50,8 @@ nvif_fifo_runlists(struct nvif_device *device)
50 goto done; 50 goto done;
51 51
52 device->runlists = fls64(a->v.runlists.data); 52 device->runlists = fls64(a->v.runlists.data);
53 device->runlist = kzalloc(sizeof(*device->runlist) * 53 device->runlist = kcalloc(device->runlists, sizeof(*device->runlist),
54 device->runlists, GFP_KERNEL); 54 GFP_KERNEL);
55 if (!device->runlist) { 55 if (!device->runlist) {
56 ret = -ENOMEM; 56 ret = -ENOMEM;
57 goto done; 57 goto done;
diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif/object.c
index 40adfe9b334b..ef3f62840e83 100644
--- a/drivers/gpu/drm/nouveau/nvif/object.c
+++ b/drivers/gpu/drm/nouveau/nvif/object.c
@@ -83,7 +83,7 @@ nvif_object_sclass_get(struct nvif_object *object, struct nvif_sclass **psclass)
83 return ret; 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 if (*psclass) { 87 if (*psclass) {
88 for (i = 0; i < args->sclass.count; i++) { 88 for (i = 0; i < args->sclass.count; i++) {
89 (*psclass)[i].oclass = args->sclass.oclass[i].oclass; 89 (*psclass)[i].oclass = args->sclass.oclass[i].oclass;
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/event.c b/drivers/gpu/drm/nouveau/nvkm/core/event.c
index 4e8d3fa042df..006618d77aa4 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/event.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/event.c
@@ -84,7 +84,8 @@ int
84nvkm_event_init(const struct nvkm_event_func *func, int types_nr, int index_nr, 84nvkm_event_init(const struct nvkm_event_func *func, int types_nr, int index_nr,
85 struct nvkm_event *event) 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 GFP_KERNEL); 89 GFP_KERNEL);
89 if (!event->refs) 90 if (!event->refs)
90 return -ENOMEM; 91 return -ENOMEM;
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
index a99046414a18..afccf9721cf0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
@@ -910,7 +910,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base)
910 nvkm_debug(subdev, "%d PBDMA(s)\n", fifo->pbdma_nr); 910 nvkm_debug(subdev, "%d PBDMA(s)\n", fifo->pbdma_nr);
911 911
912 /* Read PBDMA->runlist(s) mapping from HW. */ 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 return -ENOMEM; 914 return -ENOMEM;
915 915
916 for (i = 0; i < fifo->pbdma_nr; i++) 916 for (i = 0; i < fifo->pbdma_nr; i++)
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 3ea716875151..17a53d207978 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -268,7 +268,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)
268 } 268 }
269 } 269 }
270 } else { 270 } else {
271 addrs = kzalloc(npages * sizeof(*addrs), GFP_KERNEL); 271 addrs = kcalloc(npages, sizeof(*addrs), GFP_KERNEL);
272 if (!addrs) { 272 if (!addrs) {
273 ret = -ENOMEM; 273 ret = -ENOMEM;
274 goto free_pages; 274 goto free_pages;
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 6a2e091aa7b6..e55cbeee7a53 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -1176,7 +1176,7 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
1176 ectx.abort = false; 1176 ectx.abort = false;
1177 ectx.last_jump = 0; 1177 ectx.last_jump = 0;
1178 if (ws) 1178 if (ws)
1179 ectx.ws = kzalloc(4 * ws, GFP_KERNEL); 1179 ectx.ws = kcalloc(4, ws, GFP_KERNEL);
1180 else 1180 else
1181 ectx.ws = NULL; 1181 ectx.ws = NULL;
1182 1182
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index 95652e643da1..0aef4937c901 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -2581,7 +2581,9 @@ int btc_dpm_init(struct radeon_device *rdev)
2581 return ret; 2581 return ret;
2582 2582
2583 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 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 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 2587 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
2586 r600_free_extended_power_table(rdev); 2588 r600_free_extended_power_table(rdev);
2587 return -ENOMEM; 2589 return -ENOMEM;
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 7e1b04dc5593..b9302c918271 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -5568,8 +5568,9 @@ static int ci_parse_power_table(struct radeon_device *rdev)
5568 (mode_info->atom_context->bios + data_offset + 5568 (mode_info->atom_context->bios + data_offset +
5569 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 5569 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
5570 5570
5571 rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 5571 rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
5572 state_array->ucNumEntries, GFP_KERNEL); 5572 sizeof(struct radeon_ps),
5573 GFP_KERNEL);
5573 if (!rdev->pm.dpm.ps) 5574 if (!rdev->pm.dpm.ps)
5574 return -ENOMEM; 5575 return -ENOMEM;
5575 power_state_offset = (u8 *)state_array->states; 5576 power_state_offset = (u8 *)state_array->states;
@@ -5770,7 +5771,9 @@ int ci_dpm_init(struct radeon_device *rdev)
5770 ci_set_private_data_variables_based_on_pptable(rdev); 5771 ci_set_private_data_variables_based_on_pptable(rdev);
5771 5772
5772 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 5773 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
5773 kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); 5774 kcalloc(4,
5775 sizeof(struct radeon_clock_voltage_dependency_entry),
5776 GFP_KERNEL);
5774 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 5777 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
5775 ci_dpm_fini(rdev); 5778 ci_dpm_fini(rdev);
5776 return -ENOMEM; 5779 return -ENOMEM;
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index ae1529b0ef6f..f055d6ea3522 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -2660,8 +2660,9 @@ static int kv_parse_power_table(struct radeon_device *rdev)
2660 (mode_info->atom_context->bios + data_offset + 2660 (mode_info->atom_context->bios + data_offset +
2661 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 2661 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
2662 2662
2663 rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 2663 rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
2664 state_array->ucNumEntries, GFP_KERNEL); 2664 sizeof(struct radeon_ps),
2665 GFP_KERNEL);
2665 if (!rdev->pm.dpm.ps) 2666 if (!rdev->pm.dpm.ps)
2666 return -ENOMEM; 2667 return -ENOMEM;
2667 power_state_offset = (u8 *)state_array->states; 2668 power_state_offset = (u8 *)state_array->states;
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 9416e72f86aa..0fd8d6ba9828 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -3998,8 +3998,9 @@ static int ni_parse_power_table(struct radeon_device *rdev)
3998 return -EINVAL; 3998 return -EINVAL;
3999 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 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) * 4001 rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates,
4002 power_info->pplib.ucNumStates, GFP_KERNEL); 4002 sizeof(struct radeon_ps),
4003 GFP_KERNEL);
4003 if (!rdev->pm.dpm.ps) 4004 if (!rdev->pm.dpm.ps)
4004 return -ENOMEM; 4005 return -ENOMEM;
4005 4006
@@ -4075,7 +4076,9 @@ int ni_dpm_init(struct radeon_device *rdev)
4075 return ret; 4076 return ret;
4076 4077
4077 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 4078 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
4078 kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); 4079 kcalloc(4,
4080 sizeof(struct radeon_clock_voltage_dependency_entry),
4081 GFP_KERNEL);
4079 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 4082 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
4080 r600_free_extended_power_table(rdev); 4083 r600_free_extended_power_table(rdev);
4081 return -ENOMEM; 4084 return -ENOMEM;
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c
index 31d1b4710844..73d4c5348116 100644
--- a/drivers/gpu/drm/radeon/r600_dpm.c
+++ b/drivers/gpu/drm/radeon/r600_dpm.c
@@ -991,7 +991,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev)
991 ATOM_PPLIB_PhaseSheddingLimits_Record *entry; 991 ATOM_PPLIB_PhaseSheddingLimits_Record *entry;
992 992
993 rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries = 993 rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries =
994 kzalloc(psl->ucNumEntries * 994 kcalloc(psl->ucNumEntries,
995 sizeof(struct radeon_phase_shedding_limits_entry), 995 sizeof(struct radeon_phase_shedding_limits_entry),
996 GFP_KERNEL); 996 GFP_KERNEL);
997 if (!rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) { 997 if (!rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) {
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 4134759a6823..f422a8d6aec4 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -2126,13 +2126,16 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev)
2126 num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; 2126 num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK;
2127 if (num_modes == 0) 2127 if (num_modes == 0)
2128 return state_index; 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 if (!rdev->pm.power_state) 2132 if (!rdev->pm.power_state)
2131 return state_index; 2133 return state_index;
2132 /* last mode is usually default, array is low to high */ 2134 /* last mode is usually default, array is low to high */
2133 for (i = 0; i < num_modes; i++) { 2135 for (i = 0; i < num_modes; i++) {
2134 rdev->pm.power_state[state_index].clock_info = 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 if (!rdev->pm.power_state[state_index].clock_info) 2139 if (!rdev->pm.power_state[state_index].clock_info)
2137 return state_index; 2140 return state_index;
2138 rdev->pm.power_state[state_index].num_clock_modes = 1; 2141 rdev->pm.power_state[state_index].num_clock_modes = 1;
@@ -2587,8 +2590,9 @@ static int radeon_atombios_parse_power_table_4_5(struct radeon_device *rdev)
2587 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); 2590 radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController);
2588 if (power_info->pplib.ucNumStates == 0) 2591 if (power_info->pplib.ucNumStates == 0)
2589 return state_index; 2592 return state_index;
2590 rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2593 rdev->pm.power_state = kcalloc(power_info->pplib.ucNumStates,
2591 power_info->pplib.ucNumStates, GFP_KERNEL); 2594 sizeof(struct radeon_power_state),
2595 GFP_KERNEL);
2592 if (!rdev->pm.power_state) 2596 if (!rdev->pm.power_state)
2593 return state_index; 2597 return state_index;
2594 /* first mode is usually default, followed by low to high */ 2598 /* first mode is usually default, followed by low to high */
@@ -2603,10 +2607,11 @@ static int radeon_atombios_parse_power_table_4_5(struct radeon_device *rdev)
2603 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset) + 2607 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset) +
2604 (power_state->v1.ucNonClockStateIndex * 2608 (power_state->v1.ucNonClockStateIndex *
2605 power_info->pplib.ucNonClockSize)); 2609 power_info->pplib.ucNonClockSize));
2606 rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) * 2610 rdev->pm.power_state[i].clock_info =
2607 ((power_info->pplib.ucStateEntrySize - 1) ? 2611 kcalloc((power_info->pplib.ucStateEntrySize - 1) ?
2608 (power_info->pplib.ucStateEntrySize - 1) : 1), 2612 (power_info->pplib.ucStateEntrySize - 1) : 1,
2609 GFP_KERNEL); 2613 sizeof(struct radeon_pm_clock_info),
2614 GFP_KERNEL);
2610 if (!rdev->pm.power_state[i].clock_info) 2615 if (!rdev->pm.power_state[i].clock_info)
2611 return state_index; 2616 return state_index;
2612 if (power_info->pplib.ucStateEntrySize - 1) { 2617 if (power_info->pplib.ucStateEntrySize - 1) {
@@ -2688,8 +2693,9 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev)
2688 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 2693 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
2689 if (state_array->ucNumEntries == 0) 2694 if (state_array->ucNumEntries == 0)
2690 return state_index; 2695 return state_index;
2691 rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2696 rdev->pm.power_state = kcalloc(state_array->ucNumEntries,
2692 state_array->ucNumEntries, GFP_KERNEL); 2697 sizeof(struct radeon_power_state),
2698 GFP_KERNEL);
2693 if (!rdev->pm.power_state) 2699 if (!rdev->pm.power_state)
2694 return state_index; 2700 return state_index;
2695 power_state_offset = (u8 *)state_array->states; 2701 power_state_offset = (u8 *)state_array->states;
@@ -2699,10 +2705,11 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev)
2699 non_clock_array_index = power_state->v2.nonClockInfoIndex; 2705 non_clock_array_index = power_state->v2.nonClockInfoIndex;
2700 non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) 2706 non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *)
2701 &non_clock_info_array->nonClockInfo[non_clock_array_index]; 2707 &non_clock_info_array->nonClockInfo[non_clock_array_index];
2702 rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) * 2708 rdev->pm.power_state[i].clock_info =
2703 (power_state->v2.ucNumDPMLevels ? 2709 kcalloc(power_state->v2.ucNumDPMLevels ?
2704 power_state->v2.ucNumDPMLevels : 1), 2710 power_state->v2.ucNumDPMLevels : 1,
2705 GFP_KERNEL); 2711 sizeof(struct radeon_pm_clock_info),
2712 GFP_KERNEL);
2706 if (!rdev->pm.power_state[i].clock_info) 2713 if (!rdev->pm.power_state[i].clock_info)
2707 return state_index; 2714 return state_index;
2708 if (power_state->v2.ucNumDPMLevels) { 2715 if (power_state->v2.ucNumDPMLevels) {
@@ -2782,7 +2789,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
2782 rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL); 2789 rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL);
2783 if (rdev->pm.power_state) { 2790 if (rdev->pm.power_state) {
2784 rdev->pm.power_state[0].clock_info = 2791 rdev->pm.power_state[0].clock_info =
2785 kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); 2792 kcalloc(1,
2793 sizeof(struct radeon_pm_clock_info),
2794 GFP_KERNEL);
2786 if (rdev->pm.power_state[0].clock_info) { 2795 if (rdev->pm.power_state[0].clock_info) {
2787 /* add the default mode */ 2796 /* add the default mode */
2788 rdev->pm.power_state[state_index].type = 2797 rdev->pm.power_state[state_index].type =
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 3178ba0c537c..60a61d33f607 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -2642,13 +2642,16 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
2642 rdev->pm.default_power_state_index = -1; 2642 rdev->pm.default_power_state_index = -1;
2643 2643
2644 /* allocate 2 power states */ 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 if (rdev->pm.power_state) { 2647 if (rdev->pm.power_state) {
2647 /* allocate 1 clock mode per state */ 2648 /* allocate 1 clock mode per state */
2648 rdev->pm.power_state[0].clock_info = 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 rdev->pm.power_state[1].clock_info = 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 if (!rdev->pm.power_state[0].clock_info || 2655 if (!rdev->pm.power_state[0].clock_info ||
2653 !rdev->pm.power_state[1].clock_info) 2656 !rdev->pm.power_state[1].clock_info)
2654 goto pm_failed; 2657 goto pm_failed;
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
index f5e9abfadb56..48f4b273e316 100644
--- a/drivers/gpu/drm/radeon/radeon_test.c
+++ b/drivers/gpu/drm/radeon/radeon_test.c
@@ -59,7 +59,7 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)
59 n = rdev->mc.gtt_size - rdev->gart_pin_size; 59 n = rdev->mc.gtt_size - rdev->gart_pin_size;
60 n /= size; 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 if (!gtt_obj) { 63 if (!gtt_obj) {
64 DRM_ERROR("Failed to allocate %d pointers\n", n); 64 DRM_ERROR("Failed to allocate %d pointers\n", n);
65 r = 1; 65 r = 1;
diff --git a/drivers/gpu/drm/radeon/rs780_dpm.c b/drivers/gpu/drm/radeon/rs780_dpm.c
index b5e4e09a8996..694b7b3e9799 100644
--- a/drivers/gpu/drm/radeon/rs780_dpm.c
+++ b/drivers/gpu/drm/radeon/rs780_dpm.c
@@ -804,8 +804,9 @@ static int rs780_parse_power_table(struct radeon_device *rdev)
804 return -EINVAL; 804 return -EINVAL;
805 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 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) * 807 rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates,
808 power_info->pplib.ucNumStates, GFP_KERNEL); 808 sizeof(struct radeon_ps),
809 GFP_KERNEL);
809 if (!rdev->pm.dpm.ps) 810 if (!rdev->pm.dpm.ps)
810 return -ENOMEM; 811 return -ENOMEM;
811 812
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c
index d91aa3944593..6986051fbb89 100644
--- a/drivers/gpu/drm/radeon/rv6xx_dpm.c
+++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c
@@ -1888,8 +1888,9 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev)
1888 return -EINVAL; 1888 return -EINVAL;
1889 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 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) * 1891 rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates,
1892 power_info->pplib.ucNumStates, GFP_KERNEL); 1892 sizeof(struct radeon_ps),
1893 GFP_KERNEL);
1893 if (!rdev->pm.dpm.ps) 1894 if (!rdev->pm.dpm.ps)
1894 return -ENOMEM; 1895 return -ENOMEM;
1895 1896
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c
index cb2a7ec4e217..c765ae7ea806 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -2282,8 +2282,9 @@ int rv7xx_parse_power_table(struct radeon_device *rdev)
2282 return -EINVAL; 2282 return -EINVAL;
2283 power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 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) * 2285 rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates,
2286 power_info->pplib.ucNumStates, GFP_KERNEL); 2286 sizeof(struct radeon_ps),
2287 GFP_KERNEL);
2287 if (!rdev->pm.dpm.ps) 2288 if (!rdev->pm.dpm.ps)
2288 return -ENOMEM; 2289 return -ENOMEM;
2289 2290
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 90d5b41007bf..fea88078cf8e 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -6832,8 +6832,9 @@ static int si_parse_power_table(struct radeon_device *rdev)
6832 (mode_info->atom_context->bios + data_offset + 6832 (mode_info->atom_context->bios + data_offset +
6833 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 6833 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
6834 6834
6835 rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 6835 rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
6836 state_array->ucNumEntries, GFP_KERNEL); 6836 sizeof(struct radeon_ps),
6837 GFP_KERNEL);
6837 if (!rdev->pm.dpm.ps) 6838 if (!rdev->pm.dpm.ps)
6838 return -ENOMEM; 6839 return -ENOMEM;
6839 power_state_offset = (u8 *)state_array->states; 6840 power_state_offset = (u8 *)state_array->states;
@@ -6941,7 +6942,9 @@ int si_dpm_init(struct radeon_device *rdev)
6941 return ret; 6942 return ret;
6942 6943
6943 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 6944 rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
6944 kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL); 6945 kcalloc(4,
6946 sizeof(struct radeon_clock_voltage_dependency_entry),
6947 GFP_KERNEL);
6945 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 6948 if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
6946 r600_free_extended_power_table(rdev); 6949 r600_free_extended_power_table(rdev);
6947 return -ENOMEM; 6950 return -ENOMEM;
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c
index fd4804829e46..1e4975f3374c 100644
--- a/drivers/gpu/drm/radeon/sumo_dpm.c
+++ b/drivers/gpu/drm/radeon/sumo_dpm.c
@@ -1482,8 +1482,9 @@ static int sumo_parse_power_table(struct radeon_device *rdev)
1482 (mode_info->atom_context->bios + data_offset + 1482 (mode_info->atom_context->bios + data_offset +
1483 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 1483 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
1484 1484
1485 rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 1485 rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
1486 state_array->ucNumEntries, GFP_KERNEL); 1486 sizeof(struct radeon_ps),
1487 GFP_KERNEL);
1487 if (!rdev->pm.dpm.ps) 1488 if (!rdev->pm.dpm.ps)
1488 return -ENOMEM; 1489 return -ENOMEM;
1489 power_state_offset = (u8 *)state_array->states; 1490 power_state_offset = (u8 *)state_array->states;
diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c b/drivers/gpu/drm/radeon/trinity_dpm.c
index 2ef7c4e5e495..5d317f763eea 100644
--- a/drivers/gpu/drm/radeon/trinity_dpm.c
+++ b/drivers/gpu/drm/radeon/trinity_dpm.c
@@ -1757,8 +1757,9 @@ static int trinity_parse_power_table(struct radeon_device *rdev)
1757 (mode_info->atom_context->bios + data_offset + 1757 (mode_info->atom_context->bios + data_offset +
1758 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 1758 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
1759 1759
1760 rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) * 1760 rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
1761 state_array->ucNumEntries, GFP_KERNEL); 1761 sizeof(struct radeon_ps),
1762 GFP_KERNEL);
1762 if (!rdev->pm.dpm.ps) 1763 if (!rdev->pm.dpm.ps)
1763 return -ENOMEM; 1764 return -ENOMEM;
1764 power_state_offset = (u8 *)state_array->states; 1765 power_state_offset = (u8 *)state_array->states;
diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/selftests/test-drm_mm.c
index 7cc935d7b7aa..ab6c6c9c5b5c 100644
--- a/drivers/gpu/drm/selftests/test-drm_mm.c
+++ b/drivers/gpu/drm/selftests/test-drm_mm.c
@@ -1631,7 +1631,7 @@ static int igt_topdown(void *ignored)
1631 if (!nodes) 1631 if (!nodes)
1632 goto err; 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 GFP_KERNEL); 1635 GFP_KERNEL);
1636 if (!bitmap) 1636 if (!bitmap)
1637 goto err_nodes; 1637 goto err_nodes;
@@ -1745,7 +1745,7 @@ static int igt_bottomup(void *ignored)
1745 if (!nodes) 1745 if (!nodes)
1746 goto err; 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 GFP_KERNEL); 1749 GFP_KERNEL);
1750 if (!bitmap) 1750 if (!bitmap)
1751 goto err_nodes; 1751 goto err_nodes;
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 6d99534ac691..8469b6964ff6 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -457,7 +457,7 @@ static char *resolv_usage_page(unsigned page, struct seq_file *f) {
457 char *buf = NULL; 457 char *buf = NULL;
458 458
459 if (!f) { 459 if (!f) {
460 buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC); 460 buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_ATOMIC);
461 if (!buf) 461 if (!buf)
462 return ERR_PTR(-ENOMEM); 462 return ERR_PTR(-ENOMEM);
463 } 463 }
@@ -1088,7 +1088,7 @@ static int hid_debug_events_open(struct inode *inode, struct file *file)
1088 goto out; 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 err = -ENOMEM; 1092 err = -ENOMEM;
1093 kfree(list); 1093 kfree(list);
1094 goto out; 1094 goto out;
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 9b82549cbbc8..658dc765753b 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -190,7 +190,7 @@ int hv_synic_alloc(void)
190{ 190{
191 int cpu; 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 GFP_KERNEL); 194 GFP_KERNEL);
195 if (hv_context.hv_numa_map == NULL) { 195 if (hv_context.hv_numa_map == NULL) {
196 pr_err("Unable to allocate NUMA map\n"); 196 pr_err("Unable to allocate NUMA map\n");
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index 3c836c099a8f..be3c8b10b84a 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -202,7 +202,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
202 * First page holds struct hv_ring_buffer, do wraparound mapping for 202 * First page holds struct hv_ring_buffer, do wraparound mapping for
203 * the rest. 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 GFP_KERNEL); 206 GFP_KERNEL);
207 if (!pages_wraparound) 207 if (!pages_wraparound)
208 return -ENOMEM; 208 return -ENOMEM;
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index 14a94d90c028..34e45b97629e 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -575,8 +575,9 @@ static int read_domain_devices(struct acpi_power_meter_resource *resource)
575 if (!pss->package.count) 575 if (!pss->package.count)
576 goto end; 576 goto end;
577 577
578 resource->domain_devices = kzalloc(sizeof(struct acpi_device *) * 578 resource->domain_devices = kcalloc(pss->package.count,
579 pss->package.count, GFP_KERNEL); 579 sizeof(struct acpi_device *),
580 GFP_KERNEL);
580 if (!resource->domain_devices) { 581 if (!resource->domain_devices) {
581 res = -ENOMEM; 582 res = -ENOMEM;
582 goto end; 583 goto end;
@@ -796,7 +797,7 @@ static int read_capabilities(struct acpi_power_meter_resource *resource)
796 goto error; 797 goto error;
797 } 798 }
798 799
799 *str = kzalloc(sizeof(u8) * (element->string.length + 1), 800 *str = kcalloc(element->string.length + 1, sizeof(u8),
800 GFP_KERNEL); 801 GFP_KERNEL);
801 if (!*str) { 802 if (!*str) {
802 res = -ENOMEM; 803 res = -ENOMEM;
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 72c338eb5fae..10645c9bb7be 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -742,7 +742,7 @@ static int __init coretemp_init(void)
742 return -ENODEV; 742 return -ENODEV;
743 743
744 max_packages = topology_max_packages(); 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 GFP_KERNEL); 746 GFP_KERNEL);
747 if (!pkg_devices) 747 if (!pkg_devices)
748 return -ENOMEM; 748 return -ENOMEM;
diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c
index 9397d2f0e79a..a4edc43dd060 100644
--- a/drivers/hwmon/i5k_amb.c
+++ b/drivers/hwmon/i5k_amb.c
@@ -274,8 +274,9 @@ static int i5k_amb_hwmon_init(struct platform_device *pdev)
274 num_ambs += hweight16(data->amb_present[i] & 0x7fff); 274 num_ambs += hweight16(data->amb_present[i] & 0x7fff);
275 275
276 /* Set up sysfs stuff */ 276 /* Set up sysfs stuff */
277 data->attrs = kzalloc(sizeof(*data->attrs) * num_ambs * KNOBS_PER_AMB, 277 data->attrs = kzalloc(array3_size(num_ambs, KNOBS_PER_AMB,
278 GFP_KERNEL); 278 sizeof(*data->attrs)),
279 GFP_KERNEL);
279 if (!data->attrs) 280 if (!data->attrs)
280 return -ENOMEM; 281 return -ENOMEM;
281 data->num_attrs = 0; 282 data->num_attrs = 0;
diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c
index 21b9c72f16bd..ab72cabf5a95 100644
--- a/drivers/hwmon/ibmpex.c
+++ b/drivers/hwmon/ibmpex.c
@@ -387,7 +387,7 @@ static int ibmpex_find_sensors(struct ibmpex_bmc_data *data)
387 return -ENOENT; 387 return -ENOENT;
388 data->num_sensors = err; 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 GFP_KERNEL); 391 GFP_KERNEL);
392 if (!data->sensors) 392 if (!data->sensors)
393 return -ENOMEM; 393 return -ENOMEM;
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
index 65e324054970..a2f5f992af7a 100644
--- a/drivers/i2c/busses/i2c-amd756-s4882.c
+++ b/drivers/i2c/busses/i2c-amd756-s4882.c
@@ -169,12 +169,12 @@ static int __init amd756_s4882_init(void)
169 169
170 printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n"); 170 printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n");
171 /* Define the 5 virtual adapters and algorithms structures */ 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 GFP_KERNEL))) { 173 GFP_KERNEL))) {
174 error = -ENOMEM; 174 error = -ENOMEM;
175 goto ERROR1; 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 GFP_KERNEL))) { 178 GFP_KERNEL))) {
179 error = -ENOMEM; 179 error = -ENOMEM;
180 goto ERROR2; 180 goto ERROR2;
diff --git a/drivers/i2c/busses/i2c-nforce2-s4985.c b/drivers/i2c/busses/i2c-nforce2-s4985.c
index 88eda09e73c0..58a0fbf0e074 100644
--- a/drivers/i2c/busses/i2c-nforce2-s4985.c
+++ b/drivers/i2c/busses/i2c-nforce2-s4985.c
@@ -164,12 +164,12 @@ static int __init nforce2_s4985_init(void)
164 164
165 printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4985\n"); 165 printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4985\n");
166 /* Define the 5 virtual adapters and algorithms structures */ 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 if (!s4985_adapter) { 168 if (!s4985_adapter) {
169 error = -ENOMEM; 169 error = -ENOMEM;
170 goto ERROR1; 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 if (!s4985_algo) { 173 if (!s4985_algo) {
174 error = -ENOMEM; 174 error = -ENOMEM;
175 goto ERROR2; 175 goto ERROR2;
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 3241bb9d6c18..f6a1272c5854 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -381,7 +381,7 @@ static int nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id)
381 int res1, res2; 381 int res1, res2;
382 382
383 /* we support 2 SMBus adapters */ 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 if (!smbuses) 385 if (!smbuses)
386 return -ENOMEM; 386 return -ENOMEM;
387 pci_set_drvdata(dev, smbuses); 387 pci_set_drvdata(dev, smbuses);
diff --git a/drivers/i2c/i2c-stub.c b/drivers/i2c/i2c-stub.c
index 4a9ad91c5ba3..f31ec0861979 100644
--- a/drivers/i2c/i2c-stub.c
+++ b/drivers/i2c/i2c-stub.c
@@ -338,8 +338,9 @@ static int __init i2c_stub_allocate_banks(int i)
338 chip->bank_mask >>= 1; 338 chip->bank_mask >>= 1;
339 } 339 }
340 340
341 chip->bank_words = kzalloc(chip->bank_mask * chip->bank_size * 341 chip->bank_words = kcalloc(chip->bank_mask * chip->bank_size,
342 sizeof(u16), GFP_KERNEL); 342 sizeof(u16),
343 GFP_KERNEL);
343 if (!chip->bank_words) 344 if (!chip->bank_words)
344 return -ENOMEM; 345 return -ENOMEM;
345 346
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c
index 4b5dc0162e67..e52c58c29d9a 100644
--- a/drivers/ide/hpt366.c
+++ b/drivers/ide/hpt366.c
@@ -1455,7 +1455,7 @@ static int hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1455 if (info == &hpt36x || info == &hpt374) 1455 if (info == &hpt36x || info == &hpt374)
1456 dev2 = pci_get_slot(dev->bus, dev->devfn + 1); 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 if (dyn_info == NULL) { 1459 if (dyn_info == NULL) {
1460 printk(KERN_ERR "%s %s: out of memory!\n", 1460 printk(KERN_ERR "%s %s: out of memory!\n",
1461 d.name, pci_name(dev)); 1461 d.name, pci_name(dev));
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c
index 04029d18a696..36a64c8ea575 100644
--- a/drivers/ide/it821x.c
+++ b/drivers/ide/it821x.c
@@ -652,7 +652,7 @@ static int it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
652 struct it821x_dev *itdevs; 652 struct it821x_dev *itdevs;
653 int rc; 653 int rc;
654 654
655 itdevs = kzalloc(2 * sizeof(*itdevs), GFP_KERNEL); 655 itdevs = kcalloc(2, sizeof(*itdevs), GFP_KERNEL);
656 if (itdevs == NULL) { 656 if (itdevs == NULL) {
657 printk(KERN_ERR DRV_NAME " %s: out of memory\n", pci_name(dev)); 657 printk(KERN_ERR DRV_NAME " %s: out of memory\n", pci_name(dev));
658 return -ENOMEM; 658 return -ENOMEM;
diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c
index 36607d52fee0..76643c5571aa 100644
--- a/drivers/iio/imu/adis_buffer.c
+++ b/drivers/iio/imu/adis_buffer.c
@@ -38,7 +38,7 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
38 if (!adis->xfer) 38 if (!adis->xfer)
39 return -ENOMEM; 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 if (!adis->buffer) 42 if (!adis->buffer)
43 return -ENOMEM; 43 return -ENOMEM;
44 44
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
index ec98790e2a28..06ca3f7fcc44 100644
--- a/drivers/iio/inkern.c
+++ b/drivers/iio/inkern.c
@@ -436,7 +436,7 @@ struct iio_channel *iio_channel_get_all(struct device *dev)
436 } 436 }
437 437
438 /* NULL terminated array to save passing size */ 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 if (chans == NULL) { 440 if (chans == NULL) {
441 ret = -ENOMEM; 441 ret = -ENOMEM;
442 goto error_ret; 442 goto error_ret;
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
index 71a34bee453d..81d66f56e38f 100644
--- a/drivers/infiniband/core/cache.c
+++ b/drivers/infiniband/core/cache.c
@@ -1245,8 +1245,9 @@ int ib_cache_setup_one(struct ib_device *device)
1245 rwlock_init(&device->cache.lock); 1245 rwlock_init(&device->cache.lock);
1246 1246
1247 device->cache.ports = 1247 device->cache.ports =
1248 kzalloc(sizeof(*device->cache.ports) * 1248 kcalloc(rdma_end_port(device) - rdma_start_port(device) + 1,
1249 (rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL); 1249 sizeof(*device->cache.ports),
1250 GFP_KERNEL);
1250 if (!device->cache.ports) 1251 if (!device->cache.ports)
1251 return -ENOMEM; 1252 return -ENOMEM;
1252 1253
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 84f51386e1e3..6fa4c59dc7a7 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -336,8 +336,8 @@ static int read_port_immutable(struct ib_device *device)
336 * Therefore port_immutable is declared as a 1 based array with 336 * Therefore port_immutable is declared as a 1 based array with
337 * potential empty slots at the beginning. 337 * potential empty slots at the beginning.
338 */ 338 */
339 device->port_immutable = kzalloc(sizeof(*device->port_immutable) 339 device->port_immutable = kcalloc(end_port + 1,
340 * (end_port + 1), 340 sizeof(*device->port_immutable),
341 GFP_KERNEL); 341 GFP_KERNEL);
342 if (!device->port_immutable) 342 if (!device->port_immutable)
343 return -ENOMEM; 343 return -ENOMEM;
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index da12da1c36f6..cdb63f3f4de7 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -56,14 +56,16 @@ int iwpm_init(u8 nl_client)
56 int ret = 0; 56 int ret = 0;
57 mutex_lock(&iwpm_admin_lock); 57 mutex_lock(&iwpm_admin_lock);
58 if (atomic_read(&iwpm_admin.refcount) == 0) { 58 if (atomic_read(&iwpm_admin.refcount) == 0) {
59 iwpm_hash_bucket = kzalloc(IWPM_MAPINFO_HASH_SIZE * 59 iwpm_hash_bucket = kcalloc(IWPM_MAPINFO_HASH_SIZE,
60 sizeof(struct hlist_head), GFP_KERNEL); 60 sizeof(struct hlist_head),
61 GFP_KERNEL);
61 if (!iwpm_hash_bucket) { 62 if (!iwpm_hash_bucket) {
62 ret = -ENOMEM; 63 ret = -ENOMEM;
63 goto init_exit; 64 goto init_exit;
64 } 65 }
65 iwpm_reminfo_bucket = kzalloc(IWPM_REMINFO_HASH_SIZE * 66 iwpm_reminfo_bucket = kcalloc(IWPM_REMINFO_HASH_SIZE,
66 sizeof(struct hlist_head), GFP_KERNEL); 67 sizeof(struct hlist_head),
68 GFP_KERNEL);
67 if (!iwpm_reminfo_bucket) { 69 if (!iwpm_reminfo_bucket) {
68 kfree(iwpm_hash_bucket); 70 kfree(iwpm_hash_bucket);
69 ret = -ENOMEM; 71 ret = -ENOMEM;
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 3328acc53c2a..dcb4bba522ba 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -279,7 +279,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain,
279 if (!wq->qpid) 279 if (!wq->qpid)
280 return -ENOMEM; 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 if (!wq->rq) 283 if (!wq->rq)
284 goto err1; 284 goto err1;
285 285
@@ -287,7 +287,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain,
287 if (!wq->rq_addr) 287 if (!wq->rq_addr)
288 goto err2; 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 if (!wq->sq) 291 if (!wq->sq)
292 goto err3; 292 goto err3;
293 293
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index 44161ca4d2a8..a3c3418afd73 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -859,8 +859,9 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
859 rdev->status_page->cq_size = rdev->lldi.vr->cq.size; 859 rdev->status_page->cq_size = rdev->lldi.vr->cq.size;
860 860
861 if (c4iw_wr_log) { 861 if (c4iw_wr_log) {
862 rdev->wr_log = kzalloc((1 << c4iw_wr_log_size_order) * 862 rdev->wr_log = kcalloc(1 << c4iw_wr_log_size_order,
863 sizeof(*rdev->wr_log), GFP_KERNEL); 863 sizeof(*rdev->wr_log),
864 GFP_KERNEL);
864 if (rdev->wr_log) { 865 if (rdev->wr_log) {
865 rdev->wr_log_size = 1 << c4iw_wr_log_size_order; 866 rdev->wr_log_size = 1 << c4iw_wr_log_size_order;
866 atomic_set(&rdev->wr_log_idx, 0); 867 atomic_set(&rdev->wr_log_idx, 0);
@@ -1445,7 +1446,7 @@ static void recover_queues(struct uld_ctx *ctx)
1445 ctx->dev->db_state = RECOVERY; 1446 ctx->dev->db_state = RECOVERY;
1446 idr_for_each(&ctx->dev->qpidr, count_qps, &count); 1447 idr_for_each(&ctx->dev->qpidr, count_qps, &count);
1447 1448
1448 qp_list.qps = kzalloc(count * sizeof *qp_list.qps, GFP_ATOMIC); 1449 qp_list.qps = kcalloc(count, sizeof(*qp_list.qps), GFP_ATOMIC);
1449 if (!qp_list.qps) { 1450 if (!qp_list.qps) {
1450 spin_unlock_irq(&ctx->dev->lock); 1451 spin_unlock_irq(&ctx->dev->lock);
1451 return; 1452 return;
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 4106eed1b8fb..aef53305f1c3 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -216,15 +216,15 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
216 } 216 }
217 217
218 if (!user) { 218 if (!user) {
219 wq->sq.sw_sq = kzalloc(wq->sq.size * sizeof *wq->sq.sw_sq, 219 wq->sq.sw_sq = kcalloc(wq->sq.size, sizeof(*wq->sq.sw_sq),
220 GFP_KERNEL); 220 GFP_KERNEL);
221 if (!wq->sq.sw_sq) { 221 if (!wq->sq.sw_sq) {
222 ret = -ENOMEM; 222 ret = -ENOMEM;
223 goto free_rq_qid; 223 goto free_rq_qid;
224 } 224 }
225 225
226 wq->rq.sw_rq = kzalloc(wq->rq.size * sizeof *wq->rq.sw_rq, 226 wq->rq.sw_rq = kcalloc(wq->rq.size, sizeof(*wq->rq.sw_rq),
227 GFP_KERNEL); 227 GFP_KERNEL);
228 if (!wq->rq.sw_rq) { 228 if (!wq->rq.sw_rq) {
229 ret = -ENOMEM; 229 ret = -ENOMEM;
230 goto free_sw_sq; 230 goto free_sw_sq;
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index 0e8dad68910a..a6e11be0ea0f 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -3177,7 +3177,7 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
3177 struct device *dev = hr_dev->dev; 3177 struct device *dev = hr_dev->dev;
3178 int ret = -EINVAL; 3178 int ret = -EINVAL;
3179 3179
3180 context = kzalloc(2 * sizeof(*context), GFP_KERNEL); 3180 context = kcalloc(2, sizeof(*context), GFP_KERNEL);
3181 if (!context) 3181 if (!context)
3182 return -ENOMEM; 3182 return -ENOMEM;
3183 3183
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index d604b3d5aa3e..90a3e2642c2e 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -1613,7 +1613,8 @@ static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx,
1613 1613
1614 tun_qp = &ctx->qp[qp_type]; 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 GFP_KERNEL); 1618 GFP_KERNEL);
1618 if (!tun_qp->ring) 1619 if (!tun_qp->ring)
1619 return -ENOMEM; 1620 return -ENOMEM;
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index dc3c2346045c..6686042aafb4 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -144,7 +144,7 @@ static int mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
144 buddy->max_order = max_order; 144 buddy->max_order = max_order;
145 spin_lock_init(&buddy->lock); 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 GFP_KERNEL); 148 GFP_KERNEL);
149 buddy->num_free = kcalloc((buddy->max_order + 1), sizeof *buddy->num_free, 149 buddy->num_free = kcalloc((buddy->max_order + 1), sizeof *buddy->num_free,
150 GFP_KERNEL); 150 GFP_KERNEL);
diff --git a/drivers/infiniband/hw/mthca/mthca_profile.c b/drivers/infiniband/hw/mthca/mthca_profile.c
index 15d064479ef6..7ea970774839 100644
--- a/drivers/infiniband/hw/mthca/mthca_profile.c
+++ b/drivers/infiniband/hw/mthca/mthca_profile.c
@@ -79,7 +79,7 @@ s64 mthca_make_profile(struct mthca_dev *dev,
79 struct mthca_resource *profile; 79 struct mthca_resource *profile;
80 int i, j; 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 if (!profile) 83 if (!profile)
84 return -ENOMEM; 84 return -ENOMEM;
85 85
diff --git a/drivers/infiniband/hw/nes/nes_mgt.c b/drivers/infiniband/hw/nes/nes_mgt.c
index 21e0ebd39a05..9bdb84dc225c 100644
--- a/drivers/infiniband/hw/nes/nes_mgt.c
+++ b/drivers/infiniband/hw/nes/nes_mgt.c
@@ -878,7 +878,8 @@ int nes_init_mgt_qp(struct nes_device *nesdev, struct net_device *netdev, struct
878 int ret; 878 int ret;
879 879
880 /* Allocate space the all mgt QPs once */ 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 if (!mgtvnic) 883 if (!mgtvnic)
883 return -ENOMEM; 884 return -ENOMEM;
884 885
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 1040a6e34230..32f26556c808 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -2254,8 +2254,9 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
2254 ibmr = ERR_PTR(-ENOMEM); 2254 ibmr = ERR_PTR(-ENOMEM);
2255 goto reg_user_mr_err; 2255 goto reg_user_mr_err;
2256 } 2256 }
2257 root_vpbl.leaf_vpbl = kzalloc(sizeof(*root_vpbl.leaf_vpbl)*1024, 2257 root_vpbl.leaf_vpbl = kcalloc(1024,
2258 GFP_KERNEL); 2258 sizeof(*root_vpbl.leaf_vpbl),
2259 GFP_KERNEL);
2259 if (!root_vpbl.leaf_vpbl) { 2260 if (!root_vpbl.leaf_vpbl) {
2260 ib_umem_release(region); 2261 ib_umem_release(region);
2261 pci_free_consistent(nesdev->pcidev, 8192, root_vpbl.pbl_vbase, 2262 pci_free_consistent(nesdev->pcidev, 8192, root_vpbl.pbl_vbase,
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 2c260e1c29d1..6c136e5017fe 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -3096,7 +3096,7 @@ static int ocrdma_create_eqs(struct ocrdma_dev *dev)
3096 if (!num_eq) 3096 if (!num_eq)
3097 return -EINVAL; 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 if (!dev->eq_tbl) 3100 if (!dev->eq_tbl)
3101 return -ENOMEM; 3101 return -ENOMEM;
3102 3102
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
index eb8b6a935016..5962c0ed9847 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c
@@ -221,19 +221,20 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
221static int ocrdma_alloc_resources(struct ocrdma_dev *dev) 221static int ocrdma_alloc_resources(struct ocrdma_dev *dev)
222{ 222{
223 mutex_init(&dev->dev_lock); 223 mutex_init(&dev->dev_lock);
224 dev->cq_tbl = kzalloc(sizeof(struct ocrdma_cq *) * 224 dev->cq_tbl = kcalloc(OCRDMA_MAX_CQ, sizeof(struct ocrdma_cq *),
225 OCRDMA_MAX_CQ, GFP_KERNEL); 225 GFP_KERNEL);
226 if (!dev->cq_tbl) 226 if (!dev->cq_tbl)
227 goto alloc_err; 227 goto alloc_err;
228 228
229 if (dev->attr.max_qp) { 229 if (dev->attr.max_qp) {
230 dev->qp_tbl = kzalloc(sizeof(struct ocrdma_qp *) * 230 dev->qp_tbl = kcalloc(OCRDMA_MAX_QP,
231 OCRDMA_MAX_QP, GFP_KERNEL); 231 sizeof(struct ocrdma_qp *),
232 GFP_KERNEL);
232 if (!dev->qp_tbl) 233 if (!dev->qp_tbl)
233 goto alloc_err; 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 if (dev->stag_arr == NULL) 238 if (dev->stag_arr == NULL)
238 goto alloc_err; 239 goto alloc_err;
239 240
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index eb9f9e9e213b..82e20fc32890 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -843,8 +843,8 @@ static int ocrdma_build_pbl_tbl(struct ocrdma_dev *dev, struct ocrdma_hw_mr *mr)
843 void *va; 843 void *va;
844 dma_addr_t pa; 844 dma_addr_t pa;
845 845
846 mr->pbl_table = kzalloc(sizeof(struct ocrdma_pbl) * 846 mr->pbl_table = kcalloc(mr->num_pbls, sizeof(struct ocrdma_pbl),
847 mr->num_pbls, GFP_KERNEL); 847 GFP_KERNEL);
848 848
849 if (!mr->pbl_table) 849 if (!mr->pbl_table)
850 return -ENOMEM; 850 return -ENOMEM;
@@ -1323,12 +1323,12 @@ static void ocrdma_set_qp_db(struct ocrdma_dev *dev, struct ocrdma_qp *qp,
1323static int ocrdma_alloc_wr_id_tbl(struct ocrdma_qp *qp) 1323static int ocrdma_alloc_wr_id_tbl(struct ocrdma_qp *qp)
1324{ 1324{
1325 qp->wqe_wr_id_tbl = 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 GFP_KERNEL); 1327 GFP_KERNEL);
1328 if (qp->wqe_wr_id_tbl == NULL) 1328 if (qp->wqe_wr_id_tbl == NULL)
1329 return -ENOMEM; 1329 return -ENOMEM;
1330 qp->rqe_wr_id_tbl = 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 if (qp->rqe_wr_id_tbl == NULL) 1332 if (qp->rqe_wr_id_tbl == NULL)
1333 return -ENOMEM; 1333 return -ENOMEM;
1334 1334
@@ -1865,8 +1865,8 @@ struct ib_srq *ocrdma_create_srq(struct ib_pd *ibpd,
1865 1865
1866 if (udata == NULL) { 1866 if (udata == NULL) {
1867 status = -ENOMEM; 1867 status = -ENOMEM;
1868 srq->rqe_wr_id_tbl = kzalloc(sizeof(u64) * srq->rq.max_cnt, 1868 srq->rqe_wr_id_tbl = kcalloc(srq->rq.max_cnt, sizeof(u64),
1869 GFP_KERNEL); 1869 GFP_KERNEL);
1870 if (srq->rqe_wr_id_tbl == NULL) 1870 if (srq->rqe_wr_id_tbl == NULL)
1871 goto arm_err; 1871 goto arm_err;
1872 1872
diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index f4cb60b658ea..ad22b32bbd9c 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -317,8 +317,8 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
317 u16 n_entries; 317 u16 n_entries;
318 int i, rc; 318 int i, rc;
319 319
320 dev->sgid_tbl = kzalloc(sizeof(union ib_gid) * 320 dev->sgid_tbl = kcalloc(QEDR_MAX_SGID, sizeof(union ib_gid),
321 QEDR_MAX_SGID, GFP_KERNEL); 321 GFP_KERNEL);
322 if (!dev->sgid_tbl) 322 if (!dev->sgid_tbl)
323 return -ENOMEM; 323 return -ENOMEM;
324 324
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 710032f1fad7..f7ac8fc9b531 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -1614,7 +1614,7 @@ static int qedr_create_kernel_qp(struct qedr_dev *dev,
1614 qp->sq.max_wr = min_t(u32, attrs->cap.max_send_wr * dev->wq_multiplier, 1614 qp->sq.max_wr = min_t(u32, attrs->cap.max_send_wr * dev->wq_multiplier,
1615 dev->attr.max_sqe); 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 GFP_KERNEL); 1618 GFP_KERNEL);
1619 if (!qp->wqe_wr_id) { 1619 if (!qp->wqe_wr_id) {
1620 DP_ERR(dev, "create qp: failed SQ shadow memory allocation\n"); 1620 DP_ERR(dev, "create qp: failed SQ shadow memory allocation\n");
@@ -1632,7 +1632,7 @@ static int qedr_create_kernel_qp(struct qedr_dev *dev,
1632 qp->rq.max_wr = (u16) max_t(u32, attrs->cap.max_recv_wr, 1); 1632 qp->rq.max_wr = (u16) max_t(u32, attrs->cap.max_recv_wr, 1);
1633 1633
1634 /* Allocate driver internal RQ array */ 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 GFP_KERNEL); 1636 GFP_KERNEL);
1637 if (!qp->rqe_wr_id) { 1637 if (!qp->rqe_wr_id) {
1638 DP_ERR(dev, 1638 DP_ERR(dev,
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
index 27155d92f810..bf5e222eed8e 100644
--- a/drivers/infiniband/hw/qib/qib_iba7322.c
+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
@@ -7295,8 +7295,9 @@ struct qib_devdata *qib_init_iba7322_funcs(struct pci_dev *pdev,
7295 actual_cnt -= dd->num_pports; 7295 actual_cnt -= dd->num_pports;
7296 7296
7297 tabsize = actual_cnt; 7297 tabsize = actual_cnt;
7298 dd->cspec->msix_entries = kzalloc(tabsize * 7298 dd->cspec->msix_entries = kcalloc(tabsize,
7299 sizeof(struct qib_msix_entry), GFP_KERNEL); 7299 sizeof(struct qib_msix_entry),
7300 GFP_KERNEL);
7300 if (!dd->cspec->msix_entries) 7301 if (!dd->cspec->msix_entries)
7301 tabsize = 0; 7302 tabsize = 0;
7302 7303
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c
index 015520289735..dd4547f537f7 100644
--- a/drivers/infiniband/hw/qib/qib_init.c
+++ b/drivers/infiniband/hw/qib/qib_init.c
@@ -1134,8 +1134,8 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
1134 if (!qib_cpulist_count) { 1134 if (!qib_cpulist_count) {
1135 u32 count = num_online_cpus(); 1135 u32 count = num_online_cpus();
1136 1136
1137 qib_cpulist = kzalloc(BITS_TO_LONGS(count) * 1137 qib_cpulist = kcalloc(BITS_TO_LONGS(count), sizeof(long),
1138 sizeof(long), GFP_KERNEL); 1138 GFP_KERNEL);
1139 if (qib_cpulist) 1139 if (qib_cpulist)
1140 qib_cpulist_count = count; 1140 qib_cpulist_count = count;
1141 } 1141 }
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
index 912d8ef04352..bf5136533d49 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
@@ -543,7 +543,7 @@ alloc_res_chunk_list(struct usnic_vnic *vnic,
543 /* Do Nothing */ 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 GFP_ATOMIC); 547 GFP_ATOMIC);
548 if (!res_chunk_list) 548 if (!res_chunk_list)
549 return ERR_PTR(-ENOMEM); 549 return ERR_PTR(-ENOMEM);
diff --git a/drivers/infiniband/hw/usnic/usnic_vnic.c b/drivers/infiniband/hw/usnic/usnic_vnic.c
index e7b0030254da..ebe08f348453 100644
--- a/drivers/infiniband/hw/usnic/usnic_vnic.c
+++ b/drivers/infiniband/hw/usnic/usnic_vnic.c
@@ -312,7 +312,7 @@ static int usnic_vnic_alloc_res_chunk(struct usnic_vnic *vnic,
312 } 312 }
313 313
314 chunk->cnt = chunk->free_cnt = cnt; 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 if (!chunk->res) 316 if (!chunk->res)
317 return -ENOMEM; 317 return -ENOMEM;
318 318
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 2ce40a7ff604..0d74c807110e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1526,7 +1526,7 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv)
1526 return -ENOMEM; 1526 return -ENOMEM;
1527 set_bit(IPOIB_STOP_NEIGH_GC, &priv->flags); 1527 set_bit(IPOIB_STOP_NEIGH_GC, &priv->flags);
1528 size = roundup_pow_of_two(arp_tbl.gc_thresh3); 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 if (!buckets) { 1530 if (!buckets) {
1531 kfree(htbl); 1531 kfree(htbl);
1532 return -ENOMEM; 1532 return -ENOMEM;
@@ -1704,8 +1704,9 @@ static int ipoib_dev_init_default(struct net_device *dev)
1704 ipoib_napi_add(dev); 1704 ipoib_napi_add(dev);
1705 1705
1706 /* Allocate RX/TX "rings" to hold queued skbs */ 1706 /* Allocate RX/TX "rings" to hold queued skbs */
1707 priv->rx_ring = kzalloc(ipoib_recvq_size * sizeof *priv->rx_ring, 1707 priv->rx_ring = kcalloc(ipoib_recvq_size,
1708 GFP_KERNEL); 1708 sizeof(*priv->rx_ring),
1709 GFP_KERNEL);
1709 if (!priv->rx_ring) 1710 if (!priv->rx_ring)
1710 goto out; 1711 goto out;
1711 1712
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index f2f9318e1f49..cccbcf0eb035 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -181,8 +181,9 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn)
181 u64 dma_addr; 181 u64 dma_addr;
182 int i, j; 182 int i, j;
183 183
184 isert_conn->rx_descs = kzalloc(ISERT_QP_MAX_RECV_DTOS * 184 isert_conn->rx_descs = kcalloc(ISERT_QP_MAX_RECV_DTOS,
185 sizeof(struct iser_rx_desc), GFP_KERNEL); 185 sizeof(struct iser_rx_desc),
186 GFP_KERNEL);
186 if (!isert_conn->rx_descs) 187 if (!isert_conn->rx_descs)
187 return -ENOMEM; 188 return -ENOMEM;
188 189
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 940d38b08e6b..46406345742b 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -337,7 +337,8 @@ static int omap4_keypad_probe(struct platform_device *pdev)
337 337
338 keypad_data->row_shift = get_count_order(keypad_data->cols); 338 keypad_data->row_shift = get_count_order(keypad_data->cols);
339 max_keys = keypad_data->rows << keypad_data->row_shift; 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 GFP_KERNEL); 342 GFP_KERNEL);
342 if (!keypad_data->keymap) { 343 if (!keypad_data->keymap) {
343 dev_err(&pdev->dev, "Not enough memory for keymap\n"); 344 dev_err(&pdev->dev, "Not enough memory for keymap\n");
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 4321f7704b23..75456b5aa825 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1458,7 +1458,7 @@ int dmar_enable_qi(struct intel_iommu *iommu)
1458 1458
1459 qi->desc = page_address(desc_page); 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 if (!qi->desc_status) { 1462 if (!qi->desc_status) {
1463 free_page((unsigned long) qi->desc); 1463 free_page((unsigned long) qi->desc);
1464 kfree(qi); 1464 kfree(qi);
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 89e49a429c57..14e4b3722428 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3189,7 +3189,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
3189 /* This is too big for the stack - allocate it from slab */ 3189 /* This is too big for the stack - allocate it from slab */
3190 ctxt_table_entries = ext ? 512 : 256; 3190 ctxt_table_entries = ext ? 512 : 256;
3191 ret = -ENOMEM; 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 if (!ctxt_tbls) 3193 if (!ctxt_tbls)
3194 goto out_unmap; 3194 goto out_unmap;
3195 3195
@@ -4032,7 +4032,7 @@ static int iommu_suspend(void)
4032 unsigned long flag; 4032 unsigned long flag;
4033 4033
4034 for_each_active_iommu(iommu, drhd) { 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 GFP_ATOMIC); 4036 GFP_ATOMIC);
4037 if (!iommu->iommu_state) 4037 if (!iommu->iommu_state)
4038 goto nomem; 4038 goto nomem;
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index c33b7b104e72..af4a8e7fcd27 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1455,7 +1455,7 @@ static int omap_iommu_add_device(struct device *dev)
1455 if (num_iommus < 0) 1455 if (num_iommus < 0)
1456 return 0; 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 if (!arch_data) 1459 if (!arch_data)
1460 return -ENOMEM; 1460 return -ENOMEM;
1461 1461
diff --git a/drivers/ipack/carriers/tpci200.c b/drivers/ipack/carriers/tpci200.c
index 9b23843dcad4..a16b320739b4 100644
--- a/drivers/ipack/carriers/tpci200.c
+++ b/drivers/ipack/carriers/tpci200.c
@@ -457,8 +457,8 @@ static int tpci200_install(struct tpci200_board *tpci200)
457{ 457{
458 int res; 458 int res;
459 459
460 tpci200->slots = kzalloc( 460 tpci200->slots = kcalloc(TPCI200_NB_SLOT, sizeof(struct tpci200_slot),
461 TPCI200_NB_SLOT * sizeof(struct tpci200_slot), GFP_KERNEL); 461 GFP_KERNEL);
462 if (tpci200->slots == NULL) 462 if (tpci200->slots == NULL)
463 return -ENOMEM; 463 return -ENOMEM;
464 464
diff --git a/drivers/irqchip/irq-alpine-msi.c b/drivers/irqchip/irq-alpine-msi.c
index 63d980995d17..23a3b877f7f1 100644
--- a/drivers/irqchip/irq-alpine-msi.c
+++ b/drivers/irqchip/irq-alpine-msi.c
@@ -268,7 +268,8 @@ static int alpine_msix_init(struct device_node *node,
268 goto err_priv; 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 GFP_KERNEL); 273 GFP_KERNEL);
273 if (!priv->msi_map) { 274 if (!priv->msi_map) {
274 ret = -ENOMEM; 275 ret = -ENOMEM;
diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c
index 1ff38aff9f29..0f52d44b3f69 100644
--- a/drivers/irqchip/irq-gic-v2m.c
+++ b/drivers/irqchip/irq-gic-v2m.c
@@ -361,7 +361,7 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode,
361 break; 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 GFP_KERNEL); 365 GFP_KERNEL);
366 if (!v2m->bm) { 366 if (!v2m->bm) {
367 ret = -ENOMEM; 367 ret = -ENOMEM;
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 4e7ce74e558d..5377d7e2afba 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1239,7 +1239,7 @@ static int its_vlpi_map(struct irq_data *d, struct its_cmd_info *info)
1239 if (!its_dev->event_map.vm) { 1239 if (!its_dev->event_map.vm) {
1240 struct its_vlpi_map *maps; 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 GFP_KERNEL); 1243 GFP_KERNEL);
1244 if (!maps) { 1244 if (!maps) {
1245 ret = -ENOMEM; 1245 ret = -ENOMEM;
@@ -1437,7 +1437,7 @@ static int __init its_lpi_init(u32 id_bits)
1437{ 1437{
1438 lpi_chunks = its_lpi_to_chunk(1UL << id_bits); 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 GFP_KERNEL); 1441 GFP_KERNEL);
1442 if (!lpi_bitmap) { 1442 if (!lpi_bitmap) {
1443 lpi_chunks = 0; 1443 lpi_chunks = 0;
@@ -1471,7 +1471,8 @@ static unsigned long *its_lpi_alloc_chunks(int nr_irqs, int *base, int *nr_ids)
1471 if (!nr_chunks) 1471 if (!nr_chunks)
1472 goto out; 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 GFP_ATOMIC); 1476 GFP_ATOMIC);
1476 if (!bitmap) 1477 if (!bitmap)
1477 goto out; 1478 goto out;
@@ -1823,7 +1824,7 @@ static int its_alloc_tables(struct its_node *its)
1823 1824
1824static int its_alloc_collections(struct its_node *its) 1825static int its_alloc_collections(struct its_node *its)
1825{ 1826{
1826 its->collections = kzalloc(nr_cpu_ids * sizeof(*its->collections), 1827 its->collections = kcalloc(nr_cpu_ids, sizeof(*its->collections),
1827 GFP_KERNEL); 1828 GFP_KERNEL);
1828 if (!its->collections) 1829 if (!its->collections)
1829 return -ENOMEM; 1830 return -ENOMEM;
@@ -2124,10 +2125,10 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
2124 if (alloc_lpis) { 2125 if (alloc_lpis) {
2125 lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis); 2126 lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis);
2126 if (lpi_map) 2127 if (lpi_map)
2127 col_map = kzalloc(sizeof(*col_map) * nr_lpis, 2128 col_map = kcalloc(nr_lpis, sizeof(*col_map),
2128 GFP_KERNEL); 2129 GFP_KERNEL);
2129 } else { 2130 } else {
2130 col_map = kzalloc(sizeof(*col_map) * nr_ites, GFP_KERNEL); 2131 col_map = kcalloc(nr_ites, sizeof(*col_map), GFP_KERNEL);
2131 nr_lpis = 0; 2132 nr_lpis = 0;
2132 lpi_base = 0; 2133 lpi_base = 0;
2133 } 2134 }
@@ -3183,7 +3184,7 @@ static int its_init_vpe_domain(void)
3183 its = list_first_entry(&its_nodes, struct its_node, entry); 3184 its = list_first_entry(&its_nodes, struct its_node, entry);
3184 3185
3185 entries = roundup_pow_of_two(nr_cpu_ids); 3186 entries = roundup_pow_of_two(nr_cpu_ids);
3186 vpe_proxy.vpes = kzalloc(sizeof(*vpe_proxy.vpes) * entries, 3187 vpe_proxy.vpes = kcalloc(entries, sizeof(*vpe_proxy.vpes),
3187 GFP_KERNEL); 3188 GFP_KERNEL);
3188 if (!vpe_proxy.vpes) { 3189 if (!vpe_proxy.vpes) {
3189 pr_err("ITS: Can't allocate GICv4 proxy device array\n"); 3190 pr_err("ITS: Can't allocate GICv4 proxy device array\n");
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 5a67ec084588..76ea56d779a1 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1167,7 +1167,7 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)
1167 if (!nr_parts) 1167 if (!nr_parts)
1168 goto out_put_node; 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 if (WARN_ON(!parts)) 1171 if (WARN_ON(!parts))
1172 goto out_put_node; 1172 goto out_put_node;
1173 1173
@@ -1289,7 +1289,8 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
1289 if (of_property_read_u32(node, "#redistributor-regions", &nr_redist_regions)) 1289 if (of_property_read_u32(node, "#redistributor-regions", &nr_redist_regions))
1290 nr_redist_regions = 1; 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 if (!rdist_regs) { 1294 if (!rdist_regs) {
1294 err = -ENOMEM; 1295 err = -ENOMEM;
1295 goto out_unmap_dist; 1296 goto out_unmap_dist;
diff --git a/drivers/irqchip/irq-partition-percpu.c b/drivers/irqchip/irq-partition-percpu.c
index ccd72c2cbc23..1f7cc5933cd5 100644
--- a/drivers/irqchip/irq-partition-percpu.c
+++ b/drivers/irqchip/irq-partition-percpu.c
@@ -229,7 +229,7 @@ struct partition_desc *partition_create_desc(struct fwnode_handle *fwnode,
229 goto out; 229 goto out;
230 desc->domain = d; 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 GFP_KERNEL); 233 GFP_KERNEL);
234 if (WARN_ON(!desc->bitmap)) 234 if (WARN_ON(!desc->bitmap))
235 goto out; 235 goto out;
diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
index ec0e6a8cdb75..f6fd57ebe6e6 100644
--- a/drivers/irqchip/irq-s3c24xx.c
+++ b/drivers/irqchip/irq-s3c24xx.c
@@ -1261,7 +1261,7 @@ static int __init s3c_init_intc_of(struct device_node *np,
1261 return -ENOMEM; 1261 return -ENOMEM;
1262 1262
1263 intc->domain = domain; 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 GFP_KERNEL); 1265 GFP_KERNEL);
1266 if (!intc->irqs) { 1266 if (!intc->irqs) {
1267 kfree(intc); 1267 kfree(intc);
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index baa1ee2bc2ac..6e0c2814d032 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1260,7 +1260,7 @@ static int __init capinc_tty_init(void)
1260 if (capi_ttyminors <= 0) 1260 if (capi_ttyminors <= 0)
1261 capi_ttyminors = CAPINC_NR_PORTS; 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 GFP_KERNEL); 1264 GFP_KERNEL);
1265 if (!capiminors) 1265 if (!capiminors)
1266 return -ENOMEM; 1266 return -ENOMEM;
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index fd13ed44a54e..9cb2ab57fa4a 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -1370,7 +1370,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
1370 cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8; 1370 cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8;
1371 1371
1372 /* build command table */ 1372 /* build command table */
1373 commands = kzalloc(AT_NUM * (sizeof *commands), GFP_KERNEL); 1373 commands = kcalloc(AT_NUM, sizeof(*commands), GFP_KERNEL);
1374 if (!commands) 1374 if (!commands)
1375 goto oom; 1375 goto oom;
1376 1376
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index 2d75329007f1..b5b389e95edd 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -243,7 +243,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
243 dev_kfree_skb(bcs->rx_skb); 243 dev_kfree_skb(bcs->rx_skb);
244 gigaset_new_rx_skb(bcs); 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 if (!commands) { 247 if (!commands) {
248 gigaset_free_channel(bcs); 248 gigaset_free_channel(bcs);
249 dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n"); 249 dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n");
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
index 5ee5489d3f15..4ac378e48902 100644
--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -72,7 +72,7 @@ avmcard *b1_alloc_card(int nr_controllers)
72 if (!card) 72 if (!card)
73 return NULL; 73 return NULL;
74 74
75 cinfo = kzalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL); 75 cinfo = kcalloc(nr_controllers, sizeof(*cinfo), GFP_KERNEL);
76 if (!cinfo) { 76 if (!cinfo) {
77 kfree(card); 77 kfree(card);
78 return NULL; 78 return NULL;
diff --git a/drivers/isdn/hisax/fsm.c b/drivers/isdn/hisax/fsm.c
index 3e020ec0f65e..80ba82f77c63 100644
--- a/drivers/isdn/hisax/fsm.c
+++ b/drivers/isdn/hisax/fsm.c
@@ -27,7 +27,9 @@ FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount)
27 int i; 27 int i;
28 28
29 fsm->jumpmatrix = 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 if (!fsm->jumpmatrix) 33 if (!fsm->jumpmatrix)
32 return -ENOMEM; 34 return -ENOMEM;
33 35
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index 1644ac52548b..7a501dbe7123 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -2070,14 +2070,14 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
2070 2070
2071 if ((adding) && (d->rcverr)) 2071 if ((adding) && (d->rcverr))
2072 kfree(d->rcverr); 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 printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n"); 2074 printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n");
2075 return -1; 2075 return -1;
2076 } 2076 }
2077 2077
2078 if ((adding) && (d->rcvcount)) 2078 if ((adding) && (d->rcvcount))
2079 kfree(d->rcvcount); 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 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); 2081 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
2082 if (!adding) 2082 if (!adding)
2083 kfree(d->rcverr); 2083 kfree(d->rcverr);
diff --git a/drivers/isdn/mISDN/fsm.c b/drivers/isdn/mISDN/fsm.c
index cabcb906e0b5..9a8d08d677a4 100644
--- a/drivers/isdn/mISDN/fsm.c
+++ b/drivers/isdn/mISDN/fsm.c
@@ -32,8 +32,10 @@ mISDN_FsmNew(struct Fsm *fsm,
32{ 32{
33 int i; 33 int i;
34 34
35 fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count * 35 fsm->jumpmatrix =
36 fsm->event_count, GFP_KERNEL); 36 kzalloc(array3_size(sizeof(FSMFNPTR), fsm->state_count,
37 fsm->event_count),
38 GFP_KERNEL);
37 if (fsm->jumpmatrix == NULL) 39 if (fsm->jumpmatrix == NULL)
38 return -ENOMEM; 40 return -ENOMEM;
39 41
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index f497a77423a2..c7a7c2de0672 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -379,7 +379,7 @@ static int pblk_core_init(struct pblk *pblk)
379 return -EINVAL; 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 GFP_KERNEL); 383 GFP_KERNEL);
384 if (!pblk->pad_dist) 384 if (!pblk->pad_dist)
385 return -ENOMEM; 385 return -ENOMEM;
diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index fc3c237daef2..311e91b1a14f 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -466,7 +466,8 @@ static int __init acpi_pcc_probe(void)
466 return -EINVAL; 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 if (!pcc_mbox_channels) { 471 if (!pcc_mbox_channels) {
471 pr_err("Could not allocate space for PCC mbox channels\n"); 472 pr_err("Could not allocate space for PCC mbox channels\n");
472 return -ENOMEM; 473 return -ENOMEM;
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index a31e55bcc4e5..ec5f70d021de 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1715,7 +1715,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)
1715 iter_size = (sb->bucket_size / sb->block_size + 1) * 1715 iter_size = (sb->bucket_size / sb->block_size + 1) *
1716 sizeof(struct btree_iter_set); 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 mempool_init_slab_pool(&c->search, 32, bch_search_cache) || 1719 mempool_init_slab_pool(&c->search, 32, bch_search_cache) ||
1720 mempool_init_kmalloc_pool(&c->bio_meta, 2, 1720 mempool_init_kmalloc_pool(&c->bio_meta, 2,
1721 sizeof(struct bbio) + sizeof(struct bio_vec) * 1721 sizeof(struct bbio) + sizeof(struct bio_vec) *
@@ -2043,8 +2043,9 @@ static int cache_alloc(struct cache *ca)
2043 !init_heap(&ca->heap, free << 3, GFP_KERNEL) || 2043 !init_heap(&ca->heap, free << 3, GFP_KERNEL) ||
2044 !(ca->buckets = vzalloc(sizeof(struct bucket) * 2044 !(ca->buckets = vzalloc(sizeof(struct bucket) *
2045 ca->sb.nbuckets)) || 2045 ca->sb.nbuckets)) ||
2046 !(ca->prio_buckets = kzalloc(sizeof(uint64_t) * prio_buckets(ca) * 2046 !(ca->prio_buckets = kzalloc(array3_size(sizeof(uint64_t),
2047 2, GFP_KERNEL)) || 2047 prio_buckets(ca), 2),
2048 GFP_KERNEL)) ||
2048 !(ca->disk_buckets = alloc_bucket_pages(GFP_KERNEL, ca))) 2049 !(ca->disk_buckets = alloc_bucket_pages(GFP_KERNEL, ca)))
2049 return -ENOMEM; 2050 return -ENOMEM;
2050 2051
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index da02f4d8e4b9..57ca92dc0c3e 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1878,8 +1878,9 @@ static int crypt_alloc_tfms_skcipher(struct crypt_config *cc, char *ciphermode)
1878 unsigned i; 1878 unsigned i;
1879 int err; 1879 int err;
1880 1880
1881 cc->cipher_tfm.tfms = kzalloc(cc->tfms_count * 1881 cc->cipher_tfm.tfms = kcalloc(cc->tfms_count,
1882 sizeof(struct crypto_skcipher *), GFP_KERNEL); 1882 sizeof(struct crypto_skcipher *),
1883 GFP_KERNEL);
1883 if (!cc->cipher_tfm.tfms) 1884 if (!cc->cipher_tfm.tfms)
1884 return -ENOMEM; 1885 return -ENOMEM;
1885 1886
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 01c8329b512d..f983c3fdf204 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -2117,7 +2117,7 @@ int bitmap_resize(struct bitmap *bitmap, sector_t blocks,
2117 2117
2118 pages = DIV_ROUND_UP(chunks, PAGE_COUNTER_RATIO); 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 ret = -ENOMEM; 2121 ret = -ENOMEM;
2122 if (!new_bp) { 2122 if (!new_bp) {
2123 bitmap_file_unmap(&store); 2123 bitmap_file_unmap(&store);
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 79bfbc840385..021cbf9ef1bf 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1380,9 +1380,9 @@ static int lock_all_bitmaps(struct mddev *mddev)
1380 char str[64]; 1380 char str[64];
1381 struct md_cluster_info *cinfo = mddev->cluster_info; 1381 struct md_cluster_info *cinfo = mddev->cluster_info;
1382 1382
1383 cinfo->other_bitmap_lockres = kzalloc((mddev->bitmap_info.nodes - 1) * 1383 cinfo->other_bitmap_lockres =
1384 sizeof(struct dlm_lock_resource *), 1384 kcalloc(mddev->bitmap_info.nodes - 1,
1385 GFP_KERNEL); 1385 sizeof(struct dlm_lock_resource *), GFP_KERNEL);
1386 if (!cinfo->other_bitmap_lockres) { 1386 if (!cinfo->other_bitmap_lockres) {
1387 pr_err("md: can't alloc mem for other bitmap locks\n"); 1387 pr_err("md: can't alloc mem for other bitmap locks\n");
1388 return 0; 1388 return 0;
diff --git a/drivers/md/md-multipath.c b/drivers/md/md-multipath.c
index f71fcdb9b39c..881487de1e25 100644
--- a/drivers/md/md-multipath.c
+++ b/drivers/md/md-multipath.c
@@ -399,7 +399,8 @@ static int multipath_run (struct mddev *mddev)
399 if (!conf) 399 if (!conf)
400 goto out; 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 GFP_KERNEL); 404 GFP_KERNEL);
404 if (!conf->multipaths) 405 if (!conf->multipaths)
405 goto out_free_conf; 406 goto out_free_conf;
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 65ae47a02218..ac1cffd2a09b 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -159,12 +159,14 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
159 } 159 }
160 160
161 err = -ENOMEM; 161 err = -ENOMEM;
162 conf->strip_zone = kzalloc(sizeof(struct strip_zone)* 162 conf->strip_zone = kcalloc(conf->nr_strip_zones,
163 conf->nr_strip_zones, GFP_KERNEL); 163 sizeof(struct strip_zone),
164 GFP_KERNEL);
164 if (!conf->strip_zone) 165 if (!conf->strip_zone)
165 goto abort; 166 goto abort;
166 conf->devlist = kzalloc(sizeof(struct md_rdev*)* 167 conf->devlist = kzalloc(array3_size(sizeof(struct md_rdev *),
167 conf->nr_strip_zones*mddev->raid_disks, 168 conf->nr_strip_zones,
169 mddev->raid_disks),
168 GFP_KERNEL); 170 GFP_KERNEL);
169 if (!conf->devlist) 171 if (!conf->devlist)
170 goto abort; 172 goto abort;
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index e7c0ecd19234..8e05c1092aef 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2936,9 +2936,9 @@ static struct r1conf *setup_conf(struct mddev *mddev)
2936 if (!conf->barrier) 2936 if (!conf->barrier)
2937 goto abort; 2937 goto abort;
2938 2938
2939 conf->mirrors = kzalloc(sizeof(struct raid1_info) 2939 conf->mirrors = kzalloc(array3_size(sizeof(struct raid1_info),
2940 * mddev->raid_disks * 2, 2940 mddev->raid_disks, 2),
2941 GFP_KERNEL); 2941 GFP_KERNEL);
2942 if (!conf->mirrors) 2942 if (!conf->mirrors)
2943 goto abort; 2943 goto abort;
2944 2944
@@ -3241,7 +3241,8 @@ static int raid1_reshape(struct mddev *mddev)
3241 kfree(newpoolinfo); 3241 kfree(newpoolinfo);
3242 return ret; 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 GFP_KERNEL); 3246 GFP_KERNEL);
3246 if (!newmirrors) { 3247 if (!newmirrors) {
3247 kfree(newpoolinfo); 3248 kfree(newpoolinfo);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index e35db73b9b9e..478cf446827f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3688,8 +3688,8 @@ static struct r10conf *setup_conf(struct mddev *mddev)
3688 goto out; 3688 goto out;
3689 3689
3690 /* FIXME calc properly */ 3690 /* FIXME calc properly */
3691 conf->mirrors = kzalloc(sizeof(struct raid10_info)*(mddev->raid_disks + 3691 conf->mirrors = kcalloc(mddev->raid_disks + max(0, -mddev->delta_disks),
3692 max(0,-mddev->delta_disks)), 3692 sizeof(struct raid10_info),
3693 GFP_KERNEL); 3693 GFP_KERNEL);
3694 if (!conf->mirrors) 3694 if (!conf->mirrors)
3695 goto out; 3695 goto out;
@@ -4129,11 +4129,10 @@ static int raid10_check_reshape(struct mddev *mddev)
4129 conf->mirrors_new = NULL; 4129 conf->mirrors_new = NULL;
4130 if (mddev->delta_disks > 0) { 4130 if (mddev->delta_disks > 0) {
4131 /* allocate new 'mirrors' list */ 4131 /* allocate new 'mirrors' list */
4132 conf->mirrors_new = kzalloc( 4132 conf->mirrors_new =
4133 sizeof(struct raid10_info) 4133 kcalloc(mddev->raid_disks + mddev->delta_disks,
4134 *(mddev->raid_disks + 4134 sizeof(struct raid10_info),
4135 mddev->delta_disks), 4135 GFP_KERNEL);
4136 GFP_KERNEL);
4137 if (!conf->mirrors_new) 4136 if (!conf->mirrors_new)
4138 return -ENOMEM; 4137 return -ENOMEM;
4139 } 4138 }
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 73489446bbcb..2031506a0ecd 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2396,7 +2396,7 @@ static int resize_stripes(struct r5conf *conf, int newsize)
2396 * is completely stalled, so now is a good time to resize 2396 * is completely stalled, so now is a good time to resize
2397 * conf->disks and the scribble region 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 if (ndisks) { 2400 if (ndisks) {
2401 for (i = 0; i < conf->pool_size; i++) 2401 for (i = 0; i < conf->pool_size; i++)
2402 ndisks[i] = conf->disks[i]; 2402 ndisks[i] = conf->disks[i];
@@ -6664,9 +6664,9 @@ static int alloc_thread_groups(struct r5conf *conf, int cnt,
6664 } 6664 }
6665 *group_cnt = num_possible_nodes(); 6665 *group_cnt = num_possible_nodes();
6666 size = sizeof(struct r5worker) * cnt; 6666 size = sizeof(struct r5worker) * cnt;
6667 workers = kzalloc(size * *group_cnt, GFP_NOIO); 6667 workers = kcalloc(size, *group_cnt, GFP_NOIO);
6668 *worker_groups = kzalloc(sizeof(struct r5worker_group) * 6668 *worker_groups = kcalloc(*group_cnt, sizeof(struct r5worker_group),
6669 *group_cnt, GFP_NOIO); 6669 GFP_NOIO);
6670 if (!*worker_groups || !workers) { 6670 if (!*worker_groups || !workers) {
6671 kfree(workers); 6671 kfree(workers);
6672 kfree(*worker_groups); 6672 kfree(*worker_groups);
@@ -6894,8 +6894,9 @@ static struct r5conf *setup_conf(struct mddev *mddev)
6894 goto abort; 6894 goto abort;
6895 INIT_LIST_HEAD(&conf->free_list); 6895 INIT_LIST_HEAD(&conf->free_list);
6896 INIT_LIST_HEAD(&conf->pending_list); 6896 INIT_LIST_HEAD(&conf->pending_list);
6897 conf->pending_data = kzalloc(sizeof(struct r5pending_data) * 6897 conf->pending_data = kcalloc(PENDING_IO_MAX,
6898 PENDING_IO_MAX, GFP_KERNEL); 6898 sizeof(struct r5pending_data),
6899 GFP_KERNEL);
6899 if (!conf->pending_data) 6900 if (!conf->pending_data)
6900 goto abort; 6901 goto abort;
6901 for (i = 0; i < PENDING_IO_MAX; i++) 6902 for (i = 0; i < PENDING_IO_MAX; i++)
@@ -6944,7 +6945,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
6944 conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks; 6945 conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks;
6945 max_disks = max(conf->raid_disks, conf->previous_raid_disks); 6946 max_disks = max(conf->raid_disks, conf->previous_raid_disks);
6946 6947
6947 conf->disks = kzalloc(max_disks * sizeof(struct disk_info), 6948 conf->disks = kcalloc(max_disks, sizeof(struct disk_info),
6948 GFP_KERNEL); 6949 GFP_KERNEL);
6949 6950
6950 if (!conf->disks) 6951 if (!conf->disks)
diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c
index 902af482448e..5a8dbc0b25fb 100644
--- a/drivers/media/dvb-frontends/dib7000p.c
+++ b/drivers/media/dvb-frontends/dib7000p.c
@@ -2018,10 +2018,10 @@ static int dib7000pc_detection(struct i2c_adapter *i2c_adap)
2018 }; 2018 };
2019 int ret = 0; 2019 int ret = 0;
2020 2020
2021 tx = kzalloc(2*sizeof(u8), GFP_KERNEL); 2021 tx = kzalloc(2, GFP_KERNEL);
2022 if (!tx) 2022 if (!tx)
2023 return -ENOMEM; 2023 return -ENOMEM;
2024 rx = kzalloc(2*sizeof(u8), GFP_KERNEL); 2024 rx = kzalloc(2, GFP_KERNEL);
2025 if (!rx) { 2025 if (!rx) {
2026 ret = -ENOMEM; 2026 ret = -ENOMEM;
2027 goto rx_memory_error; 2027 goto rx_memory_error;
diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c
index 6f35173d2968..22eec8f65485 100644
--- a/drivers/media/dvb-frontends/dib8000.c
+++ b/drivers/media/dvb-frontends/dib8000.c
@@ -4271,12 +4271,12 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods,
4271 u8 new_addr = 0; 4271 u8 new_addr = 0;
4272 struct i2c_device client = {.adap = host }; 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 if (!client.i2c_write_buffer) { 4275 if (!client.i2c_write_buffer) {
4276 dprintk("%s: not enough memory\n", __func__); 4276 dprintk("%s: not enough memory\n", __func__);
4277 return -ENOMEM; 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 if (!client.i2c_read_buffer) { 4280 if (!client.i2c_read_buffer) {
4281 dprintk("%s: not enough memory\n", __func__); 4281 dprintk("%s: not enough memory\n", __func__);
4282 ret = -ENOMEM; 4282 ret = -ENOMEM;
diff --git a/drivers/media/dvb-frontends/dib9000.c b/drivers/media/dvb-frontends/dib9000.c
index f9289f488de7..b8edb55696bb 100644
--- a/drivers/media/dvb-frontends/dib9000.c
+++ b/drivers/media/dvb-frontends/dib9000.c
@@ -2381,12 +2381,12 @@ int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defaul
2381 u8 new_addr = 0; 2381 u8 new_addr = 0;
2382 struct i2c_device client = {.i2c_adap = i2c }; 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 if (!client.i2c_write_buffer) { 2385 if (!client.i2c_write_buffer) {
2386 dprintk("%s: not enough memory\n", __func__); 2386 dprintk("%s: not enough memory\n", __func__);
2387 return -ENOMEM; 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 if (!client.i2c_read_buffer) { 2390 if (!client.i2c_read_buffer) {
2391 dprintk("%s: not enough memory\n", __func__); 2391 dprintk("%s: not enough memory\n", __func__);
2392 ret = -ENOMEM; 2392 ret = -ENOMEM;
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 964cd7bcdd2c..70e187971590 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -217,14 +217,14 @@ static int au0828_init_isoc(struct au0828_dev *dev, int max_packets,
217 dev->isoc_ctl.isoc_copy = isoc_copy; 217 dev->isoc_ctl.isoc_copy = isoc_copy;
218 dev->isoc_ctl.num_bufs = num_bufs; 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 if (!dev->isoc_ctl.urb) { 221 if (!dev->isoc_ctl.urb) {
222 au0828_isocdbg("cannot alloc memory for usb buffers\n"); 222 au0828_isocdbg("cannot alloc memory for usb buffers\n");
223 return -ENOMEM; 223 return -ENOMEM;
224 } 224 }
225 225
226 dev->isoc_ctl.transfer_buffer = kzalloc(sizeof(void *)*num_bufs, 226 dev->isoc_ctl.transfer_buffer = kcalloc(num_bufs, sizeof(void *),
227 GFP_KERNEL); 227 GFP_KERNEL);
228 if (!dev->isoc_ctl.transfer_buffer) { 228 if (!dev->isoc_ctl.transfer_buffer) {
229 au0828_isocdbg("cannot allocate memory for usb transfer\n"); 229 au0828_isocdbg("cannot allocate memory for usb transfer\n");
230 kfree(dev->isoc_ctl.urb); 230 kfree(dev->isoc_ctl.urb);
diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
index 4f43668df15d..53d846dea3d2 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -1034,7 +1034,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
1034 dma_q->partial_buf[i] = 0; 1034 dma_q->partial_buf[i] = 0;
1035 1035
1036 dev->video_mode.isoc_ctl.urb = 1036 dev->video_mode.isoc_ctl.urb =
1037 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1037 kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
1038 if (!dev->video_mode.isoc_ctl.urb) { 1038 if (!dev->video_mode.isoc_ctl.urb) {
1039 dev_err(dev->dev, 1039 dev_err(dev->dev,
1040 "cannot alloc memory for usb buffers\n"); 1040 "cannot alloc memory for usb buffers\n");
@@ -1042,7 +1042,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
1042 } 1042 }
1043 1043
1044 dev->video_mode.isoc_ctl.transfer_buffer = 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 if (!dev->video_mode.isoc_ctl.transfer_buffer) { 1046 if (!dev->video_mode.isoc_ctl.transfer_buffer) {
1047 dev_err(dev->dev, 1047 dev_err(dev->dev,
1048 "cannot allocate memory for usbtransfer\n"); 1048 "cannot allocate memory for usbtransfer\n");
@@ -1169,7 +1169,7 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
1169 dma_q->partial_buf[i] = 0; 1169 dma_q->partial_buf[i] = 0;
1170 1170
1171 dev->video_mode.bulk_ctl.urb = 1171 dev->video_mode.bulk_ctl.urb =
1172 kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); 1172 kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
1173 if (!dev->video_mode.bulk_ctl.urb) { 1173 if (!dev->video_mode.bulk_ctl.urb) {
1174 dev_err(dev->dev, 1174 dev_err(dev->dev,
1175 "cannot alloc memory for usb buffers\n"); 1175 "cannot alloc memory for usb buffers\n");
@@ -1177,7 +1177,7 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
1177 } 1177 }
1178 1178
1179 dev->video_mode.bulk_ctl.transfer_buffer = 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 if (!dev->video_mode.bulk_ctl.transfer_buffer) { 1181 if (!dev->video_mode.bulk_ctl.transfer_buffer) {
1182 dev_err(dev->dev, 1182 dev_err(dev->dev,
1183 "cannot allocate memory for usbtransfer\n"); 1183 "cannot allocate memory for usbtransfer\n");
diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c b/drivers/media/usb/cx231xx/cx231xx-vbi.c
index d3bfe8e23b1f..b621cf1aa96b 100644
--- a/drivers/media/usb/cx231xx/cx231xx-vbi.c
+++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c
@@ -415,7 +415,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
415 for (i = 0; i < 8; i++) 415 for (i = 0; i < 8; i++)
416 dma_q->partial_buf[i] = 0; 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 GFP_KERNEL); 419 GFP_KERNEL);
420 if (!dev->vbi_mode.bulk_ctl.urb) { 420 if (!dev->vbi_mode.bulk_ctl.urb) {
421 dev_err(dev->dev, 421 dev_err(dev->dev,
@@ -424,7 +424,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
424 } 424 }
425 425
426 dev->vbi_mode.bulk_ctl.transfer_buffer = 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 if (!dev->vbi_mode.bulk_ctl.transfer_buffer) { 428 if (!dev->vbi_mode.bulk_ctl.transfer_buffer) {
429 dev_err(dev->dev, 429 dev_err(dev->dev,
430 "cannot allocate memory for usbtransfer\n"); 430 "cannot allocate memory for usbtransfer\n");
diff --git a/drivers/media/usb/go7007/go7007-fw.c b/drivers/media/usb/go7007/go7007-fw.c
index 87b4fc48ef09..24f5b615dc7a 100644
--- a/drivers/media/usb/go7007/go7007-fw.c
+++ b/drivers/media/usb/go7007/go7007-fw.c
@@ -1579,7 +1579,7 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen)
1579 GO7007_FW_NAME); 1579 GO7007_FW_NAME);
1580 return -1; 1580 return -1;
1581 } 1581 }
1582 code = kzalloc(codespace * 2, GFP_KERNEL); 1582 code = kcalloc(codespace, 2, GFP_KERNEL);
1583 if (code == NULL) 1583 if (code == NULL)
1584 goto fw_failed; 1584 goto fw_failed;
1585 1585
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
index e0353161ccd6..a8519da0020b 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
@@ -2413,7 +2413,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
2413 2413
2414 hdw->control_cnt = CTRLDEF_COUNT; 2414 hdw->control_cnt = CTRLDEF_COUNT;
2415 hdw->control_cnt += MPEGDEF_COUNT; 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 GFP_KERNEL); 2417 GFP_KERNEL);
2418 if (!hdw->controls) goto fail; 2418 if (!hdw->controls) goto fail;
2419 hdw->hdw_desc = hdw_desc; 2419 hdw->hdw_desc = hdw_desc;
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-std.c b/drivers/media/usb/pvrusb2/pvrusb2-std.c
index 21bb20dba82c..6b651f8b54df 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-std.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-std.c
@@ -361,7 +361,7 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr,
361 std_cnt); 361 std_cnt);
362 if (!std_cnt) return NULL; // paranoia 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 GFP_KERNEL); 365 GFP_KERNEL);
366 if (!stddefs) 366 if (!stddefs)
367 return NULL; 367 return NULL;
diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
index 423c03a0638d..2811f612820f 100644
--- a/drivers/media/usb/stk1160/stk1160-video.c
+++ b/drivers/media/usb/stk1160/stk1160-video.c
@@ -439,14 +439,14 @@ int stk1160_alloc_isoc(struct stk1160 *dev)
439 439
440 dev->isoc_ctl.buf = NULL; 440 dev->isoc_ctl.buf = NULL;
441 dev->isoc_ctl.max_pkt_size = dev->max_pkt_size; 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 if (!dev->isoc_ctl.urb) { 443 if (!dev->isoc_ctl.urb) {
444 stk1160_err("out of memory for urb array\n"); 444 stk1160_err("out of memory for urb array\n");
445 return -ENOMEM; 445 return -ENOMEM;
446 } 446 }
447 447
448 dev->isoc_ctl.transfer_buffer = kzalloc(sizeof(void *)*num_bufs, 448 dev->isoc_ctl.transfer_buffer = kcalloc(num_bufs, sizeof(void *),
449 GFP_KERNEL); 449 GFP_KERNEL);
450 if (!dev->isoc_ctl.transfer_buffer) { 450 if (!dev->isoc_ctl.transfer_buffer) {
451 stk1160_err("out of memory for usb transfers\n"); 451 stk1160_err("out of memory for usb transfers\n");
452 kfree(dev->isoc_ctl.urb); 452 kfree(dev->isoc_ctl.urb);
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
index 22389b56ec24..5accb5241072 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -567,8 +567,9 @@ static int stk_prepare_sio_buffers(struct stk_camera *dev, unsigned n_sbufs)
567 if (dev->sio_bufs != NULL) 567 if (dev->sio_bufs != NULL)
568 pr_err("sio_bufs already allocated\n"); 568 pr_err("sio_bufs already allocated\n");
569 else { 569 else {
570 dev->sio_bufs = kzalloc(n_sbufs * sizeof(struct stk_sio_buffer), 570 dev->sio_bufs = kcalloc(n_sbufs,
571 GFP_KERNEL); 571 sizeof(struct stk_sio_buffer),
572 GFP_KERNEL);
572 if (dev->sio_bufs == NULL) 573 if (dev->sio_bufs == NULL)
573 return -ENOMEM; 574 return -ENOMEM;
574 for (i = 0; i < n_sbufs; i++) { 575 for (i = 0; i < n_sbufs; i++) {
diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c
index ce79df643c7e..36a9a4017185 100644
--- a/drivers/media/usb/usbtv/usbtv-video.c
+++ b/drivers/media/usb/usbtv/usbtv-video.c
@@ -507,7 +507,7 @@ static struct urb *usbtv_setup_iso_transfer(struct usbtv *usbtv)
507 ip->pipe = usb_rcvisocpipe(usbtv->udev, USBTV_VIDEO_ENDP); 507 ip->pipe = usb_rcvisocpipe(usbtv->udev, USBTV_VIDEO_ENDP);
508 ip->interval = 1; 508 ip->interval = 1;
509 ip->transfer_flags = URB_ISO_ASAP; 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 GFP_KERNEL); 511 GFP_KERNEL);
512 if (!ip->transfer_buffer) { 512 if (!ip->transfer_buffer) {
513 usb_free_urb(ip); 513 usb_free_urb(ip);
diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index 4199cdd4ff89..306e1fd109bd 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -299,13 +299,14 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
299 resp = (struct ec_response_motion_sense *)msg->data; 299 resp = (struct ec_response_motion_sense *)msg->data;
300 sensor_num = resp->dump.sensor_count; 300 sensor_num = resp->dump.sensor_count;
301 /* Allocate 1 extra sensors in FIFO are needed */ 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 GFP_KERNEL); 303 GFP_KERNEL);
304 if (sensor_cells == NULL) 304 if (sensor_cells == NULL)
305 goto error; 305 goto error;
306 306
307 sensor_platforms = kzalloc(sizeof(struct cros_ec_sensor_platform) * 307 sensor_platforms = kcalloc(sensor_num + 1,
308 (sensor_num + 1), GFP_KERNEL); 308 sizeof(struct cros_ec_sensor_platform),
309 GFP_KERNEL);
309 if (sensor_platforms == NULL) 310 if (sensor_platforms == NULL)
310 goto error_platforms; 311 goto error_platforms;
311 312
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index c57e407020f1..94e3f32ce935 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -158,7 +158,7 @@ static int mfd_add_device(struct device *parent, int id,
158 if (!pdev) 158 if (!pdev)
159 goto fail_alloc; 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 if (!res) 162 if (!res)
163 goto fail_device; 163 goto fail_device;
164 164
diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c
index 7c13d2e7061c..05ecf828b2ab 100644
--- a/drivers/mfd/timberdale.c
+++ b/drivers/mfd/timberdale.c
@@ -707,8 +707,8 @@ static int timb_probe(struct pci_dev *dev,
707 goto err_config; 707 goto err_config;
708 } 708 }
709 709
710 msix_entries = kzalloc(TIMBERDALE_NR_IRQS * sizeof(*msix_entries), 710 msix_entries = kcalloc(TIMBERDALE_NR_IRQS, sizeof(*msix_entries),
711 GFP_KERNEL); 711 GFP_KERNEL);
712 if (!msix_entries) 712 if (!msix_entries)
713 goto err_config; 713 goto err_config;
714 714
diff --git a/drivers/misc/altera-stapl/altera.c b/drivers/misc/altera-stapl/altera.c
index f53e217e963f..ef83a9078646 100644
--- a/drivers/misc/altera-stapl/altera.c
+++ b/drivers/misc/altera-stapl/altera.c
@@ -304,13 +304,13 @@ static int altera_execute(struct altera_state *astate,
304 if (sym_count <= 0) 304 if (sym_count <= 0)
305 goto exit_done; 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 if (vars == NULL) 309 if (vars == NULL)
310 status = -ENOMEM; 310 status = -ENOMEM;
311 311
312 if (status == 0) { 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 if (var_size == NULL) 315 if (var_size == NULL)
316 status = -ENOMEM; 316 status = -ENOMEM;
@@ -1136,7 +1136,7 @@ exit_done:
1136 /* Allocate a writable buffer for this array */ 1136 /* Allocate a writable buffer for this array */
1137 count = var_size[variable_id]; 1137 count = var_size[variable_id];
1138 long_tmp = vars[variable_id]; 1138 long_tmp = vars[variable_id];
1139 longptr_tmp = kzalloc(count * sizeof(long), 1139 longptr_tmp = kcalloc(count, sizeof(long),
1140 GFP_KERNEL); 1140 GFP_KERNEL);
1141 vars[variable_id] = (long)longptr_tmp; 1141 vars[variable_id] = (long)longptr_tmp;
1142 1142
diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
index f58b4b6c79f2..4644f16606a3 100644
--- a/drivers/misc/cxl/guest.c
+++ b/drivers/misc/cxl/guest.c
@@ -89,7 +89,7 @@ static ssize_t guest_collect_vpd(struct cxl *adapter, struct cxl_afu *afu,
89 mod = 0; 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 if (!vpd_buf) 93 if (!vpd_buf)
94 return -ENOMEM; 94 return -ENOMEM;
95 95
diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
index ec175ea5dfba..aff181cd0bf2 100644
--- a/drivers/misc/cxl/of.c
+++ b/drivers/misc/cxl/of.c
@@ -302,7 +302,7 @@ static int read_adapter_irq_config(struct cxl *adapter, struct device_node *np)
302 if (nranges == 0 || (nranges * 2 * sizeof(int)) != len) 302 if (nranges == 0 || (nranges * 2 * sizeof(int)) != len)
303 return -EINVAL; 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 GFP_KERNEL); 306 GFP_KERNEL);
307 if (adapter->guest->irq_avail == NULL) 307 if (adapter->guest->irq_avail == NULL)
308 return -ENOMEM; 308 return -ENOMEM;
diff --git a/drivers/misc/genwqe/card_ddcb.c b/drivers/misc/genwqe/card_ddcb.c
index b7f8d35c17a9..656449cb4476 100644
--- a/drivers/misc/genwqe/card_ddcb.c
+++ b/drivers/misc/genwqe/card_ddcb.c
@@ -1048,15 +1048,16 @@ static int setup_ddcb_queue(struct genwqe_dev *cd, struct ddcb_queue *queue)
1048 "[%s] **err: could not allocate DDCB **\n", __func__); 1048 "[%s] **err: could not allocate DDCB **\n", __func__);
1049 return -ENOMEM; 1049 return -ENOMEM;
1050 } 1050 }
1051 queue->ddcb_req = kzalloc(sizeof(struct ddcb_requ *) * 1051 queue->ddcb_req = kcalloc(queue->ddcb_max, sizeof(struct ddcb_requ *),
1052 queue->ddcb_max, GFP_KERNEL); 1052 GFP_KERNEL);
1053 if (!queue->ddcb_req) { 1053 if (!queue->ddcb_req) {
1054 rc = -ENOMEM; 1054 rc = -ENOMEM;
1055 goto free_ddcbs; 1055 goto free_ddcbs;
1056 } 1056 }
1057 1057
1058 queue->ddcb_waitqs = kzalloc(sizeof(wait_queue_head_t) * 1058 queue->ddcb_waitqs = kcalloc(queue->ddcb_max,
1059 queue->ddcb_max, GFP_KERNEL); 1059 sizeof(wait_queue_head_t),
1060 GFP_KERNEL);
1060 if (!queue->ddcb_waitqs) { 1061 if (!queue->ddcb_waitqs) {
1061 rc = -ENOMEM; 1062 rc = -ENOMEM;
1062 goto free_requs; 1063 goto free_requs;
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 0c775d6fcf59..83fc748a91a7 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -416,7 +416,8 @@ xpc_setup_ch_structures(struct xpc_partition *part)
416 * memory. 416 * memory.
417 */ 417 */
418 DBUG_ON(part->channels != NULL); 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 GFP_KERNEL); 421 GFP_KERNEL);
421 if (part->channels == NULL) { 422 if (part->channels == NULL) {
422 dev_err(xpc_chan, "can't get memory for channels\n"); 423 dev_err(xpc_chan, "can't get memory for channels\n");
@@ -905,8 +906,9 @@ xpc_setup_partitions(void)
905 short partid; 906 short partid;
906 struct xpc_partition *part; 907 struct xpc_partition *part;
907 908
908 xpc_partitions = kzalloc(sizeof(struct xpc_partition) * 909 xpc_partitions = kcalloc(xp_max_npartitions,
909 xp_max_npartitions, GFP_KERNEL); 910 sizeof(struct xpc_partition),
911 GFP_KERNEL);
910 if (xpc_partitions == NULL) { 912 if (xpc_partitions == NULL) {
911 dev_err(xpc_part, "can't get memory for partition structure\n"); 913 dev_err(xpc_part, "can't get memory for partition structure\n");
912 return -ENOMEM; 914 return -ENOMEM;
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 6956f7e7d439..7284413dabfd 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -425,7 +425,7 @@ xpc_discovery(void)
425 if (remote_rp == NULL) 425 if (remote_rp == NULL)
426 return; 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 GFP_KERNEL); 429 GFP_KERNEL);
430 if (discovered_nasids == NULL) { 430 if (discovered_nasids == NULL) {
431 kfree(remote_rp_base); 431 kfree(remote_rp_base);
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 216d5c756236..44d750d98bc8 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -520,8 +520,9 @@ xpnet_init(void)
520 520
521 dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME); 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) * 523 xpnet_broadcast_partitions = kcalloc(BITS_TO_LONGS(xp_max_npartitions),
524 sizeof(long), GFP_KERNEL); 524 sizeof(long),
525 GFP_KERNEL);
525 if (xpnet_broadcast_partitions == NULL) 526 if (xpnet_broadcast_partitions == NULL)
526 return -ENOMEM; 527 return -ENOMEM;
527 528
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index fc0415771c00..e2e31b65bc5a 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -185,7 +185,7 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
185 * after the reserved blocks from the dt are processed. 185 * after the reserved blocks from the dt are processed.
186 */ 186 */
187 nblocks = (np) ? of_get_available_child_count(np) + 1 : 1; 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 if (!rblocks) 189 if (!rblocks)
190 return -ENOMEM; 190 return -ENOMEM;
191 191
diff --git a/drivers/mtd/ar7part.c b/drivers/mtd/ar7part.c
index 90575deff0ae..fc15ec58230a 100644
--- a/drivers/mtd/ar7part.c
+++ b/drivers/mtd/ar7part.c
@@ -55,7 +55,7 @@ static int create_mtd_partitions(struct mtd_info *master,
55 int retries = 10; 55 int retries = 10;
56 struct mtd_partition *ar7_parts; 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 if (!ar7_parts) 59 if (!ar7_parts)
60 return -ENOMEM; 60 return -ENOMEM;
61 ar7_parts[0].name = "loader"; 61 ar7_parts[0].name = "loader";
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index 0f93d2239352..fc424b185b08 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -110,7 +110,7 @@ static int bcm47xxpart_parse(struct mtd_info *master,
110 blocksize = 0x1000; 110 blocksize = 0x1000;
111 111
112 /* Alloc */ 112 /* Alloc */
113 parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS, 113 parts = kcalloc(BCM47XXPART_MAX_PARTS, sizeof(struct mtd_partition),
114 GFP_KERNEL); 114 GFP_KERNEL);
115 if (!parts) 115 if (!parts)
116 return -ENOMEM; 116 return -ENOMEM;
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 5a81bd8073bc..6e8e7b1bb34b 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -608,8 +608,9 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
608 mtd->size = devsize * cfi->numchips; 608 mtd->size = devsize * cfi->numchips;
609 609
610 mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips; 610 mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
611 mtd->eraseregions = kzalloc(sizeof(struct mtd_erase_region_info) 611 mtd->eraseregions = kcalloc(mtd->numeraseregions,
612 * mtd->numeraseregions, GFP_KERNEL); 612 sizeof(struct mtd_erase_region_info),
613 GFP_KERNEL);
613 if (!mtd->eraseregions) 614 if (!mtd->eraseregions)
614 goto setup_err; 615 goto setup_err;
615 616
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 22506d22194e..a0c655628d6d 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -2636,7 +2636,7 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
2636 * first check the locking status of all sectors and save 2636 * first check the locking status of all sectors and save
2637 * it for future use. 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 if (!sect) 2640 if (!sect)
2641 return -ENOMEM; 2641 return -ENOMEM;
2642 2642
diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index 802d8f159e90..a0d485f52cbe 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -1827,7 +1827,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev)
1827 mtd->dev.parent = dev; 1827 mtd->dev.parent = dev;
1828 bbt_nbpages = DIV_ROUND_UP(docg3->max_block + 1, 1828 bbt_nbpages = DIV_ROUND_UP(docg3->max_block + 1,
1829 8 * DOC_LAYOUT_PAGE_SIZE); 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 if (!docg3->bbt) 1831 if (!docg3->bbt)
1832 goto nomem3; 1832 goto nomem3;
1833 1833
diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c
index 527b1682381f..4129535b8e46 100644
--- a/drivers/mtd/maps/physmap_of_core.c
+++ b/drivers/mtd/maps/physmap_of_core.c
@@ -124,7 +124,7 @@ static const char * const *of_get_probes(struct device_node *dp)
124 if (count < 0) 124 if (count < 0)
125 return part_probe_types_def; 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 if (!res) 128 if (!res)
129 return NULL; 129 return NULL;
130 130
@@ -197,7 +197,7 @@ static int of_flash_probe(struct platform_device *dev)
197 197
198 dev_set_drvdata(&dev->dev, info); 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 if (!mtd_list) 201 if (!mtd_list)
202 goto err_flash_remove; 202 goto err_flash_remove;
203 203
diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c
index b7105192cb12..4ca4b194e7d7 100644
--- a/drivers/mtd/nand/onenand/onenand_base.c
+++ b/drivers/mtd/nand/onenand/onenand_base.c
@@ -3721,8 +3721,10 @@ static int onenand_probe(struct mtd_info *mtd)
3721 this->dies = ONENAND_IS_DDP(this) ? 2 : 1; 3721 this->dies = ONENAND_IS_DDP(this) ? 2 : 1;
3722 /* Maximum possible erase regions */ 3722 /* Maximum possible erase regions */
3723 mtd->numeraseregions = this->dies << 1; 3723 mtd->numeraseregions = this->dies << 1;
3724 mtd->eraseregions = kzalloc(sizeof(struct mtd_erase_region_info) 3724 mtd->eraseregions =
3725 * (this->dies << 1), GFP_KERNEL); 3725 kcalloc(this->dies << 1,
3726 sizeof(struct mtd_erase_region_info),
3727 GFP_KERNEL);
3726 if (!mtd->eraseregions) 3728 if (!mtd->eraseregions)
3727 return -ENOMEM; 3729 return -ENOMEM;
3728 } 3730 }
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 615f8c173162..6b21a92d3622 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -71,7 +71,7 @@ static int parse_fixed_partitions(struct mtd_info *master,
71 if (nr_parts == 0) 71 if (nr_parts == 0)
72 return 0; 72 return 0;
73 73
74 parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL); 74 parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
75 if (!parts) 75 if (!parts)
76 return -ENOMEM; 76 return -ENOMEM;
77 77
@@ -177,7 +177,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
177 177
178 nr_parts = plen / sizeof(part[0]); 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 if (!parts) 181 if (!parts)
182 return -ENOMEM; 182 return -ENOMEM;
183 183
diff --git a/drivers/mtd/parsers/parser_trx.c b/drivers/mtd/parsers/parser_trx.c
index df360a75e1eb..17ac33599783 100644
--- a/drivers/mtd/parsers/parser_trx.c
+++ b/drivers/mtd/parsers/parser_trx.c
@@ -62,7 +62,7 @@ static int parser_trx_parse(struct mtd_info *mtd,
62 uint8_t curr_part = 0, i = 0; 62 uint8_t curr_part = 0, i = 0;
63 int err; 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 GFP_KERNEL); 66 GFP_KERNEL);
67 if (!parts) 67 if (!parts)
68 return -ENOMEM; 68 return -ENOMEM;
diff --git a/drivers/mtd/parsers/sharpslpart.c b/drivers/mtd/parsers/sharpslpart.c
index 8893dc82a5c8..e5ea6127ab5a 100644
--- a/drivers/mtd/parsers/sharpslpart.c
+++ b/drivers/mtd/parsers/sharpslpart.c
@@ -362,8 +362,9 @@ static int sharpsl_parse_mtd_partitions(struct mtd_info *master,
362 return err; 362 return err;
363 } 363 }
364 364
365 sharpsl_nand_parts = kzalloc(sizeof(*sharpsl_nand_parts) * 365 sharpsl_nand_parts = kcalloc(SHARPSL_NAND_PARTS,
366 SHARPSL_NAND_PARTS, GFP_KERNEL); 366 sizeof(*sharpsl_nand_parts),
367 GFP_KERNEL);
367 if (!sharpsl_nand_parts) 368 if (!sharpsl_nand_parts)
368 return -ENOMEM; 369 return -ENOMEM;
369 370
diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index 9d019ce1589e..f3bd86e13603 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -82,7 +82,7 @@ static struct attribute_group *sm_create_sysfs_attributes(struct sm_ftl *ftl)
82 82
83 83
84 /* Create array of pointers to the attributes */ 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 GFP_KERNEL); 86 GFP_KERNEL);
87 if (!attributes) 87 if (!attributes)
88 goto error3; 88 goto error3;
@@ -1137,7 +1137,7 @@ static void sm_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
1137 goto error2; 1137 goto error2;
1138 1138
1139 /* Allocate zone array, it will be initialized on demand */ 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 GFP_KERNEL); 1141 GFP_KERNEL);
1142 if (!ftl->zones) 1142 if (!ftl->zones)
1143 goto error3; 1143 goto error3;
diff --git a/drivers/mtd/tests/pagetest.c b/drivers/mtd/tests/pagetest.c
index bc303cac9f43..75687369bc20 100644
--- a/drivers/mtd/tests/pagetest.c
+++ b/drivers/mtd/tests/pagetest.c
@@ -127,7 +127,7 @@ static int crosstest(void)
127 unsigned char *pp1, *pp2, *pp3, *pp4; 127 unsigned char *pp1, *pp2, *pp3, *pp4;
128 128
129 pr_info("crosstest\n"); 129 pr_info("crosstest\n");
130 pp1 = kzalloc(pgsize * 4, GFP_KERNEL); 130 pp1 = kcalloc(pgsize, 4, GFP_KERNEL);
131 if (!pp1) 131 if (!pp1)
132 return -ENOMEM; 132 return -ENOMEM;
133 pp2 = pp1 + pgsize; 133 pp2 = pp1 + pgsize;
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index f66b3b22f328..6f2ac865ff05 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1592,7 +1592,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
1592 sprintf(ubi->bgt_name, UBI_BGT_NAME_PATTERN, ubi->ubi_num); 1592 sprintf(ubi->bgt_name, UBI_BGT_NAME_PATTERN, ubi->ubi_num);
1593 1593
1594 err = -ENOMEM; 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 if (!ubi->lookuptbl) 1596 if (!ubi->lookuptbl)
1597 return err; 1597 return err;
1598 1598
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index bd53a71f6b00..63e3844c5bec 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2418,7 +2418,7 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,
2418 struct list_head *iter; 2418 struct list_head *iter;
2419 2419
2420 if (start_dev == end_dev) { 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 if (!tags) 2422 if (!tags)
2423 return ERR_PTR(-ENOMEM); 2423 return ERR_PTR(-ENOMEM);
2424 tags[level].vlan_proto = VLAN_N_VID; 2424 tags[level].vlan_proto = VLAN_N_VID;
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index 2d3046afa80d..7eec1d9f86a0 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -1057,7 +1057,7 @@ static int grcan_open(struct net_device *dev)
1057 return err; 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 GFP_KERNEL); 1061 GFP_KERNEL);
1062 if (!priv->echo_skb) { 1062 if (!priv->echo_skb) {
1063 err = -ENOMEM; 1063 err = -ENOMEM;
@@ -1066,7 +1066,7 @@ static int grcan_open(struct net_device *dev)
1066 priv->can.echo_skb_max = dma->tx.size; 1066 priv->can.echo_skb_max = dma->tx.size;
1067 priv->can.echo_skb = priv->echo_skb; 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 if (!priv->txdlc) { 1070 if (!priv->txdlc) {
1071 err = -ENOMEM; 1071 err = -ENOMEM;
1072 goto exit_free_echo_skb; 1072 goto exit_free_echo_skb;
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index 89d60d8e467c..aa97dbc797b6 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -703,7 +703,7 @@ static int __init slcan_init(void)
703 pr_info("slcan: serial line CAN interface driver\n"); 703 pr_info("slcan: serial line CAN interface driver\n");
704 pr_info("slcan: %d dynamic interface channels.\n", maxdev); 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 if (!slcan_devs) 707 if (!slcan_devs)
708 return -ENOMEM; 708 return -ENOMEM;
709 709
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
index 14a59e51db67..897302adc38e 100644
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2150,7 +2150,7 @@ static int bcm_enetsw_open(struct net_device *dev)
2150 priv->tx_desc_alloc_size = size; 2150 priv->tx_desc_alloc_size = size;
2151 priv->tx_desc_cpu = p; 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 GFP_KERNEL); 2154 GFP_KERNEL);
2155 if (!priv->tx_skb) { 2155 if (!priv->tx_skb) {
2156 dev_err(kdev, "cannot allocate rx skb queue\n"); 2156 dev_err(kdev, "cannot allocate rx skb queue\n");
@@ -2164,7 +2164,7 @@ static int bcm_enetsw_open(struct net_device *dev)
2164 spin_lock_init(&priv->tx_lock); 2164 spin_lock_init(&priv->tx_lock);
2165 2165
2166 /* init & fill rx ring with skbs */ 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 GFP_KERNEL); 2168 GFP_KERNEL);
2169 if (!priv->rx_skb) { 2169 if (!priv->rx_skb) {
2170 dev_err(kdev, "cannot allocate rx skb queue\n"); 2170 dev_err(kdev, "cannot allocate rx skb queue\n");
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index ffa7959f6b31..dc77bfded865 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -571,7 +571,7 @@ int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf,
571 else 571 else
572 set_bit(RAMROD_COMP_WAIT, &mcast.ramrod_flags); 572 set_bit(RAMROD_COMP_WAIT, &mcast.ramrod_flags);
573 if (mc_num) { 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 GFP_KERNEL); 575 GFP_KERNEL);
576 if (!mc) { 576 if (!mc) {
577 BNX2X_ERR("Cannot Configure multicasts due to lack of memory\n"); 577 BNX2X_ERR("Cannot Configure multicasts due to lack of memory\n");
@@ -1253,8 +1253,9 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
1253 num_vfs_param, iov->nr_virtfn); 1253 num_vfs_param, iov->nr_virtfn);
1254 1254
1255 /* allocate the vf array */ 1255 /* allocate the vf array */
1256 bp->vfdb->vfs = kzalloc(sizeof(struct bnx2x_virtf) * 1256 bp->vfdb->vfs = kcalloc(BNX2X_NR_VIRTFN(bp),
1257 BNX2X_NR_VIRTFN(bp), GFP_KERNEL); 1257 sizeof(struct bnx2x_virtf),
1258 GFP_KERNEL);
1258 if (!bp->vfdb->vfs) { 1259 if (!bp->vfdb->vfs) {
1259 BNX2X_ERR("failed to allocate vf array\n"); 1260 BNX2X_ERR("failed to allocate vf array\n");
1260 err = -ENOMEM; 1261 err = -ENOMEM;
@@ -1278,9 +1279,9 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
1278 } 1279 }
1279 1280
1280 /* allocate the queue arrays for all VFs */ 1281 /* allocate the queue arrays for all VFs */
1281 bp->vfdb->vfqs = kzalloc( 1282 bp->vfdb->vfqs = kcalloc(BNX2X_MAX_NUM_VF_QUEUES,
1282 BNX2X_MAX_NUM_VF_QUEUES * sizeof(struct bnx2x_vf_queue), 1283 sizeof(struct bnx2x_vf_queue),
1283 GFP_KERNEL); 1284 GFP_KERNEL);
1284 1285
1285 if (!bp->vfdb->vfqs) { 1286 if (!bp->vfdb->vfqs) {
1286 BNX2X_ERR("failed to allocate vf queue array\n"); 1287 BNX2X_ERR("failed to allocate vf queue array\n");
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 8bc126a156e8..30273a7717e2 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -660,7 +660,7 @@ static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id,
660 id_tbl->max = size; 660 id_tbl->max = size;
661 id_tbl->next = next; 661 id_tbl->next = next;
662 spin_lock_init(&id_tbl->lock); 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 if (!id_tbl->table) 664 if (!id_tbl->table)
665 return -ENOMEM; 665 return -ENOMEM;
666 666
@@ -1255,13 +1255,13 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
1255 cp->fcoe_init_cid = 0x10; 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 GFP_KERNEL); 1259 GFP_KERNEL);
1260 if (!cp->iscsi_tbl) 1260 if (!cp->iscsi_tbl)
1261 goto error; 1261 goto error;
1262 1262
1263 cp->ctx_tbl = kzalloc(sizeof(struct cnic_context) * 1263 cp->ctx_tbl = kcalloc(cp->max_cid_space, sizeof(struct cnic_context),
1264 cp->max_cid_space, GFP_KERNEL); 1264 GFP_KERNEL);
1265 if (!cp->ctx_tbl) 1265 if (!cp->ctx_tbl)
1266 goto error; 1266 goto error;
1267 1267
@@ -4100,7 +4100,7 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
4100 struct cnic_local *cp = dev->cnic_priv; 4100 struct cnic_local *cp = dev->cnic_priv;
4101 u32 port_id; 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 GFP_KERNEL); 4104 GFP_KERNEL);
4105 if (!cp->csk_tbl) 4105 if (!cp->csk_tbl)
4106 return -ENOMEM; 4106 return -ENOMEM;
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 9f59b1270a7c..3be87efdc93d 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -8631,8 +8631,9 @@ static int tg3_mem_tx_acquire(struct tg3 *tp)
8631 tnapi++; 8631 tnapi++;
8632 8632
8633 for (i = 0; i < tp->txq_cnt; i++, tnapi++) { 8633 for (i = 0; i < tp->txq_cnt; i++, tnapi++) {
8634 tnapi->tx_buffers = kzalloc(sizeof(struct tg3_tx_ring_info) * 8634 tnapi->tx_buffers = kcalloc(TG3_TX_RING_SIZE,
8635 TG3_TX_RING_SIZE, GFP_KERNEL); 8635 sizeof(struct tg3_tx_ring_info),
8636 GFP_KERNEL);
8636 if (!tnapi->tx_buffers) 8637 if (!tnapi->tx_buffers)
8637 goto err_out; 8638 goto err_out;
8638 8639
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 69cc3e0119d6..ea5f32ea308a 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -3141,7 +3141,7 @@ bnad_set_rx_ucast_fltr(struct bnad *bnad)
3141 if (uc_count > bna_attr(&bnad->bna)->num_ucmac) 3141 if (uc_count > bna_attr(&bnad->bna)->num_ucmac)
3142 goto mode_default; 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 if (mac_list == NULL) 3145 if (mac_list == NULL)
3146 goto mode_default; 3146 goto mode_default;
3147 3147
@@ -3182,7 +3182,7 @@ bnad_set_rx_mcast_fltr(struct bnad *bnad)
3182 if (mc_count > bna_attr(&bnad->bna)->num_mcmac) 3182 if (mc_count > bna_attr(&bnad->bna)->num_mcmac)
3183 goto mode_allmulti; 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 if (mac_list == NULL) 3187 if (mac_list == NULL)
3188 goto mode_allmulti; 3188 goto mode_allmulti;
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 2bd7c638b178..2c63afff1382 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -739,7 +739,7 @@ static int xgmac_dma_desc_rings_init(struct net_device *dev)
739 739
740 netdev_dbg(priv->dev, "mtu [%d] bfsize [%d]\n", dev->mtu, bfsize); 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 GFP_KERNEL); 743 GFP_KERNEL);
744 if (!priv->rx_skbuff) 744 if (!priv->rx_skbuff)
745 return -ENOMEM; 745 return -ENOMEM;
@@ -752,7 +752,7 @@ static int xgmac_dma_desc_rings_init(struct net_device *dev)
752 if (!priv->dma_rx) 752 if (!priv->dma_rx)
753 goto err_dma_rx; 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 GFP_KERNEL); 756 GFP_KERNEL);
757 if (!priv->tx_skbuff) 757 if (!priv->tx_skbuff)
758 goto err_tx_skb; 758 goto err_tx_skb;
diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
index d42704d07484..187a249ff2d1 100644
--- a/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
+++ b/drivers/net/ethernet/cavium/thunder/nicvf_queues.c
@@ -292,8 +292,8 @@ static int nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr,
292 rbdr->is_xdp = true; 292 rbdr->is_xdp = true;
293 } 293 }
294 rbdr->pgcnt = roundup_pow_of_two(rbdr->pgcnt); 294 rbdr->pgcnt = roundup_pow_of_two(rbdr->pgcnt);
295 rbdr->pgcache = kzalloc(sizeof(*rbdr->pgcache) * 295 rbdr->pgcache = kcalloc(rbdr->pgcnt, sizeof(*rbdr->pgcache),
296 rbdr->pgcnt, GFP_KERNEL); 296 GFP_KERNEL);
297 if (!rbdr->pgcache) 297 if (!rbdr->pgcache)
298 return -ENOMEM; 298 return -ENOMEM;
299 rbdr->pgidx = 0; 299 rbdr->pgidx = 0;
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
index a95cde0fadf7..4bc211093c98 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
@@ -561,13 +561,13 @@ int t4_uld_mem_alloc(struct adapter *adap)
561 if (!adap->uld) 561 if (!adap->uld)
562 return -ENOMEM; 562 return -ENOMEM;
563 563
564 s->uld_rxq_info = kzalloc(CXGB4_ULD_MAX * 564 s->uld_rxq_info = kcalloc(CXGB4_ULD_MAX,
565 sizeof(struct sge_uld_rxq_info *), 565 sizeof(struct sge_uld_rxq_info *),
566 GFP_KERNEL); 566 GFP_KERNEL);
567 if (!s->uld_rxq_info) 567 if (!s->uld_rxq_info)
568 goto err_uld; 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 sizeof(struct sge_uld_txq_info *), 571 sizeof(struct sge_uld_txq_info *),
572 GFP_KERNEL); 572 GFP_KERNEL);
573 if (!s->uld_txq_info) 573 if (!s->uld_txq_info)
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index ff9eb45f67f8..6d7404f66f84 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -910,8 +910,8 @@ static int geth_setup_freeq(struct gemini_ethernet *geth)
910 } 910 }
911 911
912 /* Allocate a mapping to page look-up index */ 912 /* Allocate a mapping to page look-up index */
913 geth->freeq_pages = kzalloc(pages * sizeof(*geth->freeq_pages), 913 geth->freeq_pages = kcalloc(pages, sizeof(*geth->freeq_pages),
914 GFP_KERNEL); 914 GFP_KERNEL);
915 if (!geth->freeq_pages) 915 if (!geth->freeq_pages)
916 goto err_freeq; 916 goto err_freeq;
917 geth->num_freeq_pages = pages; 917 geth->num_freeq_pages = pages;
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 1ccb6443d2ed..ef9ef703d13a 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -2197,7 +2197,8 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
2197 return -EINVAL; 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 GFP_KERNEL); 2202 GFP_KERNEL);
2202 if (!priv->ring_data) 2203 if (!priv->ring_data)
2203 return -ENOMEM; 2204 return -ENOMEM;
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index acf1e8b52b8e..3ba0c90e7055 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -3312,7 +3312,7 @@ static int e1000e_write_mc_addr_list(struct net_device *netdev)
3312 return 0; 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 if (!mta_list) 3316 if (!mta_list)
3317 return -ENOMEM; 3317 return -ENOMEM;
3318 3318
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index c33821d2afb3..f707709969ac 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -3763,8 +3763,9 @@ static int igb_sw_init(struct igb_adapter *adapter)
3763 /* Assume MSI-X interrupts, will be checked during IRQ allocation */ 3763 /* Assume MSI-X interrupts, will be checked during IRQ allocation */
3764 adapter->flags |= IGB_FLAG_HAS_MSIX; 3764 adapter->flags |= IGB_FLAG_HAS_MSIX;
3765 3765
3766 adapter->mac_table = kzalloc(sizeof(struct igb_mac_addr) * 3766 adapter->mac_table = kcalloc(hw->mac.rar_entry_count,
3767 hw->mac.rar_entry_count, GFP_ATOMIC); 3767 sizeof(struct igb_mac_addr),
3768 GFP_ATOMIC);
3768 if (!adapter->mac_table) 3769 if (!adapter->mac_table)
3769 return -ENOMEM; 3770 return -ENOMEM;
3770 3771
@@ -4752,7 +4753,7 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
4752 return 0; 4753 return 0;
4753 } 4754 }
4754 4755
4755 mta_list = kzalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC); 4756 mta_list = kcalloc(netdev_mc_count(netdev), 6, GFP_ATOMIC);
4756 if (!mta_list) 4757 if (!mta_list)
4757 return -ENOMEM; 4758 return -ENOMEM;
4758 4759
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 4929f7265598..0b1ba3ae159c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6034,8 +6034,8 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,
6034 for (i = 1; i < IXGBE_MAX_LINK_HANDLE; i++) 6034 for (i = 1; i < IXGBE_MAX_LINK_HANDLE; i++)
6035 adapter->jump_tables[i] = NULL; 6035 adapter->jump_tables[i] = NULL;
6036 6036
6037 adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) * 6037 adapter->mac_table = kcalloc(hw->mac.num_rar_entries,
6038 hw->mac.num_rar_entries, 6038 sizeof(struct ixgbe_mac_addr),
6039 GFP_ATOMIC); 6039 GFP_ATOMIC);
6040 if (!adapter->mac_table) 6040 if (!adapter->mac_table)
6041 return -ENOMEM; 6041 return -ENOMEM;
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 8a165842fa85..06ff185eb188 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -589,8 +589,9 @@ jme_setup_tx_resources(struct jme_adapter *jme)
589 atomic_set(&txring->next_to_clean, 0); 589 atomic_set(&txring->next_to_clean, 0);
590 atomic_set(&txring->nr_free, jme->tx_ring_size); 590 atomic_set(&txring->nr_free, jme->tx_ring_size);
591 591
592 txring->bufinf = kzalloc(sizeof(struct jme_buffer_info) * 592 txring->bufinf = kcalloc(jme->tx_ring_size,
593 jme->tx_ring_size, GFP_ATOMIC); 593 sizeof(struct jme_buffer_info),
594 GFP_ATOMIC);
594 if (unlikely(!(txring->bufinf))) 595 if (unlikely(!(txring->bufinf)))
595 goto err_free_txring; 596 goto err_free_txring;
596 597
@@ -838,8 +839,9 @@ jme_setup_rx_resources(struct jme_adapter *jme)
838 rxring->next_to_use = 0; 839 rxring->next_to_use = 0;
839 atomic_set(&rxring->next_to_clean, 0); 840 atomic_set(&rxring->next_to_clean, 0);
840 841
841 rxring->bufinf = kzalloc(sizeof(struct jme_buffer_info) * 842 rxring->bufinf = kcalloc(jme->rx_ring_size,
842 jme->rx_ring_size, GFP_ATOMIC); 843 sizeof(struct jme_buffer_info),
844 GFP_ATOMIC);
843 if (unlikely(!(rxring->bufinf))) 845 if (unlikely(!(rxring->bufinf)))
844 goto err_free_rxring; 846 goto err_free_rxring;
845 847
diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c
index 6dabd983e7e0..4bdf25059542 100644
--- a/drivers/net/ethernet/mellanox/mlx4/alloc.c
+++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c
@@ -185,8 +185,8 @@ int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask,
185 bitmap->avail = num - reserved_top - reserved_bot; 185 bitmap->avail = num - reserved_top - reserved_bot;
186 bitmap->effective_len = bitmap->avail; 186 bitmap->effective_len = bitmap->avail;
187 spin_lock_init(&bitmap->lock); 187 spin_lock_init(&bitmap->lock);
188 bitmap->table = kzalloc(BITS_TO_LONGS(bitmap->max) * 188 bitmap->table = kcalloc(BITS_TO_LONGS(bitmap->max), sizeof(long),
189 sizeof(long), GFP_KERNEL); 189 GFP_KERNEL);
190 if (!bitmap->table) 190 if (!bitmap->table)
191 return -ENOMEM; 191 return -ENOMEM;
192 192
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index 03375c705df7..e65bc3c95630 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2377,20 +2377,23 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
2377 struct mlx4_vf_admin_state *vf_admin; 2377 struct mlx4_vf_admin_state *vf_admin;
2378 2378
2379 priv->mfunc.master.slave_state = 2379 priv->mfunc.master.slave_state =
2380 kzalloc(dev->num_slaves * 2380 kcalloc(dev->num_slaves,
2381 sizeof(struct mlx4_slave_state), GFP_KERNEL); 2381 sizeof(struct mlx4_slave_state),
2382 GFP_KERNEL);
2382 if (!priv->mfunc.master.slave_state) 2383 if (!priv->mfunc.master.slave_state)
2383 goto err_comm; 2384 goto err_comm;
2384 2385
2385 priv->mfunc.master.vf_admin = 2386 priv->mfunc.master.vf_admin =
2386 kzalloc(dev->num_slaves * 2387 kcalloc(dev->num_slaves,
2387 sizeof(struct mlx4_vf_admin_state), GFP_KERNEL); 2388 sizeof(struct mlx4_vf_admin_state),
2389 GFP_KERNEL);
2388 if (!priv->mfunc.master.vf_admin) 2390 if (!priv->mfunc.master.vf_admin)
2389 goto err_comm_admin; 2391 goto err_comm_admin;
2390 2392
2391 priv->mfunc.master.vf_oper = 2393 priv->mfunc.master.vf_oper =
2392 kzalloc(dev->num_slaves * 2394 kcalloc(dev->num_slaves,
2393 sizeof(struct mlx4_vf_oper_state), GFP_KERNEL); 2395 sizeof(struct mlx4_vf_oper_state),
2396 GFP_KERNEL);
2394 if (!priv->mfunc.master.vf_oper) 2397 if (!priv->mfunc.master.vf_oper)
2395 goto err_comm_oper; 2398 goto err_comm_oper;
2396 2399
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 9670b33fc9b1..65eb06e017e4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -2229,13 +2229,15 @@ static int mlx4_en_copy_priv(struct mlx4_en_priv *dst,
2229 if (!dst->tx_ring_num[t]) 2229 if (!dst->tx_ring_num[t])
2230 continue; 2230 continue;
2231 2231
2232 dst->tx_ring[t] = kzalloc(sizeof(struct mlx4_en_tx_ring *) * 2232 dst->tx_ring[t] = kcalloc(MAX_TX_RINGS,
2233 MAX_TX_RINGS, GFP_KERNEL); 2233 sizeof(struct mlx4_en_tx_ring *),
2234 GFP_KERNEL);
2234 if (!dst->tx_ring[t]) 2235 if (!dst->tx_ring[t])
2235 goto err_free_tx; 2236 goto err_free_tx;
2236 2237
2237 dst->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) * 2238 dst->tx_cq[t] = kcalloc(MAX_TX_RINGS,
2238 MAX_TX_RINGS, GFP_KERNEL); 2239 sizeof(struct mlx4_en_cq *),
2240 GFP_KERNEL);
2239 if (!dst->tx_cq[t]) { 2241 if (!dst->tx_cq[t]) {
2240 kfree(dst->tx_ring[t]); 2242 kfree(dst->tx_ring[t]);
2241 goto err_free_tx; 2243 goto err_free_tx;
@@ -3320,14 +3322,16 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
3320 if (!priv->tx_ring_num[t]) 3322 if (!priv->tx_ring_num[t])
3321 continue; 3323 continue;
3322 3324
3323 priv->tx_ring[t] = kzalloc(sizeof(struct mlx4_en_tx_ring *) * 3325 priv->tx_ring[t] = kcalloc(MAX_TX_RINGS,
3324 MAX_TX_RINGS, GFP_KERNEL); 3326 sizeof(struct mlx4_en_tx_ring *),
3327 GFP_KERNEL);
3325 if (!priv->tx_ring[t]) { 3328 if (!priv->tx_ring[t]) {
3326 err = -ENOMEM; 3329 err = -ENOMEM;
3327 goto out; 3330 goto out;
3328 } 3331 }
3329 priv->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) * 3332 priv->tx_cq[t] = kcalloc(MAX_TX_RINGS,
3330 MAX_TX_RINGS, GFP_KERNEL); 3333 sizeof(struct mlx4_en_cq *),
3334 GFP_KERNEL);
3331 if (!priv->tx_cq[t]) { 3335 if (!priv->tx_cq[t]) {
3332 err = -ENOMEM; 3336 err = -ENOMEM;
3333 goto out; 3337 goto out;
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 0a30d81aab3b..872014702fc1 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2982,7 +2982,8 @@ static int mlx4_init_steering(struct mlx4_dev *dev)
2982 int num_entries = dev->caps.num_ports; 2982 int num_entries = dev->caps.num_ports;
2983 int i, j; 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 if (!priv->steer) 2987 if (!priv->steer)
2987 return -ENOMEM; 2988 return -ENOMEM;
2988 2989
@@ -3103,7 +3104,7 @@ static u64 mlx4_enable_sriov(struct mlx4_dev *dev, struct pci_dev *pdev,
3103 } 3104 }
3104 } 3105 }
3105 3106
3106 dev->dev_vfs = kzalloc(total_vfs * sizeof(*dev->dev_vfs), GFP_KERNEL); 3107 dev->dev_vfs = kcalloc(total_vfs, sizeof(*dev->dev_vfs), GFP_KERNEL);
3107 if (NULL == dev->dev_vfs) { 3108 if (NULL == dev->dev_vfs) {
3108 mlx4_err(dev, "Failed to allocate memory for VFs\n"); 3109 mlx4_err(dev, "Failed to allocate memory for VFs\n");
3109 goto disable_sriov; 3110 goto disable_sriov;
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index b0e11255a355..7b1b5ac986d0 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -487,7 +487,7 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev)
487 int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev); 487 int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev);
488 488
489 priv->mfunc.master.res_tracker.slave_list = 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 GFP_KERNEL); 491 GFP_KERNEL);
492 if (!priv->mfunc.master.res_tracker.slave_list) 492 if (!priv->mfunc.master.res_tracker.slave_list)
493 return -ENOMEM; 493 return -ENOMEM;
@@ -514,14 +514,14 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev)
514 sizeof(int), 514 sizeof(int),
515 GFP_KERNEL); 515 GFP_KERNEL);
516 if (i == RES_MAC || i == RES_VLAN) 516 if (i == RES_MAC || i == RES_VLAN)
517 res_alloc->allocated = kzalloc(MLX4_MAX_PORTS * 517 res_alloc->allocated =
518 (dev->persist->num_vfs 518 kcalloc(MLX4_MAX_PORTS *
519 + 1) * 519 (dev->persist->num_vfs + 1),
520 sizeof(int), GFP_KERNEL); 520 sizeof(int), GFP_KERNEL);
521 else 521 else
522 res_alloc->allocated = kzalloc((dev->persist-> 522 res_alloc->allocated =
523 num_vfs + 1) * 523 kcalloc(dev->persist->num_vfs + 1,
524 sizeof(int), GFP_KERNEL); 524 sizeof(int), GFP_KERNEL);
525 /* Reduce the sink counter */ 525 /* Reduce the sink counter */
526 if (i == RES_COUNTER) 526 if (i == RES_COUNTER)
527 res_alloc->res_free = dev->caps.max_counters - 1; 527 res_alloc->res_free = dev->caps.max_counters - 1;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
index a0433b48e833..5645a4facad2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
@@ -381,7 +381,7 @@ int mlx5_fpga_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters,
381 381
382 count = mlx5_fpga_ipsec_counters_count(mdev); 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 if (!data) { 385 if (!data) {
386 ret = -ENOMEM; 386 ret = -ENOMEM;
387 goto out; 387 goto out;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
index 857035583ccd..1e062e6b2587 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
@@ -394,8 +394,9 @@ static int mlx5_init_pin_config(struct mlx5_clock *clock)
394 int i; 394 int i;
395 395
396 clock->ptp_info.pin_config = 396 clock->ptp_info.pin_config =
397 kzalloc(sizeof(*clock->ptp_info.pin_config) * 397 kcalloc(clock->ptp_info.n_pins,
398 clock->ptp_info.n_pins, GFP_KERNEL); 398 sizeof(*clock->ptp_info.pin_config),
399 GFP_KERNEL);
399 if (!clock->ptp_info.pin_config) 400 if (!clock->ptp_info.pin_config)
400 return -ENOMEM; 401 return -ENOMEM;
401 clock->ptp_info.enable = mlx5_ptp_enable; 402 clock->ptp_info.enable = mlx5_ptp_enable;
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
index 91262b0573e3..cad603c35271 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
@@ -740,7 +740,8 @@ int mlxsw_sp_tc_qdisc_init(struct mlxsw_sp_port *mlxsw_sp_port)
740 mlxsw_sp_port->root_qdisc->prio_bitmap = 0xff; 740 mlxsw_sp_port->root_qdisc->prio_bitmap = 0xff;
741 mlxsw_sp_port->root_qdisc->tclass_num = MLXSW_SP_PORT_DEFAULT_TCLASS; 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 GFP_KERNEL); 745 GFP_KERNEL);
745 if (!mlxsw_sp_qdisc) 746 if (!mlxsw_sp_qdisc)
746 goto err_tclass_qdiscs_init; 747 goto err_tclass_qdiscs_init;
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index 52207508744c..b72d1bd11296 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -4372,7 +4372,7 @@ static void ksz_update_timer(struct ksz_timer_info *info)
4372 */ 4372 */
4373static int ksz_alloc_soft_desc(struct ksz_desc_info *desc_info, int transmit) 4373static 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 GFP_KERNEL); 4376 GFP_KERNEL);
4377 if (!desc_info->ring) 4377 if (!desc_info->ring)
4378 return 1; 4378 return 1;
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.c b/drivers/net/ethernet/neterion/vxge/vxge-config.c
index c60da9e8bf14..8d0295655933 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-config.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-config.c
@@ -2220,22 +2220,22 @@ __vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph,
2220 channel->length = length; 2220 channel->length = length;
2221 channel->vp_id = vp_id; 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 if (channel->work_arr == NULL) 2224 if (channel->work_arr == NULL)
2225 goto exit1; 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 if (channel->free_arr == NULL) 2228 if (channel->free_arr == NULL)
2229 goto exit1; 2229 goto exit1;
2230 channel->free_ptr = length; 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 if (channel->reserve_arr == NULL) 2233 if (channel->reserve_arr == NULL)
2234 goto exit1; 2234 goto exit1;
2235 channel->reserve_ptr = length; 2235 channel->reserve_ptr = length;
2236 channel->reserve_top = 0; 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 if (channel->orig_arr == NULL) 2239 if (channel->orig_arr == NULL)
2240 goto exit1; 2240 goto exit1;
2241 2241
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index a8918bb7c802..5ae3fa82909f 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -3429,8 +3429,8 @@ static int vxge_device_register(struct __vxge_hw_device *hldev,
3429 vxge_initialize_ethtool_ops(ndev); 3429 vxge_initialize_ethtool_ops(ndev);
3430 3430
3431 /* Allocate memory for vpath */ 3431 /* Allocate memory for vpath */
3432 vdev->vpaths = kzalloc((sizeof(struct vxge_vpath)) * 3432 vdev->vpaths = kcalloc(no_of_vpath, sizeof(struct vxge_vpath),
3433 no_of_vpath, GFP_KERNEL); 3433 GFP_KERNEL);
3434 if (!vdev->vpaths) { 3434 if (!vdev->vpaths) {
3435 vxge_debug_init(VXGE_ERR, 3435 vxge_debug_init(VXGE_ERR,
3436 "%s: vpath memory allocation failed", 3436 "%s: vpath memory allocation failed",
diff --git a/drivers/net/ethernet/pasemi/pasemi_mac.c b/drivers/net/ethernet/pasemi/pasemi_mac.c
index 07a2eb3781b1..8a31a02c9f47 100644
--- a/drivers/net/ethernet/pasemi/pasemi_mac.c
+++ b/drivers/net/ethernet/pasemi/pasemi_mac.c
@@ -390,8 +390,9 @@ static int pasemi_mac_setup_rx_resources(const struct net_device *dev)
390 spin_lock_init(&ring->lock); 390 spin_lock_init(&ring->lock);
391 391
392 ring->size = RX_RING_SIZE; 392 ring->size = RX_RING_SIZE;
393 ring->ring_info = kzalloc(sizeof(struct pasemi_mac_buffer) * 393 ring->ring_info = kcalloc(RX_RING_SIZE,
394 RX_RING_SIZE, GFP_KERNEL); 394 sizeof(struct pasemi_mac_buffer),
395 GFP_KERNEL);
395 396
396 if (!ring->ring_info) 397 if (!ring->ring_info)
397 goto out_ring_info; 398 goto out_ring_info;
@@ -473,8 +474,9 @@ pasemi_mac_setup_tx_resources(const struct net_device *dev)
473 spin_lock_init(&ring->lock); 474 spin_lock_init(&ring->lock);
474 475
475 ring->size = TX_RING_SIZE; 476 ring->size = TX_RING_SIZE;
476 ring->ring_info = kzalloc(sizeof(struct pasemi_mac_buffer) * 477 ring->ring_info = kcalloc(TX_RING_SIZE,
477 TX_RING_SIZE, GFP_KERNEL); 478 sizeof(struct pasemi_mac_buffer),
479 GFP_KERNEL);
478 if (!ring->ring_info) 480 if (!ring->ring_info)
479 goto out_ring_info; 481 goto out_ring_info;
480 482
diff --git a/drivers/net/ethernet/qlogic/qed/qed_debug.c b/drivers/net/ethernet/qlogic/qed/qed_debug.c
index b9ec460dd996..a14e48489029 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_debug.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_debug.c
@@ -6617,7 +6617,8 @@ static enum dbg_status qed_mcp_trace_alloc_meta(struct qed_hwfn *p_hwfn,
6617 6617
6618 /* Read no. of modules and allocate memory for their pointers */ 6618 /* Read no. of modules and allocate memory for their pointers */
6619 meta->modules_num = qed_read_byte_from_buf(meta_buf_bytes, &offset); 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 if (!meta->modules) 6622 if (!meta->modules)
6622 return DBG_STATUS_VIRT_MEM_ALLOC_FAILED; 6623 return DBG_STATUS_VIRT_MEM_ALLOC_FAILED;
6623 6624
@@ -6645,7 +6646,7 @@ static enum dbg_status qed_mcp_trace_alloc_meta(struct qed_hwfn *p_hwfn,
6645 6646
6646 /* Read number of formats and allocate memory for all formats */ 6647 /* Read number of formats and allocate memory for all formats */
6647 meta->formats_num = qed_read_dword_from_buf(meta_buf_bytes, &offset); 6648 meta->formats_num = qed_read_dword_from_buf(meta_buf_bytes, &offset);
6648 meta->formats = kzalloc(meta->formats_num * 6649 meta->formats = kcalloc(meta->formats_num,
6649 sizeof(struct mcp_trace_format), 6650 sizeof(struct mcp_trace_format),
6650 GFP_KERNEL); 6651 GFP_KERNEL);
6651 if (!meta->formats) 6652 if (!meta->formats)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index b285edc8d6a1..329781cda77f 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -814,26 +814,26 @@ static int qed_alloc_qm_data(struct qed_hwfn *p_hwfn)
814 if (rc) 814 if (rc)
815 goto alloc_err; 815 goto alloc_err;
816 816
817 qm_info->qm_pq_params = kzalloc(sizeof(*qm_info->qm_pq_params) * 817 qm_info->qm_pq_params = kcalloc(qed_init_qm_get_num_pqs(p_hwfn),
818 qed_init_qm_get_num_pqs(p_hwfn), 818 sizeof(*qm_info->qm_pq_params),
819 GFP_KERNEL); 819 GFP_KERNEL);
820 if (!qm_info->qm_pq_params) 820 if (!qm_info->qm_pq_params)
821 goto alloc_err; 821 goto alloc_err;
822 822
823 qm_info->qm_vport_params = kzalloc(sizeof(*qm_info->qm_vport_params) * 823 qm_info->qm_vport_params = kcalloc(qed_init_qm_get_num_vports(p_hwfn),
824 qed_init_qm_get_num_vports(p_hwfn), 824 sizeof(*qm_info->qm_vport_params),
825 GFP_KERNEL); 825 GFP_KERNEL);
826 if (!qm_info->qm_vport_params) 826 if (!qm_info->qm_vport_params)
827 goto alloc_err; 827 goto alloc_err;
828 828
829 qm_info->qm_port_params = kzalloc(sizeof(*qm_info->qm_port_params) * 829 qm_info->qm_port_params = kcalloc(p_hwfn->cdev->num_ports_in_engine,
830 p_hwfn->cdev->num_ports_in_engine, 830 sizeof(*qm_info->qm_port_params),
831 GFP_KERNEL); 831 GFP_KERNEL);
832 if (!qm_info->qm_port_params) 832 if (!qm_info->qm_port_params)
833 goto alloc_err; 833 goto alloc_err;
834 834
835 qm_info->wfq_data = kzalloc(sizeof(*qm_info->wfq_data) * 835 qm_info->wfq_data = kcalloc(qed_init_qm_get_num_vports(p_hwfn),
836 qed_init_qm_get_num_vports(p_hwfn), 836 sizeof(*qm_info->wfq_data),
837 GFP_KERNEL); 837 GFP_KERNEL);
838 if (!qm_info->wfq_data) 838 if (!qm_info->wfq_data)
839 goto alloc_err; 839 goto alloc_err;
diff --git a/drivers/net/ethernet/qlogic/qed/qed_init_ops.c b/drivers/net/ethernet/qlogic/qed/qed_init_ops.c
index 3bb76da6baa2..d9ab5add27a8 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_init_ops.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_init_ops.c
@@ -149,12 +149,12 @@ int qed_init_alloc(struct qed_hwfn *p_hwfn)
149 if (IS_VF(p_hwfn->cdev)) 149 if (IS_VF(p_hwfn->cdev))
150 return 0; 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 GFP_KERNEL); 153 GFP_KERNEL);
154 if (!rt_data->b_valid) 154 if (!rt_data->b_valid)
155 return -ENOMEM; 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 GFP_KERNEL); 158 GFP_KERNEL);
159 if (!rt_data->init_val) { 159 if (!rt_data->init_val) {
160 kfree(rt_data->b_valid); 160 kfree(rt_data->b_valid);
diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
index 1f6ac848109d..de1c70843efd 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
@@ -98,7 +98,7 @@ int qed_l2_alloc(struct qed_hwfn *p_hwfn)
98 p_l2_info->queues = max_t(u8, rx, tx); 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 GFP_KERNEL); 102 GFP_KERNEL);
103 if (!pp_qids) 103 if (!pp_qids)
104 return -ENOMEM; 104 return -ENOMEM;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 1b5f7d57b6f8..8c6724063231 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -1025,15 +1025,17 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
1025 1025
1026 act_pci_func = ahw->total_nic_func; 1026 act_pci_func = ahw->total_nic_func;
1027 1027
1028 adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) * 1028 adapter->npars = kcalloc(act_pci_func,
1029 act_pci_func, GFP_KERNEL); 1029 sizeof(struct qlcnic_npar_info),
1030 GFP_KERNEL);
1030 if (!adapter->npars) { 1031 if (!adapter->npars) {
1031 ret = -ENOMEM; 1032 ret = -ENOMEM;
1032 goto err_pci_info; 1033 goto err_pci_info;
1033 } 1034 }
1034 1035
1035 adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) * 1036 adapter->eswitch = kcalloc(QLCNIC_NIU_MAX_XG_PORTS,
1036 QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL); 1037 sizeof(struct qlcnic_eswitch),
1038 GFP_KERNEL);
1037 if (!adapter->eswitch) { 1039 if (!adapter->eswitch) {
1038 ret = -ENOMEM; 1040 ret = -ENOMEM;
1039 goto err_npars; 1041 goto err_npars;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
index c58180f40844..0c744b9c6e0a 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
@@ -157,8 +157,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
157 adapter->ahw->sriov = sriov; 157 adapter->ahw->sriov = sriov;
158 sriov->num_vfs = num_vfs; 158 sriov->num_vfs = num_vfs;
159 bc = &sriov->bc; 159 bc = &sriov->bc;
160 sriov->vf_info = kzalloc(sizeof(struct qlcnic_vf_info) * 160 sriov->vf_info = kcalloc(num_vfs, sizeof(struct qlcnic_vf_info),
161 num_vfs, GFP_KERNEL); 161 GFP_KERNEL);
162 if (!sriov->vf_info) { 162 if (!sriov->vf_info) {
163 err = -ENOMEM; 163 err = -ENOMEM;
164 goto qlcnic_free_sriov; 164 goto qlcnic_free_sriov;
@@ -450,7 +450,7 @@ static int qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter,
450 return 0; 450 return 0;
451 451
452 num_vlans = sriov->num_allowed_vlans; 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 if (!sriov->allowed_vlans) 454 if (!sriov->allowed_vlans)
455 return -ENOMEM; 455 return -ENOMEM;
456 456
@@ -706,7 +706,7 @@ static inline int qlcnic_sriov_alloc_bc_trans(struct qlcnic_bc_trans **trans)
706static inline int qlcnic_sriov_alloc_bc_msg(struct qlcnic_bc_hdr **hdr, 706static inline int qlcnic_sriov_alloc_bc_msg(struct qlcnic_bc_hdr **hdr,
707 u32 size) 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 if (!*hdr) 710 if (!*hdr)
711 return -ENOMEM; 711 return -ENOMEM;
712 712
diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index ce8071fc90c4..e080d3e7c582 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -973,7 +973,7 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id)
973 goto err; 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 if (!dring->desc) { 977 if (!dring->desc) {
978 ret = -ENOMEM; 978 ret = -ENOMEM;
979 goto err; 979 goto err;
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
index eed18f88bdff..302079e22b06 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
@@ -2320,8 +2320,9 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card)
2320 pr_debug("%s: wl=%p port=%p\n", __func__, wl, port); 2320 pr_debug("%s: wl=%p port=%p\n", __func__, wl, port);
2321 2321
2322 /* allocate scan list */ 2322 /* allocate scan list */
2323 wl->networks = kzalloc(sizeof(struct gelic_wl_scan_info) * 2323 wl->networks = kcalloc(GELIC_WL_BSS_MAX_ENT,
2324 GELIC_WL_BSS_MAX_ENT, GFP_KERNEL); 2324 sizeof(struct gelic_wl_scan_info),
2325 GFP_KERNEL);
2325 2326
2326 if (!wl->networks) 2327 if (!wl->networks)
2327 goto fail_bss; 2328 goto fail_bss;
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index a6c87793d899..79e9b103188b 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -1097,8 +1097,9 @@ static struct dp83640_clock *dp83640_clock_get_bus(struct mii_bus *bus)
1097 if (!clock) 1097 if (!clock)
1098 goto out; 1098 goto out;
1099 1099
1100 clock->caps.pin_config = kzalloc(sizeof(struct ptp_pin_desc) * 1100 clock->caps.pin_config = kcalloc(DP83640_N_PINS,
1101 DP83640_N_PINS, GFP_KERNEL); 1101 sizeof(struct ptp_pin_desc),
1102 GFP_KERNEL);
1102 if (!clock->caps.pin_config) { 1103 if (!clock->caps.pin_config) {
1103 kfree(clock); 1104 kfree(clock);
1104 clock = NULL; 1105 clock = NULL;
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index 8940417c30e5..b008266e91ea 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -1307,7 +1307,7 @@ static int __init slip_init(void)
1307 printk(KERN_INFO "SLIP linefill/keepalive option.\n"); 1307 printk(KERN_INFO "SLIP linefill/keepalive option.\n");
1308#endif 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 GFP_KERNEL); 1311 GFP_KERNEL);
1312 if (!slip_devs) 1312 if (!slip_devs)
1313 return -ENOMEM; 1313 return -ENOMEM;
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index ca0af0e15a2c..b070959737ff 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -280,7 +280,7 @@ static int __team_options_register(struct team *team,
280 struct team_option **dst_opts; 280 struct team_option **dst_opts;
281 int err; 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 GFP_KERNEL); 284 GFP_KERNEL);
285 if (!dst_opts) 285 if (!dst_opts)
286 return -ENOMEM; 286 return -ENOMEM;
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 309b88acd3d0..06b4d290784d 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1661,7 +1661,7 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
1661 } 1661 }
1662 1662
1663 if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) { 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 u32 command[2]; 1665 u32 command[2];
1666 u32 offset[2]; 1666 u32 offset[2];
1667 u32 crc[4]; 1667 u32 crc[4];
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 15b9a83bbd9d..b6c9a2af3732 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2552,7 +2552,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
2552 virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ); 2552 virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ);
2553 2553
2554 /* Allocate space for find_vqs parameters */ 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 if (!vqs) 2556 if (!vqs)
2557 goto err_vq; 2557 goto err_vq;
2558 callbacks = kmalloc_array(total_vqs, sizeof(*callbacks), GFP_KERNEL); 2558 callbacks = kmalloc_array(total_vqs, sizeof(*callbacks), GFP_KERNEL);
@@ -2562,7 +2562,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
2562 if (!names) 2562 if (!names)
2563 goto err_names; 2563 goto err_names;
2564 if (!vi->big_packets || vi->mergeable_rx_bufs) { 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 if (!ctx) 2566 if (!ctx)
2567 goto err_ctx; 2567 goto err_ctx;
2568 } else { 2568 } else {
@@ -2626,10 +2626,10 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
2626 vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL); 2626 vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
2627 if (!vi->ctrl) 2627 if (!vi->ctrl)
2628 goto err_ctrl; 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 if (!vi->sq) 2630 if (!vi->sq)
2631 goto err_sq; 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 if (!vi->rq) 2633 if (!vi->rq)
2634 goto err_rq; 2634 goto err_rq;
2635 2635
diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c
index 4205dfd19da3..9b09c9d0d0fb 100644
--- a/drivers/net/wan/fsl_ucc_hdlc.c
+++ b/drivers/net/wan/fsl_ucc_hdlc.c
@@ -198,12 +198,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
198 goto free_tx_bd; 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 GFP_KERNEL); 203 GFP_KERNEL);
203 if (!priv->rx_skbuff) 204 if (!priv->rx_skbuff)
204 goto free_ucc_pram; 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 GFP_KERNEL); 209 GFP_KERNEL);
208 if (!priv->tx_skbuff) 210 if (!priv->tx_skbuff)
209 goto free_rx_skbuff; 211 goto free_rx_skbuff;
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index bd23f6940488..c72d8af122a2 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -582,7 +582,7 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt)
582 } 582 }
583 583
584 htt->rx_ring.netbufs_ring = 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 GFP_KERNEL); 586 GFP_KERNEL);
587 if (!htt->rx_ring.netbufs_ring) 587 if (!htt->rx_ring.netbufs_ring)
588 goto err_netbuf; 588 goto err_netbuf;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 2e34a1fc5ba6..8c49a26fc571 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -155,7 +155,7 @@ ath10k_wmi_tlv_parse_alloc(struct ath10k *ar, const void *ptr,
155 const void **tb; 155 const void **tb;
156 int ret; 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 if (!tb) 159 if (!tb)
160 return ERR_PTR(-ENOMEM); 160 return ERR_PTR(-ENOMEM);
161 161
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 2ba8cf3f38af..0687697d5e2d 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1041,7 +1041,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy,
1041 1041
1042 n_channels = request->n_channels; 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 if (channels == NULL) { 1045 if (channels == NULL) {
1046 ath6kl_warn("failed to set scan channels, scan all channels"); 1046 ath6kl_warn("failed to set scan channels, scan all channels");
1047 n_channels = 0; 1047 n_channels = 0;
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 29e93c953d93..7f1bdea742b8 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -1958,7 +1958,7 @@ static int carl9170_parse_eeprom(struct ar9170 *ar)
1958 if (!bands) 1958 if (!bands)
1959 return -EINVAL; 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 if (!ar->survey) 1962 if (!ar->survey)
1963 return -ENOMEM; 1963 return -ENOMEM;
1964 ar->num_channels = chans; 1964 ar->num_channels = chans;
@@ -1988,8 +1988,9 @@ int carl9170_register(struct ar9170 *ar)
1988 if (WARN_ON(ar->mem_bitmap)) 1988 if (WARN_ON(ar->mem_bitmap))
1989 return -EINVAL; 1989 return -EINVAL;
1990 1990
1991 ar->mem_bitmap = kzalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG) * 1991 ar->mem_bitmap = kcalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG),
1992 sizeof(unsigned long), GFP_KERNEL); 1992 sizeof(unsigned long),
1993 GFP_KERNEL);
1993 1994
1994 if (!ar->mem_bitmap) 1995 if (!ar->mem_bitmap)
1995 return -ENOMEM; 1996 return -ENOMEM;
diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c
index f2a2f41e3c96..44ab080d6518 100644
--- a/drivers/net/wireless/broadcom/b43/phy_n.c
+++ b/drivers/net/wireless/broadcom/b43/phy_n.c
@@ -1518,7 +1518,7 @@ static int b43_nphy_load_samples(struct b43_wldev *dev,
1518 u16 i; 1518 u16 i;
1519 u32 *data; 1519 u32 *data;
1520 1520
1521 data = kzalloc(len * sizeof(u32), GFP_KERNEL); 1521 data = kcalloc(len, sizeof(u32), GFP_KERNEL);
1522 if (!data) { 1522 if (!data) {
1523 b43err(dev->wl, "allocation for samples loading failed\n"); 1523 b43err(dev->wl, "allocation for samples loading failed\n");
1524 return -ENOMEM; 1524 return -ENOMEM;
diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c
index f1e3dad57629..55f411925960 100644
--- a/drivers/net/wireless/broadcom/b43legacy/main.c
+++ b/drivers/net/wireless/broadcom/b43legacy/main.c
@@ -3300,8 +3300,8 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
3300 3300
3301 if ((phy->type == B43legacy_PHYTYPE_B) || 3301 if ((phy->type == B43legacy_PHYTYPE_B) ||
3302 (phy->type == B43legacy_PHYTYPE_G)) { 3302 (phy->type == B43legacy_PHYTYPE_G)) {
3303 phy->_lo_pairs = kzalloc(sizeof(struct b43legacy_lopair) 3303 phy->_lo_pairs = kcalloc(B43legacy_LO_COUNT,
3304 * B43legacy_LO_COUNT, 3304 sizeof(struct b43legacy_lopair),
3305 GFP_KERNEL); 3305 GFP_KERNEL);
3306 if (!phy->_lo_pairs) 3306 if (!phy->_lo_pairs)
3307 return -ENOMEM; 3307 return -ENOMEM;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
index 49d37ad96958..c40ba8855cd5 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
@@ -1486,8 +1486,9 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
1486 (struct brcmf_commonring **)if_msgbuf->commonrings; 1486 (struct brcmf_commonring **)if_msgbuf->commonrings;
1487 msgbuf->flowrings = (struct brcmf_commonring **)if_msgbuf->flowrings; 1487 msgbuf->flowrings = (struct brcmf_commonring **)if_msgbuf->flowrings;
1488 msgbuf->max_flowrings = if_msgbuf->max_flowrings; 1488 msgbuf->max_flowrings = if_msgbuf->max_flowrings;
1489 msgbuf->flowring_dma_handle = kzalloc(msgbuf->max_flowrings * 1489 msgbuf->flowring_dma_handle =
1490 sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL); 1490 kcalloc(msgbuf->max_flowrings,
1491 sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL);
1491 if (!msgbuf->flowring_dma_handle) 1492 if (!msgbuf->flowring_dma_handle)
1492 goto fail; 1493 goto fail;
1493 1494
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
index 4b2149b48362..3e9c4f2f5dd1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -1058,7 +1058,7 @@ static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
1058 channel_cnt = AF_PEER_SEARCH_CNT; 1058 channel_cnt = AF_PEER_SEARCH_CNT;
1059 else 1059 else
1060 channel_cnt = SOCIAL_CHAN_CNT; 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 GFP_KERNEL); 1062 GFP_KERNEL);
1063 if (default_chan_list == NULL) { 1063 if (default_chan_list == NULL) {
1064 brcmf_err("channel list allocation failed\n"); 1064 brcmf_err("channel list allocation failed\n");
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c
index 0a14942b8216..7d4e8f589fdc 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c
@@ -507,7 +507,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid)
507 wlc->hw->wlc = wlc; 507 wlc->hw->wlc = wlc;
508 508
509 wlc->hw->bandstate[0] = 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 if (wlc->hw->bandstate[0] == NULL) { 511 if (wlc->hw->bandstate[0] == NULL) {
512 *err = 1006; 512 *err = 1006;
513 goto fail; 513 goto fail;
@@ -521,7 +521,8 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid)
521 } 521 }
522 522
523 wlc->modulecb = 523 wlc->modulecb =
524 kzalloc(sizeof(struct modulecb) * BRCMS_MAXMODULES, GFP_ATOMIC); 524 kcalloc(BRCMS_MAXMODULES, sizeof(struct modulecb),
525 GFP_ATOMIC);
525 if (wlc->modulecb == NULL) { 526 if (wlc->modulecb == NULL) {
526 *err = 1009; 527 *err = 1009;
527 goto fail; 528 goto fail;
@@ -553,7 +554,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid)
553 } 554 }
554 555
555 wlc->bandstate[0] = 556 wlc->bandstate[0] =
556 kzalloc(sizeof(struct brcms_band)*MAXBANDS, GFP_ATOMIC); 557 kcalloc(MAXBANDS, sizeof(struct brcms_band), GFP_ATOMIC);
557 if (wlc->bandstate[0] == NULL) { 558 if (wlc->bandstate[0] == NULL) {
558 *err = 1025; 559 *err = 1025;
559 goto fail; 560 goto fail;
diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c
index 063e19ced7c8..6514baf799fe 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -922,7 +922,7 @@ il_init_channel_map(struct il_priv *il)
922 D_EEPROM("Parsing data for %d channels.\n", il->channel_count); 922 D_EEPROM("Parsing data for %d channels.\n", il->channel_count);
923 923
924 il->channel_info = 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 GFP_KERNEL); 926 GFP_KERNEL);
927 if (!il->channel_info) { 927 if (!il->channel_info) {
928 IL_ERR("Could not allocate channel_info\n"); 928 IL_ERR("Could not allocate channel_info\n");
@@ -3041,9 +3041,9 @@ il_tx_queue_init(struct il_priv *il, u32 txq_id)
3041 } 3041 }
3042 3042
3043 txq->meta = 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 txq->cmd = 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 if (!txq->meta || !txq->cmd) 3048 if (!txq->meta || !txq->cmd)
3049 goto out_free_arrays; 3049 goto out_free_arrays;
@@ -3455,7 +3455,7 @@ il_init_geos(struct il_priv *il)
3455 } 3455 }
3456 3456
3457 channels = 3457 channels =
3458 kzalloc(sizeof(struct ieee80211_channel) * il->channel_count, 3458 kcalloc(il->channel_count, sizeof(struct ieee80211_channel),
3459 GFP_KERNEL); 3459 GFP_KERNEL);
3460 if (!channels) 3460 if (!channels)
3461 return -ENOMEM; 3461 return -ENOMEM;
@@ -4654,8 +4654,9 @@ il_alloc_txq_mem(struct il_priv *il)
4654{ 4654{
4655 if (!il->txq) 4655 if (!il->txq)
4656 il->txq = 4656 il->txq =
4657 kzalloc(sizeof(struct il_tx_queue) * 4657 kcalloc(il->cfg->num_of_queues,
4658 il->cfg->num_of_queues, GFP_KERNEL); 4658 sizeof(struct il_tx_queue),
4659 GFP_KERNEL);
4659 if (!il->txq) { 4660 if (!il->txq) {
4660 IL_ERR("Not enough memory for txq\n"); 4661 IL_ERR("Not enough memory for txq\n");
4661 return -ENOMEM; 4662 return -ENOMEM;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
index 4b3753d78d03..11ecdf63b732 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
@@ -564,7 +564,7 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
564 else 564 else
565 blacklist_len = IWL_SCAN_MAX_BLACKLIST_LEN; 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 if (!blacklist) 568 if (!blacklist)
569 return -ENOMEM; 569 return -ENOMEM;
570 570
diff --git a/drivers/net/wireless/intersil/p54/eeprom.c b/drivers/net/wireless/intersil/p54/eeprom.c
index d4c73d39336f..de2ef95c386c 100644
--- a/drivers/net/wireless/intersil/p54/eeprom.c
+++ b/drivers/net/wireless/intersil/p54/eeprom.c
@@ -161,8 +161,9 @@ static int p54_generate_band(struct ieee80211_hw *dev,
161 if (!tmp) 161 if (!tmp)
162 goto err_out; 162 goto err_out;
163 163
164 tmp->channels = kzalloc(sizeof(struct ieee80211_channel) * 164 tmp->channels = kcalloc(list->band_channel_num[band],
165 list->band_channel_num[band], GFP_KERNEL); 165 sizeof(struct ieee80211_channel),
166 GFP_KERNEL);
166 if (!tmp->channels) 167 if (!tmp->channels)
167 goto err_out; 168 goto err_out;
168 169
@@ -344,7 +345,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
344 goto free; 345 goto free;
345 } 346 }
346 priv->chan_num = max_channel_num; 347 priv->chan_num = max_channel_num;
347 priv->survey = kzalloc(sizeof(struct survey_info) * max_channel_num, 348 priv->survey = kcalloc(max_channel_num, sizeof(struct survey_info),
348 GFP_KERNEL); 349 GFP_KERNEL);
349 if (!priv->survey) { 350 if (!priv->survey) {
350 ret = -ENOMEM; 351 ret = -ENOMEM;
@@ -352,8 +353,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
352 } 353 }
353 354
354 list->max_entries = max_channel_num; 355 list->max_entries = max_channel_num;
355 list->channels = kzalloc(sizeof(struct p54_channel_entry) * 356 list->channels = kcalloc(max_channel_num,
356 max_channel_num, GFP_KERNEL); 357 sizeof(struct p54_channel_entry),
358 GFP_KERNEL);
357 if (!list->channels) { 359 if (!list->channels) {
358 ret = -ENOMEM; 360 ret = -ENOMEM;
359 goto free; 361 goto free;
diff --git a/drivers/net/wireless/intersil/prism54/oid_mgt.c b/drivers/net/wireless/intersil/prism54/oid_mgt.c
index 6528ed5b9b1d..6d57e1cbcc07 100644
--- a/drivers/net/wireless/intersil/prism54/oid_mgt.c
+++ b/drivers/net/wireless/intersil/prism54/oid_mgt.c
@@ -244,7 +244,7 @@ mgt_init(islpci_private *priv)
244 /* Alloc the cache */ 244 /* Alloc the cache */
245 for (i = 0; i < OID_NUM_LAST; i++) { 245 for (i = 0; i < OID_NUM_LAST; i++) {
246 if (isl_oid[i].flags & OID_FLAG_CACHED) { 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 (isl_oid[i].range + 1), 248 (isl_oid[i].range + 1),
249 GFP_KERNEL); 249 GFP_KERNEL);
250 if (!priv->mib[i]) 250 if (!priv->mib[i])
diff --git a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
index 1edcddaf7b4b..7ab44cd32a9d 100644
--- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
@@ -399,8 +399,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
399 399
400 new_node->win_size = win_size; 400 new_node->win_size = win_size;
401 401
402 new_node->rx_reorder_ptr = kzalloc(sizeof(void *) * win_size, 402 new_node->rx_reorder_ptr = kcalloc(win_size, sizeof(void *),
403 GFP_KERNEL); 403 GFP_KERNEL);
404 if (!new_node->rx_reorder_ptr) { 404 if (!new_node->rx_reorder_ptr) {
405 kfree((u8 *) new_node); 405 kfree((u8 *) new_node);
406 mwifiex_dbg(priv->adapter, ERROR, 406 mwifiex_dbg(priv->adapter, ERROR,
diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index 47d2dcc3f28f..dfdcbc4f141a 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -2106,15 +2106,16 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
2106 return -ENOMEM; 2106 return -ENOMEM;
2107 2107
2108 /* Allocate skb pointer buffers */ 2108 /* Allocate skb pointer buffers */
2109 card->mpa_rx.skb_arr = kzalloc((sizeof(void *)) * 2109 card->mpa_rx.skb_arr = kcalloc(card->mp_agg_pkt_limit, sizeof(void *),
2110 card->mp_agg_pkt_limit, GFP_KERNEL); 2110 GFP_KERNEL);
2111 if (!card->mpa_rx.skb_arr) { 2111 if (!card->mpa_rx.skb_arr) {
2112 kfree(card->mp_regs); 2112 kfree(card->mp_regs);
2113 return -ENOMEM; 2113 return -ENOMEM;
2114 } 2114 }
2115 2115
2116 card->mpa_rx.len_arr = kzalloc(sizeof(*card->mpa_rx.len_arr) * 2116 card->mpa_rx.len_arr = kcalloc(card->mp_agg_pkt_limit,
2117 card->mp_agg_pkt_limit, GFP_KERNEL); 2117 sizeof(*card->mpa_rx.len_arr),
2118 GFP_KERNEL);
2118 if (!card->mpa_rx.len_arr) { 2119 if (!card->mpa_rx.len_arr) {
2119 kfree(card->mp_regs); 2120 kfree(card->mp_regs);
2120 kfree(card->mpa_rx.skb_arr); 2121 kfree(card->mpa_rx.skb_arr);
diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c
index 5eb143667539..c5d94a95e21a 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c
@@ -1216,7 +1216,7 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac,
1216 return -EINVAL; 1216 return -EINVAL;
1217 } 1217 }
1218 1218
1219 limits = kzalloc(sizeof(*limits) * rec->n_limits, 1219 limits = kcalloc(rec->n_limits, sizeof(*limits),
1220 GFP_KERNEL); 1220 GFP_KERNEL);
1221 if (!limits) 1221 if (!limits)
1222 return -ENOMEM; 1222 return -ENOMEM;
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
index 0eee479583b8..acc399b5574e 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
@@ -397,7 +397,7 @@ static ssize_t rt2x00debug_read_crypto_stats(struct file *file,
397 if (*offset) 397 if (*offset)
398 return 0; 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 if (!data) 401 if (!data)
402 return -ENOMEM; 402 return -ENOMEM;
403 403
diff --git a/drivers/net/wireless/realtek/rtlwifi/efuse.c b/drivers/net/wireless/realtek/rtlwifi/efuse.c
index fd13d4ef53b8..9729e51fce38 100644
--- a/drivers/net/wireless/realtek/rtlwifi/efuse.c
+++ b/drivers/net/wireless/realtek/rtlwifi/efuse.c
@@ -258,8 +258,8 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
258 } 258 }
259 259
260 /* allocate memory for efuse_tbl and efuse_word */ 260 /* allocate memory for efuse_tbl and efuse_word */
261 efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] * 261 efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE],
262 sizeof(u8), GFP_ATOMIC); 262 GFP_ATOMIC);
263 if (!efuse_tbl) 263 if (!efuse_tbl)
264 return; 264 return;
265 efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC); 265 efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC);
diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c
index ce3103bb8ebb..f9faffc498bc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/usb.c
+++ b/drivers/net/wireless/realtek/rtlwifi/usb.c
@@ -1048,7 +1048,7 @@ int rtl_usb_probe(struct usb_interface *intf,
1048 } 1048 }
1049 rtlpriv = hw->priv; 1049 rtlpriv = hw->priv;
1050 rtlpriv->hw = hw; 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 GFP_KERNEL); 1052 GFP_KERNEL);
1053 if (!rtlpriv->usb_data) 1053 if (!rtlpriv->usb_data)
1054 return -ENOMEM; 1054 return -ENOMEM;
diff --git a/drivers/net/wireless/st/cw1200/queue.c b/drivers/net/wireless/st/cw1200/queue.c
index 5153d2cfd991..7c31b63b8258 100644
--- a/drivers/net/wireless/st/cw1200/queue.c
+++ b/drivers/net/wireless/st/cw1200/queue.c
@@ -154,7 +154,7 @@ int cw1200_queue_stats_init(struct cw1200_queue_stats *stats,
154 spin_lock_init(&stats->lock); 154 spin_lock_init(&stats->lock);
155 init_waitqueue_head(&stats->wait_link_id_empty); 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 GFP_KERNEL); 158 GFP_KERNEL);
159 if (!stats->link_map_cache) 159 if (!stats->link_map_cache)
160 return -ENOMEM; 160 return -ENOMEM;
@@ -181,13 +181,13 @@ int cw1200_queue_init(struct cw1200_queue *queue,
181 spin_lock_init(&queue->lock); 181 spin_lock_init(&queue->lock);
182 timer_setup(&queue->gc, cw1200_queue_gc, 0); 182 timer_setup(&queue->gc, cw1200_queue_gc, 0);
183 183
184 queue->pool = kzalloc(sizeof(struct cw1200_queue_item) * capacity, 184 queue->pool = kcalloc(capacity, sizeof(struct cw1200_queue_item),
185 GFP_KERNEL); 185 GFP_KERNEL);
186 if (!queue->pool) 186 if (!queue->pool)
187 return -ENOMEM; 187 return -ENOMEM;
188 188
189 queue->link_map_cache = kzalloc(sizeof(int) * stats->map_capacity, 189 queue->link_map_cache = kcalloc(stats->map_capacity, sizeof(int),
190 GFP_KERNEL); 190 GFP_KERNEL);
191 if (!queue->link_map_cache) { 191 if (!queue->link_map_cache) {
192 kfree(queue->pool); 192 kfree(queue->pool);
193 queue->pool = NULL; 193 queue->pool = NULL;
diff --git a/drivers/net/wireless/st/cw1200/scan.c b/drivers/net/wireless/st/cw1200/scan.c
index cc2ce60f4f09..67213f11acbd 100644
--- a/drivers/net/wireless/st/cw1200/scan.c
+++ b/drivers/net/wireless/st/cw1200/scan.c
@@ -230,9 +230,9 @@ void cw1200_scan_work(struct work_struct *work)
230 scan.type = WSM_SCAN_TYPE_BACKGROUND; 230 scan.type = WSM_SCAN_TYPE_BACKGROUND;
231 scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND; 231 scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND;
232 } 232 }
233 scan.ch = kzalloc( 233 scan.ch = kcalloc(it - priv->scan.curr,
234 sizeof(struct wsm_scan_ch) * (it - priv->scan.curr), 234 sizeof(struct wsm_scan_ch),
235 GFP_KERNEL); 235 GFP_KERNEL);
236 if (!scan.ch) { 236 if (!scan.ch) {
237 priv->scan.status = -ENOMEM; 237 priv->scan.status = -ENOMEM;
238 goto fail; 238 goto fail;
diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
index b3b0b648be62..146de9489339 100644
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -122,7 +122,8 @@ static int rockchip_rk3328_efuse_read(void *context, unsigned int offset,
122 addr_offset = offset % RK3399_NBYTES; 122 addr_offset = offset % RK3399_NBYTES;
123 addr_len = addr_end - addr_start; 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 if (!buf) { 127 if (!buf) {
127 ret = -ENOMEM; 128 ret = -ENOMEM;
128 goto nomem; 129 goto nomem;
@@ -174,7 +175,8 @@ static int rockchip_rk3399_efuse_read(void *context, unsigned int offset,
174 addr_offset = offset % RK3399_NBYTES; 175 addr_offset = offset % RK3399_NBYTES;
175 addr_len = addr_end - addr_start; 176 addr_len = addr_end - addr_start;
176 177
177 buf = kzalloc(sizeof(*buf) * addr_len * RK3399_NBYTES, GFP_KERNEL); 178 buf = kzalloc(array3_size(addr_len, RK3399_NBYTES, sizeof(*buf)),
179 GFP_KERNEL);
178 if (!buf) { 180 if (!buf) {
179 clk_disable_unprepare(efuse->clk); 181 clk_disable_unprepare(efuse->clk);
180 return -ENOMEM; 182 return -ENOMEM;
diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
index 26bb637afe92..d020f89248fd 100644
--- a/drivers/nvmem/sunxi_sid.c
+++ b/drivers/nvmem/sunxi_sid.c
@@ -185,7 +185,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
185 if (IS_ERR(nvmem)) 185 if (IS_ERR(nvmem))
186 return PTR_ERR(nvmem); 186 return PTR_ERR(nvmem);
187 187
188 randomness = kzalloc(sizeof(u8) * (size), GFP_KERNEL); 188 randomness = kzalloc(size, GFP_KERNEL);
189 if (!randomness) { 189 if (!randomness) {
190 ret = -EINVAL; 190 ret = -EINVAL;
191 goto err_unreg_nvmem; 191 goto err_unreg_nvmem;
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 0b49a62b38a3..14cc962e0eec 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -129,7 +129,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
129 129
130 /* Populate the resource table */ 130 /* Populate the resource table */
131 if (num_irq || num_reg) { 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 if (!res) { 133 if (!res) {
134 platform_device_put(dev); 134 platform_device_put(dev);
135 return NULL; 135 return NULL;
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index ecee50d10d14..722537e14848 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -156,7 +156,7 @@ static void __init of_unittest_dynamic(void)
156 } 156 }
157 157
158 /* Array of 4 properties for the purpose of testing */ 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 if (!prop) { 160 if (!prop) {
161 unittest(0, "kzalloc() failed\n"); 161 unittest(0, "kzalloc() failed\n");
162 return; 162 return;
diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c
index 370eff3acd8a..9e5a9a3112c9 100644
--- a/drivers/opp/ti-opp-supply.c
+++ b/drivers/opp/ti-opp-supply.c
@@ -122,8 +122,8 @@ static int _store_optimized_voltages(struct device *dev,
122 goto out; 122 goto out;
123 } 123 }
124 124
125 table = kzalloc(sizeof(*data->vdd_table) * 125 table = kcalloc(data->num_vdd_table, sizeof(*data->vdd_table),
126 data->num_vdd_table, GFP_KERNEL); 126 GFP_KERNEL);
127 if (!table) { 127 if (!table) {
128 ret = -ENOMEM; 128 ret = -ENOMEM;
129 goto out; 129 goto out;
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index f45b74fcc059..4d88afdfc843 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -474,7 +474,7 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
474 return 0; 474 return 0;
475 475
476 /* Dynamically create the MSI attributes for the PCI device */ 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 if (!msi_attrs) 478 if (!msi_attrs)
479 return -ENOMEM; 479 return -ENOMEM;
480 for_each_pci_msi_entry(entry, pdev) { 480 for_each_pci_msi_entry(entry, pdev) {
@@ -501,7 +501,7 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
501 msi_irq_group->name = "msi_irqs"; 501 msi_irq_group->name = "msi_irqs";
502 msi_irq_group->attrs = msi_attrs; 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 if (!msi_irq_groups) 505 if (!msi_irq_groups)
506 goto error_irq_group; 506 goto error_irq_group;
507 msi_irq_groups[0] = msi_irq_group; 507 msi_irq_groups[0] = msi_irq_group;
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 788a200fb2dc..0c4653c1d2ce 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1076,7 +1076,7 @@ void pci_create_legacy_files(struct pci_bus *b)
1076{ 1076{
1077 int error; 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 GFP_ATOMIC); 1080 GFP_ATOMIC);
1081 if (!b->legacy_io) 1081 if (!b->legacy_io)
1082 goto kzalloc_err; 1082 goto kzalloc_err;
diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c
index 959ae3e65ef8..f0af9985ca09 100644
--- a/drivers/pcmcia/pd6729.c
+++ b/drivers/pcmcia/pd6729.c
@@ -628,7 +628,7 @@ static int pd6729_pci_probe(struct pci_dev *dev,
628 char configbyte; 628 char configbyte;
629 struct pd6729_socket *socket; 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 GFP_KERNEL); 632 GFP_KERNEL);
633 if (!socket) { 633 if (!socket) {
634 dev_warn(&dev->dev, "failed to kzalloc socket.\n"); 634 dev_warn(&dev->dev, "failed to kzalloc socket.\n");
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 136ccaf53df8..fa530913a2c8 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -771,8 +771,8 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
771 maps_per_pin++; 771 maps_per_pin++;
772 if (num_pulls) 772 if (num_pulls)
773 maps_per_pin++; 773 maps_per_pin++;
774 cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps), 774 cur_map = maps = kcalloc(num_pins * maps_per_pin, sizeof(*maps),
775 GFP_KERNEL); 775 GFP_KERNEL);
776 if (!maps) 776 if (!maps)
777 return -ENOMEM; 777 return -ENOMEM;
778 778
diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index 594f3e5ce9a9..3a17846aa31f 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -89,7 +89,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
89 if (!purecfg && config) 89 if (!purecfg && config)
90 new_num = 2; 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 if (!new_map) 93 if (!new_map)
94 return -ENOMEM; 94 return -ENOMEM;
95 95
diff --git a/drivers/pinctrl/pinctrl-lantiq.c b/drivers/pinctrl/pinctrl-lantiq.c
index 41dc39c7a7b1..81632af3a86a 100644
--- a/drivers/pinctrl/pinctrl-lantiq.c
+++ b/drivers/pinctrl/pinctrl-lantiq.c
@@ -158,7 +158,8 @@ static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
158 158
159 for_each_child_of_node(np_config, np) 159 for_each_child_of_node(np_config, np)
160 max_maps += ltq_pinctrl_dt_subnode_size(np); 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 if (!*map) 163 if (!*map)
163 return -ENOMEM; 164 return -ENOMEM;
164 tmp = *map; 165 tmp = *map;
diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c
index ca2347d0d579..505845c66dd0 100644
--- a/drivers/pinctrl/sirf/pinctrl-sirf.c
+++ b/drivers/pinctrl/sirf/pinctrl-sirf.c
@@ -108,7 +108,7 @@ static int sirfsoc_dt_node_to_map(struct pinctrl_dev *pctldev,
108 return -ENODEV; 108 return -ENODEV;
109 } 109 }
110 110
111 *map = kzalloc(sizeof(**map) * count, GFP_KERNEL); 111 *map = kcalloc(count, sizeof(**map), GFP_KERNEL);
112 if (!*map) 112 if (!*map)
113 return -ENOMEM; 113 return -ENOMEM;
114 114
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index efe79d3f7659..c4f850345dc4 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -172,7 +172,7 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
172 return -ENODEV; 172 return -ENODEV;
173 } 173 }
174 174
175 *map = kzalloc(sizeof(**map) * count, GFP_KERNEL); 175 *map = kcalloc(count, sizeof(**map), GFP_KERNEL);
176 if (!*map) 176 if (!*map)
177 return -ENOMEM; 177 return -ENOMEM;
178 178
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 44459d28efd5..eaace8ec6afc 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -277,7 +277,7 @@ static unsigned long *sunxi_pctrl_build_pin_config(struct device_node *node,
277 if (!configlen) 277 if (!configlen)
278 return NULL; 278 return NULL;
279 279
280 pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL); 280 pinconfig = kcalloc(configlen, sizeof(*pinconfig), GFP_KERNEL);
281 if (!pinconfig) 281 if (!pinconfig)
282 return ERR_PTR(-ENOMEM); 282 return ERR_PTR(-ENOMEM);
283 283
diff --git a/drivers/pinctrl/vt8500/pinctrl-wmt.c b/drivers/pinctrl/vt8500/pinctrl-wmt.c
index d73956bdc211..c08318a5a91b 100644
--- a/drivers/pinctrl/vt8500/pinctrl-wmt.c
+++ b/drivers/pinctrl/vt8500/pinctrl-wmt.c
@@ -352,7 +352,7 @@ static int wmt_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
352 if (num_pulls) 352 if (num_pulls)
353 maps_per_pin++; 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 GFP_KERNEL); 356 GFP_KERNEL);
357 if (!maps) 357 if (!maps)
358 return -ENOMEM; 358 return -ENOMEM;
diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
index 9d7dbd925065..d975462a4c57 100644
--- a/drivers/platform/x86/alienware-wmi.c
+++ b/drivers/platform/x86/alienware-wmi.c
@@ -458,19 +458,19 @@ static int alienware_zone_init(struct platform_device *dev)
458 * - zone_data num_zones is for the distinct zones 458 * - zone_data num_zones is for the distinct zones
459 */ 459 */
460 zone_dev_attrs = 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 GFP_KERNEL); 462 GFP_KERNEL);
463 if (!zone_dev_attrs) 463 if (!zone_dev_attrs)
464 return -ENOMEM; 464 return -ENOMEM;
465 465
466 zone_attrs = 466 zone_attrs =
467 kzalloc(sizeof(struct attribute *) * (quirks->num_zones + 2), 467 kcalloc(quirks->num_zones + 2, sizeof(struct attribute *),
468 GFP_KERNEL); 468 GFP_KERNEL);
469 if (!zone_attrs) 469 if (!zone_attrs)
470 return -ENOMEM; 470 return -ENOMEM;
471 471
472 zone_data = 472 zone_data =
473 kzalloc(sizeof(struct platform_zone) * (quirks->num_zones), 473 kcalloc(quirks->num_zones, sizeof(struct platform_zone),
474 GFP_KERNEL); 474 GFP_KERNEL);
475 if (!zone_data) 475 if (!zone_data)
476 return -ENOMEM; 476 return -ENOMEM;
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index a0c95853fd3f..014fc1634a3d 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -964,12 +964,12 @@ static int ips_monitor(void *data)
964 u16 *mcp_samples, *ctv1_samples, *ctv2_samples, *mch_samples; 964 u16 *mcp_samples, *ctv1_samples, *ctv2_samples, *mch_samples;
965 u8 cur_seqno, last_seqno; 965 u8 cur_seqno, last_seqno;
966 966
967 mcp_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL); 967 mcp_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL);
968 ctv1_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL); 968 ctv1_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL);
969 ctv2_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL); 969 ctv2_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL);
970 mch_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL); 970 mch_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL);
971 cpu_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL); 971 cpu_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u32), GFP_KERNEL);
972 mchp_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL); 972 mchp_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u32), GFP_KERNEL);
973 if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples || 973 if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples ||
974 !cpu_samples || !mchp_samples) { 974 !cpu_samples || !mchp_samples) {
975 dev_err(ips->dev, 975 dev_err(ips->dev,
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 5c39b3211709..8361ad75389a 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -571,7 +571,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
571 return -ENOMEM; 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 if (!pcc->sinf) { 575 if (!pcc->sinf) {
576 result = -ENOMEM; 576 result = -ENOMEM;
577 goto out_hotkey; 577 goto out_hotkey;
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index da1ca4856ea1..ab2d28867c52 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6006,7 +6006,7 @@ static int __init led_init(struct ibm_init_struct *iibm)
6006 if (led_supported == TPACPI_LED_NONE) 6006 if (led_supported == TPACPI_LED_NONE)
6007 return 1; 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 GFP_KERNEL); 6010 GFP_KERNEL);
6011 if (!tpacpi_leds) { 6011 if (!tpacpi_leds) {
6012 pr_err("Out of memory for LED data\n"); 6012 pr_err("Out of memory for LED data\n");
diff --git a/drivers/power/supply/wm97xx_battery.c b/drivers/power/supply/wm97xx_battery.c
index bd4f66651513..6754e761778a 100644
--- a/drivers/power/supply/wm97xx_battery.c
+++ b/drivers/power/supply/wm97xx_battery.c
@@ -201,7 +201,7 @@ static int wm97xx_bat_probe(struct platform_device *dev)
201 if (pdata->min_voltage >= 0) 201 if (pdata->min_voltage >= 0)
202 props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */ 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 if (!prop) { 205 if (!prop) {
206 ret = -ENOMEM; 206 ret = -ENOMEM;
207 goto err3; 207 goto err3;
diff --git a/drivers/power/supply/z2_battery.c b/drivers/power/supply/z2_battery.c
index 8a43b49cfd35..bcc2d1a9b0a7 100644
--- a/drivers/power/supply/z2_battery.c
+++ b/drivers/power/supply/z2_battery.c
@@ -146,7 +146,7 @@ static int z2_batt_ps_init(struct z2_charger *charger, int props)
146 if (info->min_voltage >= 0) 146 if (info->min_voltage >= 0)
147 props++; /* POWER_SUPPLY_PROP_VOLTAGE_MIN */ 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 if (!prop) 150 if (!prop)
151 return -ENOMEM; 151 return -ENOMEM;
152 152
diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
index 64b2b2501a79..9e2f274bd44f 100644
--- a/drivers/powercap/powercap_sys.c
+++ b/drivers/powercap/powercap_sys.c
@@ -545,15 +545,16 @@ struct powercap_zone *powercap_register_zone(
545 dev_set_name(&power_zone->dev, "%s:%x", 545 dev_set_name(&power_zone->dev, "%s:%x",
546 dev_name(power_zone->dev.parent), 546 dev_name(power_zone->dev.parent),
547 power_zone->id); 547 power_zone->id);
548 power_zone->constraints = kzalloc(sizeof(*power_zone->constraints) * 548 power_zone->constraints = kcalloc(nr_constraints,
549 nr_constraints, GFP_KERNEL); 549 sizeof(*power_zone->constraints),
550 GFP_KERNEL);
550 if (!power_zone->constraints) 551 if (!power_zone->constraints)
551 goto err_const_alloc; 552 goto err_const_alloc;
552 553
553 nr_attrs = nr_constraints * POWERCAP_CONSTRAINTS_ATTRS + 554 nr_attrs = nr_constraints * POWERCAP_CONSTRAINTS_ATTRS +
554 POWERCAP_ZONE_MAX_ATTRS + 1; 555 POWERCAP_ZONE_MAX_ATTRS + 1;
555 power_zone->zone_dev_attrs = kzalloc(sizeof(void *) * 556 power_zone->zone_dev_attrs = kcalloc(nr_attrs, sizeof(void *),
556 nr_attrs, GFP_KERNEL); 557 GFP_KERNEL);
557 if (!power_zone->zone_dev_attrs) 558 if (!power_zone->zone_dev_attrs)
558 goto err_attr_alloc; 559 goto err_attr_alloc;
559 create_power_zone_common_attributes(power_zone); 560 create_power_zone_common_attributes(power_zone);
diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 161b927d9de1..fd7b517132ac 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -425,9 +425,9 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
425 rswitch = rdev->rswitch; 425 rswitch = rdev->rswitch;
426 rswitch->port_ok = 0; 426 rswitch->port_ok = 0;
427 spin_lock_init(&rswitch->lock); 427 spin_lock_init(&rswitch->lock);
428 rswitch->route_table = kzalloc(sizeof(u8)* 428 rswitch->route_table =
429 RIO_MAX_ROUTE_ENTRIES(port->sys_size), 429 kzalloc(RIO_MAX_ROUTE_ENTRIES(port->sys_size),
430 GFP_KERNEL); 430 GFP_KERNEL);
431 if (!rswitch->route_table) 431 if (!rswitch->route_table)
432 goto cleanup; 432 goto cleanup;
433 /* Initialize switch route table */ 433 /* Initialize switch route table */
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 7726b874e539..b4e588cce03d 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1162,7 +1162,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
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 if (!rdata) 1166 if (!rdata)
1167 return -ENOMEM; 1167 return -ENOMEM;
1168 1168
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 29024492b8ed..ed607288e696 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -238,9 +238,9 @@ dcssblk_is_continuous(struct dcssblk_dev_info *dev_info)
238 if (dev_info->num_of_segments <= 1) 238 if (dev_info->num_of_segments <= 1)
239 return 0; 239 return 0;
240 240
241 sort_list = kzalloc( 241 sort_list = kcalloc(dev_info->num_of_segments,
242 sizeof(struct segment_info) * dev_info->num_of_segments, 242 sizeof(struct segment_info),
243 GFP_KERNEL); 243 GFP_KERNEL);
244 if (sort_list == NULL) 244 if (sort_list == NULL)
245 return -ENOMEM; 245 return -ENOMEM;
246 i = 0; 246 i = 0;
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c
index db1fbf9b00b5..79eb60958015 100644
--- a/drivers/s390/char/keyboard.c
+++ b/drivers/s390/char/keyboard.c
@@ -78,7 +78,7 @@ kbd_alloc(void) {
78 } 78 }
79 } 79 }
80 kbd->fn_handler = 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 if (!kbd->fn_handler) 82 if (!kbd->fn_handler)
83 goto out_func; 83 goto out_func;
84 kbd->accent_table = kmemdup(ebc_accent_table, 84 kbd->accent_table = kmemdup(ebc_accent_table,
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 52aa89424318..cbde65ab2170 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -242,7 +242,7 @@ static struct ccw1 *alloc_chan_prog(const char __user *ubuf, int rec_count,
242 * That means we allocate room for CCWs to cover count/reclen 242 * That means we allocate room for CCWs to cover count/reclen
243 * records plus a NOP. 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 GFP_KERNEL | GFP_DMA); 246 GFP_KERNEL | GFP_DMA);
247 if (!cpa) 247 if (!cpa)
248 return ERR_PTR(-ENOMEM); 248 return ERR_PTR(-ENOMEM);
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 4369662cfff5..76d3c50bf078 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -152,7 +152,7 @@ static int zcore_memmap_open(struct inode *inode, struct file *filp)
152 char *buf; 152 char *buf;
153 int i = 0; 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 if (!buf) { 156 if (!buf) {
157 return -ENOMEM; 157 return -ENOMEM;
158 } 158 }
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index 4c14ce428e92..78f1be41b05e 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -536,7 +536,7 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,
536 536
537int qdio_enable_async_operation(struct qdio_output_q *outq) 537int 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 GFP_ATOMIC); 540 GFP_ATOMIC);
541 if (!outq->aobs) { 541 if (!outq->aobs) {
542 outq->use_cq = 0; 542 outq->use_cq = 0;
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index 0787b587e4b8..07dea602205b 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -241,8 +241,9 @@ out:
241/* allocate non-shared indicators and shared indicator */ 241/* allocate non-shared indicators and shared indicator */
242int __init tiqdio_allocate_memory(void) 242int __init tiqdio_allocate_memory(void)
243{ 243{
244 q_indicators = kzalloc(sizeof(struct indicator_t) * TIQDIO_NR_INDICATORS, 244 q_indicators = kcalloc(TIQDIO_NR_INDICATORS,
245 GFP_KERNEL); 245 sizeof(struct indicator_t),
246 GFP_KERNEL);
246 if (!q_indicators) 247 if (!q_indicators)
247 return -ENOMEM; 248 return -ENOMEM;
248 return 0; 249 return 0;
diff --git a/drivers/s390/crypto/pkey_api.c b/drivers/s390/crypto/pkey_api.c
index a9ae827cc1ce..3929c8be8098 100644
--- a/drivers/s390/crypto/pkey_api.c
+++ b/drivers/s390/crypto/pkey_api.c
@@ -121,7 +121,7 @@ static int alloc_and_prep_cprbmem(size_t paramblen,
121 * allocate consecutive memory for request CPRB, request param 121 * allocate consecutive memory for request CPRB, request param
122 * block, reply CPRB and reply param block 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 if (!cprbmem) 125 if (!cprbmem)
126 return -ENOMEM; 126 return -ENOMEM;
127 127
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c
index 7ce98b70cad3..7617d21cb296 100644
--- a/drivers/s390/net/ctcm_main.c
+++ b/drivers/s390/net/ctcm_main.c
@@ -1379,7 +1379,7 @@ static int add_channel(struct ccw_device *cdev, enum ctcm_channel_types type,
1379 } else 1379 } else
1380 ccw_num = 8; 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 if (ch->ccw == NULL) 1383 if (ch->ccw == NULL)
1384 goto nomem_return; 1384 goto nomem_return;
1385 1385
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 9f28b6f2efc4..8e1474f1ffac 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -374,9 +374,10 @@ static int qeth_alloc_cq(struct qeth_card *card)
374 } 374 }
375 card->qdio.no_in_queues = 2; 375 card->qdio.no_in_queues = 2;
376 card->qdio.out_bufstates = 376 card->qdio.out_bufstates =
377 kzalloc(card->qdio.no_out_queues * 377 kcalloc(card->qdio.no_out_queues *
378 QDIO_MAX_BUFFERS_PER_Q * 378 QDIO_MAX_BUFFERS_PER_Q,
379 sizeof(struct qdio_outbuf_state), GFP_KERNEL); 379 sizeof(struct qdio_outbuf_state),
380 GFP_KERNEL);
380 outbuf_states = card->qdio.out_bufstates; 381 outbuf_states = card->qdio.out_bufstates;
381 if (outbuf_states == NULL) { 382 if (outbuf_states == NULL) {
382 rc = -1; 383 rc = -1;
@@ -2538,8 +2539,9 @@ static int qeth_alloc_qdio_buffers(struct qeth_card *card)
2538 2539
2539 /* outbound */ 2540 /* outbound */
2540 card->qdio.out_qs = 2541 card->qdio.out_qs =
2541 kzalloc(card->qdio.no_out_queues * 2542 kcalloc(card->qdio.no_out_queues,
2542 sizeof(struct qeth_qdio_out_q *), GFP_KERNEL); 2543 sizeof(struct qeth_qdio_out_q *),
2544 GFP_KERNEL);
2543 if (!card->qdio.out_qs) 2545 if (!card->qdio.out_qs)
2544 goto out_freepool; 2546 goto out_freepool;
2545 for (i = 0; i < card->qdio.no_out_queues; ++i) { 2547 for (i = 0; i < card->qdio.no_out_queues; ++i) {
@@ -4963,8 +4965,8 @@ static int qeth_qdio_establish(struct qeth_card *card)
4963 4965
4964 QETH_DBF_TEXT(SETUP, 2, "qdioest"); 4966 QETH_DBF_TEXT(SETUP, 2, "qdioest");
4965 4967
4966 qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q * sizeof(char), 4968 qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q,
4967 GFP_KERNEL); 4969 GFP_KERNEL);
4968 if (!qib_param_field) { 4970 if (!qib_param_field) {
4969 rc = -ENOMEM; 4971 rc = -ENOMEM;
4970 goto out_free_nothing; 4972 goto out_free_nothing;
@@ -4973,8 +4975,8 @@ static int qeth_qdio_establish(struct qeth_card *card)
4973 qeth_create_qib_param_field(card, qib_param_field); 4975 qeth_create_qib_param_field(card, qib_param_field);
4974 qeth_create_qib_param_field_blkt(card, qib_param_field); 4976 qeth_create_qib_param_field_blkt(card, qib_param_field);
4975 4977
4976 in_sbal_ptrs = kzalloc(card->qdio.no_in_queues * 4978 in_sbal_ptrs = kcalloc(card->qdio.no_in_queues * QDIO_MAX_BUFFERS_PER_Q,
4977 QDIO_MAX_BUFFERS_PER_Q * sizeof(void *), 4979 sizeof(void *),
4978 GFP_KERNEL); 4980 GFP_KERNEL);
4979 if (!in_sbal_ptrs) { 4981 if (!in_sbal_ptrs) {
4980 rc = -ENOMEM; 4982 rc = -ENOMEM;
@@ -4985,7 +4987,7 @@ static int qeth_qdio_establish(struct qeth_card *card)
4985 virt_to_phys(card->qdio.in_q->bufs[i].buffer); 4987 virt_to_phys(card->qdio.in_q->bufs[i].buffer);
4986 } 4988 }
4987 4989
4988 queue_start_poll = kzalloc(sizeof(void *) * card->qdio.no_in_queues, 4990 queue_start_poll = kcalloc(card->qdio.no_in_queues, sizeof(void *),
4989 GFP_KERNEL); 4991 GFP_KERNEL);
4990 if (!queue_start_poll) { 4992 if (!queue_start_poll) {
4991 rc = -ENOMEM; 4993 rc = -ENOMEM;
@@ -4997,8 +4999,9 @@ static int qeth_qdio_establish(struct qeth_card *card)
4997 qeth_qdio_establish_cq(card, in_sbal_ptrs, queue_start_poll); 4999 qeth_qdio_establish_cq(card, in_sbal_ptrs, queue_start_poll);
4998 5000
4999 out_sbal_ptrs = 5001 out_sbal_ptrs =
5000 kzalloc(card->qdio.no_out_queues * QDIO_MAX_BUFFERS_PER_Q * 5002 kcalloc(card->qdio.no_out_queues * QDIO_MAX_BUFFERS_PER_Q,
5001 sizeof(void *), GFP_KERNEL); 5003 sizeof(void *),
5004 GFP_KERNEL);
5002 if (!out_sbal_ptrs) { 5005 if (!out_sbal_ptrs) {
5003 rc = -ENOMEM; 5006 rc = -ENOMEM;
5004 goto out_free_queue_start_poll; 5007 goto out_free_queue_start_poll;
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 35380a58d3f0..0d4ffe0ae306 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -2366,7 +2366,7 @@ static int __init blogic_init(void)
2366 if (blogic_probe_options.noprobe) 2366 if (blogic_probe_options.noprobe)
2367 return -ENODEV; 2367 return -ENODEV;
2368 blogic_probeinfo_list = 2368 blogic_probeinfo_list =
2369 kzalloc(BLOGIC_MAX_ADAPTERS * sizeof(struct blogic_probeinfo), 2369 kcalloc(BLOGIC_MAX_ADAPTERS, sizeof(struct blogic_probeinfo),
2370 GFP_KERNEL); 2370 GFP_KERNEL);
2371 if (blogic_probeinfo_list == NULL) { 2371 if (blogic_probeinfo_list == NULL) {
2372 blogic_err("BusLogic: Unable to allocate Probe Info List\n", 2372 blogic_err("BusLogic: Unable to allocate Probe Info List\n",
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index f24fb942065d..04443577d48b 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1681,7 +1681,9 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1681 if (aac_reset_devices || reset_devices) 1681 if (aac_reset_devices || reset_devices)
1682 aac->init_reset = true; 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 if (!aac->fibs) 1687 if (!aac->fibs)
1686 goto out_free_host; 1688 goto out_free_host;
1687 spin_lock_init(&aac->fib_lock); 1689 spin_lock_init(&aac->fib_lock);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c
index e97eceacf522..915a34f141e4 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_core.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_core.c
@@ -4779,8 +4779,8 @@ ahc_init_scbdata(struct ahc_softc *ahc)
4779 SLIST_INIT(&scb_data->sg_maps); 4779 SLIST_INIT(&scb_data->sg_maps);
4780 4780
4781 /* Allocate SCB resources */ 4781 /* Allocate SCB resources */
4782 scb_data->scbarray = kzalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC, 4782 scb_data->scbarray = kcalloc(AHC_SCB_MAX_ALLOC, sizeof(struct scb),
4783 GFP_ATOMIC); 4783 GFP_ATOMIC);
4784 if (scb_data->scbarray == NULL) 4784 if (scb_data->scbarray == NULL)
4785 return (ENOMEM); 4785 return (ENOMEM);
4786 4786
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
index 35e0b5b64e8f..3b8ad55e59de 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -220,8 +220,9 @@ static int asd_init_scbs(struct asd_ha_struct *asd_ha)
220 220
221 /* allocate the index array and bitmap */ 221 /* allocate the index array and bitmap */
222 asd_ha->seq.tc_index_bitmap_bits = asd_ha->hw_prof.max_scbs; 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* 223 asd_ha->seq.tc_index_array = kcalloc(asd_ha->seq.tc_index_bitmap_bits,
224 sizeof(void *), GFP_KERNEL); 224 sizeof(void *),
225 GFP_KERNEL);
225 if (!asd_ha->seq.tc_index_array) 226 if (!asd_ha->seq.tc_index_array)
226 return -ENOMEM; 227 return -ENOMEM;
227 228
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 6c838865ac5a..80e5b283fd81 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -350,7 +350,7 @@ static ssize_t asd_store_update_bios(struct device *dev,
350 int flash_command = FLASH_CMD_NONE; 350 int flash_command = FLASH_CMD_NONE;
351 int err = 0; 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 if (!cmd_ptr) { 355 if (!cmd_ptr) {
356 err = FAIL_OUT_MEMORY; 356 err = FAIL_OUT_MEMORY;
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index d981c16cd611..818d185d63f0 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -2467,8 +2467,8 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba)
2467 2467
2468 /* Allocate memory for wrb_context */ 2468 /* Allocate memory for wrb_context */
2469 phwi_ctrlr = phba->phwi_ctrlr; 2469 phwi_ctrlr = phba->phwi_ctrlr;
2470 phwi_ctrlr->wrb_context = kzalloc(sizeof(struct hwi_wrb_context) * 2470 phwi_ctrlr->wrb_context = kcalloc(phba->params.cxns_per_ctrl,
2471 phba->params.cxns_per_ctrl, 2471 sizeof(struct hwi_wrb_context),
2472 GFP_KERNEL); 2472 GFP_KERNEL);
2473 if (!phwi_ctrlr->wrb_context) { 2473 if (!phwi_ctrlr->wrb_context) {
2474 kfree(phba->phwi_ctrlr); 2474 kfree(phba->phwi_ctrlr);
@@ -2621,8 +2621,8 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
2621 2621
2622 /* Allocate memory for WRBQ */ 2622 /* Allocate memory for WRBQ */
2623 phwi_ctxt = phwi_ctrlr->phwi_ctxt; 2623 phwi_ctxt = phwi_ctrlr->phwi_ctxt;
2624 phwi_ctxt->be_wrbq = kzalloc(sizeof(struct be_queue_info) * 2624 phwi_ctxt->be_wrbq = kcalloc(phba->params.cxns_per_ctrl,
2625 phba->params.cxns_per_ctrl, 2625 sizeof(struct be_queue_info),
2626 GFP_KERNEL); 2626 GFP_KERNEL);
2627 if (!phwi_ctxt->be_wrbq) { 2627 if (!phwi_ctxt->be_wrbq) {
2628 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 2628 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
@@ -2633,16 +2633,18 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
2633 for (index = 0; index < phba->params.cxns_per_ctrl; index++) { 2633 for (index = 0; index < phba->params.cxns_per_ctrl; index++) {
2634 pwrb_context = &phwi_ctrlr->wrb_context[index]; 2634 pwrb_context = &phwi_ctrlr->wrb_context[index];
2635 pwrb_context->pwrb_handle_base = 2635 pwrb_context->pwrb_handle_base =
2636 kzalloc(sizeof(struct wrb_handle *) * 2636 kcalloc(phba->params.wrbs_per_cxn,
2637 phba->params.wrbs_per_cxn, GFP_KERNEL); 2637 sizeof(struct wrb_handle *),
2638 GFP_KERNEL);
2638 if (!pwrb_context->pwrb_handle_base) { 2639 if (!pwrb_context->pwrb_handle_base) {
2639 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 2640 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2640 "BM_%d : Mem Alloc Failed. Failing to load\n"); 2641 "BM_%d : Mem Alloc Failed. Failing to load\n");
2641 goto init_wrb_hndl_failed; 2642 goto init_wrb_hndl_failed;
2642 } 2643 }
2643 pwrb_context->pwrb_handle_basestd = 2644 pwrb_context->pwrb_handle_basestd =
2644 kzalloc(sizeof(struct wrb_handle *) * 2645 kcalloc(phba->params.wrbs_per_cxn,
2645 phba->params.wrbs_per_cxn, GFP_KERNEL); 2646 sizeof(struct wrb_handle *),
2647 GFP_KERNEL);
2646 if (!pwrb_context->pwrb_handle_basestd) { 2648 if (!pwrb_context->pwrb_handle_basestd) {
2647 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 2649 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
2648 "BM_%d : Mem Alloc Failed. Failing to load\n"); 2650 "BM_%d : Mem Alloc Failed. Failing to load\n");
@@ -3896,18 +3898,18 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
3896 mem_descr_sglh = phba->init_mem; 3898 mem_descr_sglh = phba->init_mem;
3897 mem_descr_sglh += HWI_MEM_SGLH; 3899 mem_descr_sglh += HWI_MEM_SGLH;
3898 if (1 == mem_descr_sglh->num_elements) { 3900 if (1 == mem_descr_sglh->num_elements) {
3899 phba->io_sgl_hndl_base = kzalloc(sizeof(struct sgl_handle *) * 3901 phba->io_sgl_hndl_base = kcalloc(phba->params.ios_per_ctrl,
3900 phba->params.ios_per_ctrl, 3902 sizeof(struct sgl_handle *),
3901 GFP_KERNEL); 3903 GFP_KERNEL);
3902 if (!phba->io_sgl_hndl_base) { 3904 if (!phba->io_sgl_hndl_base) {
3903 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 3905 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
3904 "BM_%d : Mem Alloc Failed. Failing to load\n"); 3906 "BM_%d : Mem Alloc Failed. Failing to load\n");
3905 return -ENOMEM; 3907 return -ENOMEM;
3906 } 3908 }
3907 phba->eh_sgl_hndl_base = kzalloc(sizeof(struct sgl_handle *) * 3909 phba->eh_sgl_hndl_base =
3908 (phba->params.icds_per_ctrl - 3910 kcalloc(phba->params.icds_per_ctrl -
3909 phba->params.ios_per_ctrl), 3911 phba->params.ios_per_ctrl,
3910 GFP_KERNEL); 3912 sizeof(struct sgl_handle *), GFP_KERNEL);
3911 if (!phba->eh_sgl_hndl_base) { 3913 if (!phba->eh_sgl_hndl_base) {
3912 kfree(phba->io_sgl_hndl_base); 3914 kfree(phba->io_sgl_hndl_base);
3913 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 3915 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
@@ -4034,8 +4036,9 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
4034 phba->cid_array_info[ulp_num] = ptr_cid_info; 4036 phba->cid_array_info[ulp_num] = ptr_cid_info;
4035 } 4037 }
4036 } 4038 }
4037 phba->ep_array = kzalloc(sizeof(struct iscsi_endpoint *) * 4039 phba->ep_array = kcalloc(phba->params.cxns_per_ctrl,
4038 phba->params.cxns_per_ctrl, GFP_KERNEL); 4040 sizeof(struct iscsi_endpoint *),
4041 GFP_KERNEL);
4039 if (!phba->ep_array) { 4042 if (!phba->ep_array) {
4040 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 4043 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4041 "BM_%d : Failed to allocate memory in " 4044 "BM_%d : Failed to allocate memory in "
@@ -4045,8 +4048,9 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
4045 goto free_memory; 4048 goto free_memory;
4046 } 4049 }
4047 4050
4048 phba->conn_table = kzalloc(sizeof(struct beiscsi_conn *) * 4051 phba->conn_table = kcalloc(phba->params.cxns_per_ctrl,
4049 phba->params.cxns_per_ctrl, GFP_KERNEL); 4052 sizeof(struct beiscsi_conn *),
4053 GFP_KERNEL);
4050 if (!phba->conn_table) { 4054 if (!phba->conn_table) {
4051 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, 4055 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
4052 "BM_%d : Failed to allocate memory in" 4056 "BM_%d : Failed to allocate memory in"
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index d4d276c757ea..26b0fa4e90b5 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -927,7 +927,7 @@ bfad_im_num_of_discovered_ports_show(struct device *dev,
927 struct bfa_rport_qualifier_s *rports = NULL; 927 struct bfa_rport_qualifier_s *rports = NULL;
928 unsigned long flags; 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 GFP_ATOMIC); 931 GFP_ATOMIC);
932 if (rports == NULL) 932 if (rports == NULL)
933 return snprintf(buf, PAGE_SIZE, "Failed\n"); 933 return snprintf(buf, PAGE_SIZE, "Failed\n");
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 7c884f881180..5d163ca1b366 100644
--- a/drivers/scsi/bfa/bfad_bsg.c
+++ b/drivers/scsi/bfa/bfad_bsg.c
@@ -3252,8 +3252,9 @@ bfad_fcxp_map_sg(struct bfad_s *bfad, void *payload_kbuf,
3252 struct bfa_sge_s *sg_table; 3252 struct bfa_sge_s *sg_table;
3253 int sge_num = 1; 3253 int sge_num = 1;
3254 3254
3255 buf_base = kzalloc((sizeof(struct bfad_buf_info) + 3255 buf_base = kcalloc(sizeof(struct bfad_buf_info) +
3256 sizeof(struct bfa_sge_s)) * sge_num, GFP_KERNEL); 3256 sizeof(struct bfa_sge_s),
3257 sge_num, GFP_KERNEL);
3257 if (!buf_base) 3258 if (!buf_base)
3258 return NULL; 3259 return NULL;
3259 3260
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 65de1d0578a1..f00045813378 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -1397,7 +1397,7 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic)
1397 hba->next_conn_id = 0; 1397 hba->next_conn_id = 0;
1398 1398
1399 hba->tgt_ofld_list = 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 GFP_KERNEL); 1401 GFP_KERNEL);
1402 if (!hba->tgt_ofld_list) { 1402 if (!hba->tgt_ofld_list) {
1403 printk(KERN_ERR PFX "Unable to allocate tgt offload list\n"); 1403 printk(KERN_ERR PFX "Unable to allocate tgt offload list\n");
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 5a645b8b9af1..350257c13a5b 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -240,15 +240,15 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
240 return NULL; 240 return NULL;
241 } 241 }
242 242
243 cmgr->free_list = kzalloc(sizeof(*cmgr->free_list) * 243 cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list),
244 arr_sz, GFP_KERNEL); 244 GFP_KERNEL);
245 if (!cmgr->free_list) { 245 if (!cmgr->free_list) {
246 printk(KERN_ERR PFX "failed to alloc free_list\n"); 246 printk(KERN_ERR PFX "failed to alloc free_list\n");
247 goto mem_err; 247 goto mem_err;
248 } 248 }
249 249
250 cmgr->free_list_lock = kzalloc(sizeof(*cmgr->free_list_lock) * 250 cmgr->free_list_lock = kcalloc(arr_sz, sizeof(*cmgr->free_list_lock),
251 arr_sz, GFP_KERNEL); 251 GFP_KERNEL);
252 if (!cmgr->free_list_lock) { 252 if (!cmgr->free_list_lock) {
253 printk(KERN_ERR PFX "failed to alloc free_list_lock\n"); 253 printk(KERN_ERR PFX "failed to alloc free_list_lock\n");
254 kfree(cmgr->free_list); 254 kfree(cmgr->free_list);
diff --git a/drivers/scsi/csiostor/csio_wr.c b/drivers/scsi/csiostor/csio_wr.c
index c0a17789752f..faa357b62c61 100644
--- a/drivers/scsi/csiostor/csio_wr.c
+++ b/drivers/scsi/csiostor/csio_wr.c
@@ -276,7 +276,7 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize,
276 q->un.iq.flq_idx = flq_idx; 276 q->un.iq.flq_idx = flq_idx;
277 277
278 flq = wrm->q_arr[q->un.iq.flq_idx]; 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 sizeof(struct csio_dma_buf), 280 sizeof(struct csio_dma_buf),
281 GFP_KERNEL); 281 GFP_KERNEL);
282 if (!flq->un.fl.bufs) { 282 if (!flq->un.fl.bufs) {
@@ -1579,7 +1579,7 @@ csio_wrm_init(struct csio_wrm *wrm, struct csio_hw *hw)
1579 return -EINVAL; 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 if (!wrm->q_arr) 1583 if (!wrm->q_arr)
1584 goto err; 1584 goto err;
1585 1585
diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c
index 9db645dde35e..bbe77db8938d 100644
--- a/drivers/scsi/esas2r/esas2r_init.c
+++ b/drivers/scsi/esas2r/esas2r_init.c
@@ -833,7 +833,7 @@ bool esas2r_init_adapter_struct(struct esas2r_adapter *a,
833 833
834 /* allocate requests for asynchronous events */ 834 /* allocate requests for asynchronous events */
835 a->first_ae_req = 835 a->first_ae_req =
836 kzalloc(num_ae_requests * sizeof(struct esas2r_request), 836 kcalloc(num_ae_requests, sizeof(struct esas2r_request),
837 GFP_KERNEL); 837 GFP_KERNEL);
838 838
839 if (a->first_ae_req == NULL) { 839 if (a->first_ae_req == NULL) {
@@ -843,8 +843,8 @@ bool esas2r_init_adapter_struct(struct esas2r_adapter *a,
843 } 843 }
844 844
845 /* allocate the S/G list memory descriptors */ 845 /* allocate the S/G list memory descriptors */
846 a->sg_list_mds = kzalloc( 846 a->sg_list_mds = kcalloc(num_sg_lists, sizeof(struct esas2r_mem_desc),
847 num_sg_lists * sizeof(struct esas2r_mem_desc), GFP_KERNEL); 847 GFP_KERNEL);
848 848
849 if (a->sg_list_mds == NULL) { 849 if (a->sg_list_mds == NULL) {
850 esas2r_log(ESAS2R_LOG_CRIT, 850 esas2r_log(ESAS2R_LOG_CRIT,
@@ -854,8 +854,9 @@ bool esas2r_init_adapter_struct(struct esas2r_adapter *a,
854 854
855 /* allocate the request table */ 855 /* allocate the request table */
856 a->req_table = 856 a->req_table =
857 kzalloc((num_requests + num_ae_requests + 857 kcalloc(num_requests + num_ae_requests + 1,
858 1) * sizeof(struct esas2r_request *), GFP_KERNEL); 858 sizeof(struct esas2r_request *),
859 GFP_KERNEL);
859 860
860 if (a->req_table == NULL) { 861 if (a->req_table == NULL) {
861 esas2r_log(ESAS2R_LOG_CRIT, 862 esas2r_log(ESAS2R_LOG_CRIT,
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index e6f31fa9ec65..af0e628ff396 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -1923,8 +1923,8 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h,
1923 } 1923 }
1924 spin_unlock_irqrestore(&h->reset_lock, flags); 1924 spin_unlock_irqrestore(&h->reset_lock, flags);
1925 1925
1926 added = kzalloc(sizeof(*added) * HPSA_MAX_DEVICES, GFP_KERNEL); 1926 added = kcalloc(HPSA_MAX_DEVICES, sizeof(*added), GFP_KERNEL);
1927 removed = kzalloc(sizeof(*removed) * HPSA_MAX_DEVICES, GFP_KERNEL); 1927 removed = kcalloc(HPSA_MAX_DEVICES, sizeof(*removed), GFP_KERNEL);
1928 1928
1929 if (!added || !removed) { 1929 if (!added || !removed) {
1930 dev_warn(&h->pdev->dev, "out of memory in " 1930 dev_warn(&h->pdev->dev, "out of memory in "
@@ -2171,7 +2171,7 @@ static int hpsa_allocate_ioaccel2_sg_chain_blocks(struct ctlr_info *h)
2171 return 0; 2171 return 0;
2172 2172
2173 h->ioaccel2_cmd_sg_list = 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 GFP_KERNEL); 2175 GFP_KERNEL);
2176 if (!h->ioaccel2_cmd_sg_list) 2176 if (!h->ioaccel2_cmd_sg_list)
2177 return -ENOMEM; 2177 return -ENOMEM;
@@ -2211,8 +2211,8 @@ static int hpsa_alloc_sg_chain_blocks(struct ctlr_info *h)
2211 if (h->chainsize <= 0) 2211 if (h->chainsize <= 0)
2212 return 0; 2212 return 0;
2213 2213
2214 h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds, 2214 h->cmd_sg_list = kcalloc(h->nr_cmds, sizeof(*h->cmd_sg_list),
2215 GFP_KERNEL); 2215 GFP_KERNEL);
2216 if (!h->cmd_sg_list) 2216 if (!h->cmd_sg_list)
2217 return -ENOMEM; 2217 return -ENOMEM;
2218 2218
@@ -4321,7 +4321,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
4321 bool physical_device; 4321 bool physical_device;
4322 DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS); 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 physdev_list = kzalloc(sizeof(*physdev_list), GFP_KERNEL); 4325 physdev_list = kzalloc(sizeof(*physdev_list), GFP_KERNEL);
4326 logdev_list = kzalloc(sizeof(*logdev_list), GFP_KERNEL); 4326 logdev_list = kzalloc(sizeof(*logdev_list), GFP_KERNEL);
4327 tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL); 4327 tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL);
@@ -6404,7 +6404,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
6404 status = -EINVAL; 6404 status = -EINVAL;
6405 goto cleanup1; 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 if (!buff) { 6408 if (!buff) {
6409 status = -ENOMEM; 6409 status = -ENOMEM;
6410 goto cleanup1; 6410 goto cleanup1;
@@ -7933,9 +7933,9 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h)
7933 7933
7934static int hpsa_alloc_cmd_pool(struct ctlr_info *h) 7934static int hpsa_alloc_cmd_pool(struct ctlr_info *h)
7935{ 7935{
7936 h->cmd_pool_bits = kzalloc( 7936 h->cmd_pool_bits = kcalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG),
7937 DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) * 7937 sizeof(unsigned long),
7938 sizeof(unsigned long), GFP_KERNEL); 7938 GFP_KERNEL);
7939 h->cmd_pool = pci_alloc_consistent(h->pdev, 7939 h->cmd_pool = pci_alloc_consistent(h->pdev,
7940 h->nr_cmds * sizeof(*h->cmd_pool), 7940 h->nr_cmds * sizeof(*h->cmd_pool),
7941 &(h->cmd_pool_dhandle)); 7941 &(h->cmd_pool_dhandle));
@@ -8509,7 +8509,7 @@ static struct ctlr_info *hpda_alloc_ctlr_info(void)
8509 if (!h) 8509 if (!h)
8510 return NULL; 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 if (!h->reply_map) { 8513 if (!h->reply_map) {
8514 kfree(h); 8514 kfree(h);
8515 return NULL; 8515 return NULL;
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 6615ad8754b8..e63785d5df32 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -9713,8 +9713,9 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
9713 int i, rc = -ENOMEM; 9713 int i, rc = -ENOMEM;
9714 9714
9715 ENTER; 9715 ENTER;
9716 ioa_cfg->res_entries = kzalloc(sizeof(struct ipr_resource_entry) * 9716 ioa_cfg->res_entries = kcalloc(ioa_cfg->max_devs_supported,
9717 ioa_cfg->max_devs_supported, GFP_KERNEL); 9717 sizeof(struct ipr_resource_entry),
9718 GFP_KERNEL);
9718 9719
9719 if (!ioa_cfg->res_entries) 9720 if (!ioa_cfg->res_entries)
9720 goto out; 9721 goto out;
@@ -9775,8 +9776,9 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
9775 list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q); 9776 list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q);
9776 } 9777 }
9777 9778
9778 ioa_cfg->trace = kzalloc(sizeof(struct ipr_trace_entry) * 9779 ioa_cfg->trace = kcalloc(IPR_NUM_TRACE_ENTRIES,
9779 IPR_NUM_TRACE_ENTRIES, GFP_KERNEL); 9780 sizeof(struct ipr_trace_entry),
9781 GFP_KERNEL);
9780 9782
9781 if (!ioa_cfg->trace) 9783 if (!ioa_cfg->trace)
9782 goto out_free_hostrcb_dma; 9784 goto out_free_hostrcb_dma;
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 8b7114348def..fadc99cb60df 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -443,7 +443,7 @@ static int sas_expander_discover(struct domain_device *dev)
443 struct expander_device *ex = &dev->ex_dev; 443 struct expander_device *ex = &dev->ex_dev;
444 int res = -ENOMEM; 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 if (!ex->ex_phy) 447 if (!ex->ex_phy)
448 return -ENOMEM; 448 return -ENOMEM;
449 449
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 7ae343b14630..52cae87da0d2 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -5723,8 +5723,9 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
5723 } 5723 }
5724 5724
5725 if (!phba->sli.sli3_ring) 5725 if (!phba->sli.sli3_ring)
5726 phba->sli.sli3_ring = kzalloc(LPFC_SLI3_MAX_RING * 5726 phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING,
5727 sizeof(struct lpfc_sli_ring), GFP_KERNEL); 5727 sizeof(struct lpfc_sli_ring),
5728 GFP_KERNEL);
5728 if (!phba->sli.sli3_ring) 5729 if (!phba->sli.sli3_ring)
5729 return -ENOMEM; 5730 return -ENOMEM;
5730 5731
@@ -6233,7 +6234,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
6233 6234
6234 /* Allocate eligible FCF bmask memory for FCF roundrobin failover */ 6235 /* Allocate eligible FCF bmask memory for FCF roundrobin failover */
6235 longs = (LPFC_SLI4_FCF_TBL_INDX_MAX + BITS_PER_LONG - 1)/BITS_PER_LONG; 6236 longs = (LPFC_SLI4_FCF_TBL_INDX_MAX + BITS_PER_LONG - 1)/BITS_PER_LONG;
6236 phba->fcf.fcf_rr_bmask = kzalloc(longs * sizeof(unsigned long), 6237 phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long),
6237 GFP_KERNEL); 6238 GFP_KERNEL);
6238 if (!phba->fcf.fcf_rr_bmask) { 6239 if (!phba->fcf.fcf_rr_bmask) {
6239 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 6240 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 4b70d53acb72..6f3c00a233ec 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1720,7 +1720,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
1720 - LPFC_IOCBQ_LOOKUP_INCREMENT)) { 1720 - LPFC_IOCBQ_LOOKUP_INCREMENT)) {
1721 new_len = psli->iocbq_lookup_len + LPFC_IOCBQ_LOOKUP_INCREMENT; 1721 new_len = psli->iocbq_lookup_len + LPFC_IOCBQ_LOOKUP_INCREMENT;
1722 spin_unlock_irq(&phba->hbalock); 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 GFP_KERNEL); 1724 GFP_KERNEL);
1725 if (new_arr) { 1725 if (new_arr) {
1726 spin_lock_irq(&phba->hbalock); 1726 spin_lock_irq(&phba->hbalock);
@@ -5142,16 +5142,17 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
5142 */ 5142 */
5143 if ((phba->vpi_bmask == NULL) && (phba->vpi_ids == NULL)) { 5143 if ((phba->vpi_bmask == NULL) && (phba->vpi_ids == NULL)) {
5144 longs = (phba->max_vpi + BITS_PER_LONG) / BITS_PER_LONG; 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 GFP_KERNEL); 5147 GFP_KERNEL);
5147 if (!phba->vpi_bmask) { 5148 if (!phba->vpi_bmask) {
5148 rc = -ENOMEM; 5149 rc = -ENOMEM;
5149 goto lpfc_sli_hba_setup_error; 5150 goto lpfc_sli_hba_setup_error;
5150 } 5151 }
5151 5152
5152 phba->vpi_ids = kzalloc( 5153 phba->vpi_ids = kcalloc(phba->max_vpi + 1,
5153 (phba->max_vpi+1) * sizeof(uint16_t), 5154 sizeof(uint16_t),
5154 GFP_KERNEL); 5155 GFP_KERNEL);
5155 if (!phba->vpi_ids) { 5156 if (!phba->vpi_ids) {
5156 kfree(phba->vpi_bmask); 5157 kfree(phba->vpi_bmask);
5157 rc = -ENOMEM; 5158 rc = -ENOMEM;
@@ -5836,14 +5837,14 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
5836 length = sizeof(struct lpfc_rsrc_blks); 5837 length = sizeof(struct lpfc_rsrc_blks);
5837 switch (type) { 5838 switch (type) {
5838 case LPFC_RSC_TYPE_FCOE_RPI: 5839 case LPFC_RSC_TYPE_FCOE_RPI:
5839 phba->sli4_hba.rpi_bmask = kzalloc(longs * 5840 phba->sli4_hba.rpi_bmask = kcalloc(longs,
5840 sizeof(unsigned long), 5841 sizeof(unsigned long),
5841 GFP_KERNEL); 5842 GFP_KERNEL);
5842 if (unlikely(!phba->sli4_hba.rpi_bmask)) { 5843 if (unlikely(!phba->sli4_hba.rpi_bmask)) {
5843 rc = -ENOMEM; 5844 rc = -ENOMEM;
5844 goto err_exit; 5845 goto err_exit;
5845 } 5846 }
5846 phba->sli4_hba.rpi_ids = kzalloc(rsrc_id_cnt * 5847 phba->sli4_hba.rpi_ids = kcalloc(rsrc_id_cnt,
5847 sizeof(uint16_t), 5848 sizeof(uint16_t),
5848 GFP_KERNEL); 5849 GFP_KERNEL);
5849 if (unlikely(!phba->sli4_hba.rpi_ids)) { 5850 if (unlikely(!phba->sli4_hba.rpi_ids)) {
@@ -5865,15 +5866,13 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
5865 ext_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list; 5866 ext_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list;
5866 break; 5867 break;
5867 case LPFC_RSC_TYPE_FCOE_VPI: 5868 case LPFC_RSC_TYPE_FCOE_VPI:
5868 phba->vpi_bmask = kzalloc(longs * 5869 phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long),
5869 sizeof(unsigned long),
5870 GFP_KERNEL); 5870 GFP_KERNEL);
5871 if (unlikely(!phba->vpi_bmask)) { 5871 if (unlikely(!phba->vpi_bmask)) {
5872 rc = -ENOMEM; 5872 rc = -ENOMEM;
5873 goto err_exit; 5873 goto err_exit;
5874 } 5874 }
5875 phba->vpi_ids = kzalloc(rsrc_id_cnt * 5875 phba->vpi_ids = kcalloc(rsrc_id_cnt, sizeof(uint16_t),
5876 sizeof(uint16_t),
5877 GFP_KERNEL); 5876 GFP_KERNEL);
5878 if (unlikely(!phba->vpi_ids)) { 5877 if (unlikely(!phba->vpi_ids)) {
5879 kfree(phba->vpi_bmask); 5878 kfree(phba->vpi_bmask);
@@ -5887,7 +5886,7 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
5887 ext_blk_list = &phba->lpfc_vpi_blk_list; 5886 ext_blk_list = &phba->lpfc_vpi_blk_list;
5888 break; 5887 break;
5889 case LPFC_RSC_TYPE_FCOE_XRI: 5888 case LPFC_RSC_TYPE_FCOE_XRI:
5890 phba->sli4_hba.xri_bmask = kzalloc(longs * 5889 phba->sli4_hba.xri_bmask = kcalloc(longs,
5891 sizeof(unsigned long), 5890 sizeof(unsigned long),
5892 GFP_KERNEL); 5891 GFP_KERNEL);
5893 if (unlikely(!phba->sli4_hba.xri_bmask)) { 5892 if (unlikely(!phba->sli4_hba.xri_bmask)) {
@@ -5895,7 +5894,7 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
5895 goto err_exit; 5894 goto err_exit;
5896 } 5895 }
5897 phba->sli4_hba.max_cfg_param.xri_used = 0; 5896 phba->sli4_hba.max_cfg_param.xri_used = 0;
5898 phba->sli4_hba.xri_ids = kzalloc(rsrc_id_cnt * 5897 phba->sli4_hba.xri_ids = kcalloc(rsrc_id_cnt,
5899 sizeof(uint16_t), 5898 sizeof(uint16_t),
5900 GFP_KERNEL); 5899 GFP_KERNEL);
5901 if (unlikely(!phba->sli4_hba.xri_ids)) { 5900 if (unlikely(!phba->sli4_hba.xri_ids)) {
@@ -5910,14 +5909,14 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
5910 ext_blk_list = &phba->sli4_hba.lpfc_xri_blk_list; 5909 ext_blk_list = &phba->sli4_hba.lpfc_xri_blk_list;
5911 break; 5910 break;
5912 case LPFC_RSC_TYPE_FCOE_VFI: 5911 case LPFC_RSC_TYPE_FCOE_VFI:
5913 phba->sli4_hba.vfi_bmask = kzalloc(longs * 5912 phba->sli4_hba.vfi_bmask = kcalloc(longs,
5914 sizeof(unsigned long), 5913 sizeof(unsigned long),
5915 GFP_KERNEL); 5914 GFP_KERNEL);
5916 if (unlikely(!phba->sli4_hba.vfi_bmask)) { 5915 if (unlikely(!phba->sli4_hba.vfi_bmask)) {
5917 rc = -ENOMEM; 5916 rc = -ENOMEM;
5918 goto err_exit; 5917 goto err_exit;
5919 } 5918 }
5920 phba->sli4_hba.vfi_ids = kzalloc(rsrc_id_cnt * 5919 phba->sli4_hba.vfi_ids = kcalloc(rsrc_id_cnt,
5921 sizeof(uint16_t), 5920 sizeof(uint16_t),
5922 GFP_KERNEL); 5921 GFP_KERNEL);
5923 if (unlikely(!phba->sli4_hba.vfi_ids)) { 5922 if (unlikely(!phba->sli4_hba.vfi_ids)) {
@@ -6250,15 +6249,14 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
6250 } 6249 }
6251 base = phba->sli4_hba.max_cfg_param.rpi_base; 6250 base = phba->sli4_hba.max_cfg_param.rpi_base;
6252 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; 6251 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
6253 phba->sli4_hba.rpi_bmask = kzalloc(longs * 6252 phba->sli4_hba.rpi_bmask = kcalloc(longs,
6254 sizeof(unsigned long), 6253 sizeof(unsigned long),
6255 GFP_KERNEL); 6254 GFP_KERNEL);
6256 if (unlikely(!phba->sli4_hba.rpi_bmask)) { 6255 if (unlikely(!phba->sli4_hba.rpi_bmask)) {
6257 rc = -ENOMEM; 6256 rc = -ENOMEM;
6258 goto err_exit; 6257 goto err_exit;
6259 } 6258 }
6260 phba->sli4_hba.rpi_ids = kzalloc(count * 6259 phba->sli4_hba.rpi_ids = kcalloc(count, sizeof(uint16_t),
6261 sizeof(uint16_t),
6262 GFP_KERNEL); 6260 GFP_KERNEL);
6263 if (unlikely(!phba->sli4_hba.rpi_ids)) { 6261 if (unlikely(!phba->sli4_hba.rpi_ids)) {
6264 rc = -ENOMEM; 6262 rc = -ENOMEM;
@@ -6279,15 +6277,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
6279 } 6277 }
6280 base = phba->sli4_hba.max_cfg_param.vpi_base; 6278 base = phba->sli4_hba.max_cfg_param.vpi_base;
6281 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; 6279 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
6282 phba->vpi_bmask = kzalloc(longs * 6280 phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long),
6283 sizeof(unsigned long),
6284 GFP_KERNEL); 6281 GFP_KERNEL);
6285 if (unlikely(!phba->vpi_bmask)) { 6282 if (unlikely(!phba->vpi_bmask)) {
6286 rc = -ENOMEM; 6283 rc = -ENOMEM;
6287 goto free_rpi_ids; 6284 goto free_rpi_ids;
6288 } 6285 }
6289 phba->vpi_ids = kzalloc(count * 6286 phba->vpi_ids = kcalloc(count, sizeof(uint16_t),
6290 sizeof(uint16_t),
6291 GFP_KERNEL); 6287 GFP_KERNEL);
6292 if (unlikely(!phba->vpi_ids)) { 6288 if (unlikely(!phba->vpi_ids)) {
6293 rc = -ENOMEM; 6289 rc = -ENOMEM;
@@ -6308,7 +6304,7 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
6308 } 6304 }
6309 base = phba->sli4_hba.max_cfg_param.xri_base; 6305 base = phba->sli4_hba.max_cfg_param.xri_base;
6310 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; 6306 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
6311 phba->sli4_hba.xri_bmask = kzalloc(longs * 6307 phba->sli4_hba.xri_bmask = kcalloc(longs,
6312 sizeof(unsigned long), 6308 sizeof(unsigned long),
6313 GFP_KERNEL); 6309 GFP_KERNEL);
6314 if (unlikely(!phba->sli4_hba.xri_bmask)) { 6310 if (unlikely(!phba->sli4_hba.xri_bmask)) {
@@ -6316,8 +6312,7 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
6316 goto free_vpi_ids; 6312 goto free_vpi_ids;
6317 } 6313 }
6318 phba->sli4_hba.max_cfg_param.xri_used = 0; 6314 phba->sli4_hba.max_cfg_param.xri_used = 0;
6319 phba->sli4_hba.xri_ids = kzalloc(count * 6315 phba->sli4_hba.xri_ids = kcalloc(count, sizeof(uint16_t),
6320 sizeof(uint16_t),
6321 GFP_KERNEL); 6316 GFP_KERNEL);
6322 if (unlikely(!phba->sli4_hba.xri_ids)) { 6317 if (unlikely(!phba->sli4_hba.xri_ids)) {
6323 rc = -ENOMEM; 6318 rc = -ENOMEM;
@@ -6338,15 +6333,14 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
6338 } 6333 }
6339 base = phba->sli4_hba.max_cfg_param.vfi_base; 6334 base = phba->sli4_hba.max_cfg_param.vfi_base;
6340 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; 6335 longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
6341 phba->sli4_hba.vfi_bmask = kzalloc(longs * 6336 phba->sli4_hba.vfi_bmask = kcalloc(longs,
6342 sizeof(unsigned long), 6337 sizeof(unsigned long),
6343 GFP_KERNEL); 6338 GFP_KERNEL);
6344 if (unlikely(!phba->sli4_hba.vfi_bmask)) { 6339 if (unlikely(!phba->sli4_hba.vfi_bmask)) {
6345 rc = -ENOMEM; 6340 rc = -ENOMEM;
6346 goto free_xri_ids; 6341 goto free_xri_ids;
6347 } 6342 }
6348 phba->sli4_hba.vfi_ids = kzalloc(count * 6343 phba->sli4_hba.vfi_ids = kcalloc(count, sizeof(uint16_t),
6349 sizeof(uint16_t),
6350 GFP_KERNEL); 6344 GFP_KERNEL);
6351 if (unlikely(!phba->sli4_hba.vfi_ids)) { 6345 if (unlikely(!phba->sli4_hba.vfi_ids)) {
6352 rc = -ENOMEM; 6346 rc = -ENOMEM;
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
index c9d33b1268cb..81bc12dedf41 100644
--- a/drivers/scsi/lpfc/lpfc_vport.c
+++ b/drivers/scsi/lpfc/lpfc_vport.c
@@ -840,7 +840,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba)
840 struct lpfc_vport *port_iterator; 840 struct lpfc_vport *port_iterator;
841 struct lpfc_vport **vports; 841 struct lpfc_vport **vports;
842 int index = 0; 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 GFP_KERNEL); 844 GFP_KERNEL);
845 if (vports == NULL) 845 if (vports == NULL)
846 return NULL; 846 return NULL;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index c5d0c4bd71d2..71d97573a667 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5419,9 +5419,9 @@ static int megasas_init_fw(struct megasas_instance *instance)
5419 /* stream detection initialization */ 5419 /* stream detection initialization */
5420 if (instance->adapter_type == VENTURA_SERIES) { 5420 if (instance->adapter_type == VENTURA_SERIES) {
5421 fusion->stream_detect_by_ld = 5421 fusion->stream_detect_by_ld =
5422 kzalloc(sizeof(struct LD_STREAM_DETECT *) 5422 kcalloc(MAX_LOGICAL_DRIVES_EXT,
5423 * MAX_LOGICAL_DRIVES_EXT, 5423 sizeof(struct LD_STREAM_DETECT *),
5424 GFP_KERNEL); 5424 GFP_KERNEL);
5425 if (!fusion->stream_detect_by_ld) { 5425 if (!fusion->stream_detect_by_ld) {
5426 dev_err(&instance->pdev->dev, 5426 dev_err(&instance->pdev->dev,
5427 "unable to allocate stream detection for pool of LDs\n"); 5427 "unable to allocate stream detection for pool of LDs\n");
@@ -6139,7 +6139,7 @@ static inline int megasas_alloc_mfi_ctrl_mem(struct megasas_instance *instance)
6139 */ 6139 */
6140static int megasas_alloc_ctrl_mem(struct megasas_instance *instance) 6140static 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 GFP_KERNEL); 6143 GFP_KERNEL);
6144 if (!instance->reply_map) 6144 if (!instance->reply_map)
6145 return -ENOMEM; 6145 return -ENOMEM;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 98a7a090b75e..b965d4fe18ef 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -487,7 +487,7 @@ megasas_alloc_cmdlist_fusion(struct megasas_instance *instance)
487 * commands. 487 * commands.
488 */ 488 */
489 fusion->cmd_list = 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 GFP_KERNEL); 491 GFP_KERNEL);
492 if (!fusion->cmd_list) { 492 if (!fusion->cmd_list) {
493 dev_err(&instance->pdev->dev, 493 dev_err(&instance->pdev->dev,
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 773c4bfeb0f8..928ee4e89813 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -381,7 +381,7 @@ static int osst_execute(struct osst_request *SRpnt, const unsigned char *cmd,
381 struct scatterlist *sg, *sgl = (struct scatterlist *)buffer; 381 struct scatterlist *sg, *sgl = (struct scatterlist *)buffer;
382 int i; 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 if (!pages) 385 if (!pages)
386 goto free_req; 386 goto free_req;
387 387
diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
index 596f3ff965f5..d193961ea82f 100644
--- a/drivers/scsi/pm8001/pm8001_ctl.c
+++ b/drivers/scsi/pm8001/pm8001_ctl.c
@@ -705,7 +705,7 @@ static ssize_t pm8001_store_update_fw(struct device *cdev,
705 return -EINPROGRESS; 705 return -EINPROGRESS;
706 pm8001_ha->fw_status = FLASH_IN_PROGRESS; 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 if (!cmd_ptr) { 709 if (!cmd_ptr) {
710 pm8001_ha->fw_status = FAIL_OUT_MEMORY; 710 pm8001_ha->fw_status = FAIL_OUT_MEMORY;
711 return -ENOMEM; 711 return -ENOMEM;
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 95530393872d..4e86994e10e8 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -4873,8 +4873,9 @@ static int pmcraid_allocate_config_buffers(struct pmcraid_instance *pinstance)
4873 int i; 4873 int i;
4874 4874
4875 pinstance->res_entries = 4875 pinstance->res_entries =
4876 kzalloc(sizeof(struct pmcraid_resource_entry) * 4876 kcalloc(PMCRAID_MAX_RESOURCES,
4877 PMCRAID_MAX_RESOURCES, GFP_KERNEL); 4877 sizeof(struct pmcraid_resource_entry),
4878 GFP_KERNEL);
4878 4879
4879 if (NULL == pinstance->res_entries) { 4880 if (NULL == pinstance->res_entries) {
4880 pmcraid_err("failed to allocate memory for resource table\n"); 4881 pmcraid_err("failed to allocate memory for resource table\n");
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index 32ee7f62fef9..cf274a79e77a 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -524,7 +524,7 @@ static int qedi_init_id_tbl(struct qedi_portid_tbl *id_tbl, u16 size,
524 id_tbl->max = size; 524 id_tbl->max = size;
525 id_tbl->next = next; 525 id_tbl->next = next;
526 spin_lock_init(&id_tbl->lock); 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 if (!id_tbl->table) 528 if (!id_tbl->table)
529 return -ENOMEM; 529 return -ENOMEM;
530 530
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 1aa3720ea2ed..fbbb328c64d5 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3089,8 +3089,9 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
3089 req->num_outstanding_cmds = ha->cur_fw_iocb_count; 3089 req->num_outstanding_cmds = ha->cur_fw_iocb_count;
3090 } 3090 }
3091 3091
3092 req->outstanding_cmds = kzalloc(sizeof(srb_t *) * 3092 req->outstanding_cmds = kcalloc(req->num_outstanding_cmds,
3093 req->num_outstanding_cmds, GFP_KERNEL); 3093 sizeof(srb_t *),
3094 GFP_KERNEL);
3094 3095
3095 if (!req->outstanding_cmds) { 3096 if (!req->outstanding_cmds) {
3096 /* 3097 /*
@@ -3098,8 +3099,9 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
3098 * initialization. 3099 * initialization.
3099 */ 3100 */
3100 req->num_outstanding_cmds = MIN_OUTSTANDING_COMMANDS; 3101 req->num_outstanding_cmds = MIN_OUTSTANDING_COMMANDS;
3101 req->outstanding_cmds = kzalloc(sizeof(srb_t *) * 3102 req->outstanding_cmds = kcalloc(req->num_outstanding_cmds,
3102 req->num_outstanding_cmds, GFP_KERNEL); 3103 sizeof(srb_t *),
3104 GFP_KERNEL);
3103 3105
3104 if (!req->outstanding_cmds) { 3106 if (!req->outstanding_cmds) {
3105 ql_log(ql_log_fatal, NULL, 0x0126, 3107 ql_log(ql_log_fatal, NULL, 0x0126,
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index a3dc83f9444d..d14d3911516d 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3434,8 +3434,9 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
3434 "Adjusted Max no of queues pairs: %d.\n", ha->max_qpairs); 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) * 3437 ha->msix_entries = kcalloc(ha->msix_count,
3438 ha->msix_count, GFP_KERNEL); 3438 sizeof(struct qla_msix_entry),
3439 GFP_KERNEL);
3439 if (!ha->msix_entries) { 3440 if (!ha->msix_entries) {
3440 ql_log(ql_log_fatal, vha, 0x00c8, 3441 ql_log(ql_log_fatal, vha, 0x00c8,
3441 "Failed to allocate memory for ha->msix_entries.\n"); 3442 "Failed to allocate memory for ha->msix_entries.\n");
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 817c18a8e84d..e881fce7477a 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -410,7 +410,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
410 struct rsp_que *rsp) 410 struct rsp_que *rsp)
411{ 411{
412 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); 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 GFP_KERNEL); 414 GFP_KERNEL);
415 if (!ha->req_q_map) { 415 if (!ha->req_q_map) {
416 ql_log(ql_log_fatal, vha, 0x003b, 416 ql_log(ql_log_fatal, vha, 0x003b,
@@ -418,7 +418,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
418 goto fail_req_map; 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 GFP_KERNEL); 422 GFP_KERNEL);
423 if (!ha->rsp_q_map) { 423 if (!ha->rsp_q_map) {
424 ql_log(ql_log_fatal, vha, 0x003c, 424 ql_log(ql_log_fatal, vha, 0x003c,
@@ -4045,8 +4045,9 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
4045 (*rsp)->ring); 4045 (*rsp)->ring);
4046 /* Allocate memory for NVRAM data for vports */ 4046 /* Allocate memory for NVRAM data for vports */
4047 if (ha->nvram_npiv_size) { 4047 if (ha->nvram_npiv_size) {
4048 ha->npiv_info = kzalloc(sizeof(struct qla_npiv_entry) * 4048 ha->npiv_info = kcalloc(ha->nvram_npiv_size,
4049 ha->nvram_npiv_size, GFP_KERNEL); 4049 sizeof(struct qla_npiv_entry),
4050 GFP_KERNEL);
4050 if (!ha->npiv_info) { 4051 if (!ha->npiv_info) {
4051 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d, 4052 ql_log_pci(ql_log_fatal, ha->pdev, 0x002d,
4052 "Failed to allocate memory for npiv_info.\n"); 4053 "Failed to allocate memory for npiv_info.\n");
@@ -4080,8 +4081,9 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
4080 INIT_LIST_HEAD(&ha->vp_list); 4081 INIT_LIST_HEAD(&ha->vp_list);
4081 4082
4082 /* Allocate memory for our loop_id bitmap */ 4083 /* Allocate memory for our loop_id bitmap */
4083 ha->loop_id_map = kzalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE) * sizeof(long), 4084 ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE),
4084 GFP_KERNEL); 4085 sizeof(long),
4086 GFP_KERNEL);
4085 if (!ha->loop_id_map) 4087 if (!ha->loop_id_map)
4086 goto fail_loop_id_map; 4088 goto fail_loop_id_map;
4087 else { 4089 else {
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index b85c833099ff..0fea2e2326be 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -6248,8 +6248,9 @@ int qlt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha)
6248 return -ENOMEM; 6248 return -ENOMEM;
6249 } 6249 }
6250 6250
6251 tgt->qphints = kzalloc((ha->max_qpairs + 1) * 6251 tgt->qphints = kcalloc(ha->max_qpairs + 1,
6252 sizeof(struct qla_qpair_hint), GFP_KERNEL); 6252 sizeof(struct qla_qpair_hint),
6253 GFP_KERNEL);
6253 if (!tgt->qphints) { 6254 if (!tgt->qphints) {
6254 kfree(tgt); 6255 kfree(tgt);
6255 ql_log(ql_log_warn, base_vha, 0x0197, 6256 ql_log(ql_log_warn, base_vha, 0x0197,
@@ -7089,8 +7090,9 @@ qlt_mem_alloc(struct qla_hw_data *ha)
7089 if (!QLA_TGT_MODE_ENABLED()) 7090 if (!QLA_TGT_MODE_ENABLED())
7090 return 0; 7091 return 0;
7091 7092
7092 ha->tgt.tgt_vp_map = kzalloc(sizeof(struct qla_tgt_vp_map) * 7093 ha->tgt.tgt_vp_map = kcalloc(MAX_MULTI_ID_FABRIC,
7093 MAX_MULTI_ID_FABRIC, GFP_KERNEL); 7094 sizeof(struct qla_tgt_vp_map),
7095 GFP_KERNEL);
7094 if (!ha->tgt.tgt_vp_map) 7096 if (!ha->tgt.tgt_vp_map)
7095 return -ENOMEM; 7097 return -ENOMEM;
7096 7098
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 656c98e116a9..798a6afa4cbf 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3450,7 +3450,7 @@ static int resp_comp_write(struct scsi_cmnd *scp,
3450 return check_condition_result; 3450 return check_condition_result;
3451 } 3451 }
3452 dnum = 2 * num; 3452 dnum = 2 * num;
3453 arr = kzalloc(dnum * lb_size, GFP_ATOMIC); 3453 arr = kcalloc(lb_size, dnum, GFP_ATOMIC);
3454 if (NULL == arr) { 3454 if (NULL == arr) {
3455 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC, 3455 mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,
3456 INSUFF_RES_ASCQ); 3456 INSUFF_RES_ASCQ);
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 62f04c0511cf..0fc39224ce1e 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -747,7 +747,7 @@ static int ses_intf_add(struct device *cdev,
747 buf = NULL; 747 buf = NULL;
748 } 748 }
749page2_not_supported: 749page2_not_supported:
750 scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL); 750 scomp = kcalloc(components, sizeof(struct ses_component), GFP_KERNEL);
751 if (!scomp) 751 if (!scomp)
752 goto err_free; 752 goto err_free;
753 753
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 573763908562..53ae52dbff84 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1045,7 +1045,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
1045 else { 1045 else {
1046 sg_req_info_t *rinfo; 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 GFP_KERNEL); 1049 GFP_KERNEL);
1050 if (!rinfo) 1050 if (!rinfo)
1051 return -ENOMEM; 1051 return -ENOMEM;
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 8332f958cc42..b78d20b74ed8 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -4252,8 +4252,9 @@ static int pqi_alloc_io_resources(struct pqi_ctrl_info *ctrl_info)
4252 struct device *dev; 4252 struct device *dev;
4253 struct pqi_io_request *io_request; 4253 struct pqi_io_request *io_request;
4254 4254
4255 ctrl_info->io_request_pool = kzalloc(ctrl_info->max_io_slots * 4255 ctrl_info->io_request_pool =
4256 sizeof(ctrl_info->io_request_pool[0]), GFP_KERNEL); 4256 kcalloc(ctrl_info->max_io_slots,
4257 sizeof(ctrl_info->io_request_pool[0]), GFP_KERNEL);
4257 4258
4258 if (!ctrl_info->io_request_pool) { 4259 if (!ctrl_info->io_request_pool) {
4259 dev_err(&ctrl_info->pci_dev->dev, 4260 dev_err(&ctrl_info->pci_dev->dev,
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index c16e4de3a03f..50c66ccc4b41 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3888,7 +3888,7 @@ static struct st_buffer *new_tape_buffer(int need_dma, int max_sg)
3888 tb->dma = need_dma; 3888 tb->dma = need_dma;
3889 tb->buffer_size = 0; 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 GFP_KERNEL); 3892 GFP_KERNEL);
3893 if (!tb->reserved_pages) { 3893 if (!tb->reserved_pages) {
3894 kfree(tb); 3894 kfree(tb);
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index 7442bc130055..eeb028b9cdb3 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -249,7 +249,7 @@ static int __init sh_clk_div_register_ops(struct clk *clks, int nr,
249 int k; 249 int k;
250 250
251 freq_table_size *= (nr_divs + 1); 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 if (!freq_table) { 253 if (!freq_table) {
254 pr_err("%s: unable to alloc memory\n", __func__); 254 pr_err("%s: unable to alloc memory\n", __func__);
255 return -ENOMEM; 255 return -ENOMEM;
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 8e72bcbd3d6d..46f0f322d4d8 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -203,7 +203,7 @@ int __init register_intc_controller(struct intc_desc *desc)
203 203
204 if (desc->num_resources) { 204 if (desc->num_resources) {
205 d->nr_windows = desc->num_resources; 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 GFP_NOWAIT); 207 GFP_NOWAIT);
208 if (!d->window) 208 if (!d->window)
209 goto err1; 209 goto err1;
@@ -230,12 +230,12 @@ int __init register_intc_controller(struct intc_desc *desc)
230 d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0; 230 d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0;
231 d->nr_reg += hw->subgroups ? hw->nr_subgroups : 0; 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 if (!d->reg) 234 if (!d->reg)
235 goto err2; 235 goto err2;
236 236
237#ifdef CONFIG_SMP 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 if (!d->smp) 239 if (!d->smp)
240 goto err3; 240 goto err3;
241#endif 241#endif
@@ -253,7 +253,7 @@ int __init register_intc_controller(struct intc_desc *desc)
253 } 253 }
254 254
255 if (hw->prio_regs) { 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 GFP_NOWAIT); 257 GFP_NOWAIT);
258 if (!d->prio) 258 if (!d->prio)
259 goto err4; 259 goto err4;
@@ -269,7 +269,7 @@ int __init register_intc_controller(struct intc_desc *desc)
269 } 269 }
270 270
271 if (hw->sense_regs) { 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 GFP_NOWAIT); 273 GFP_NOWAIT);
274 if (!d->sense) 274 if (!d->sense)
275 goto err5; 275 goto err5;
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039d812c..2e45988d1259 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -161,7 +161,7 @@ int maple_add_packet(struct maple_device *mdev, u32 function, u32 command,
161 void *sendbuf = NULL; 161 void *sendbuf = NULL;
162 162
163 if (length) { 163 if (length) {
164 sendbuf = kzalloc(length * 4, GFP_KERNEL); 164 sendbuf = kcalloc(length, 4, GFP_KERNEL);
165 if (!sendbuf) { 165 if (!sendbuf) {
166 ret = -ENOMEM; 166 ret = -ENOMEM;
167 goto out; 167 goto out;
diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c
index bb36a8fbc9b1..db1f5135846a 100644
--- a/drivers/slimbus/qcom-ctrl.c
+++ b/drivers/slimbus/qcom-ctrl.c
@@ -540,7 +540,7 @@ static int qcom_slim_probe(struct platform_device *pdev)
540 ctrl->tx.sl_sz = SLIM_MSGQ_BUF_LEN; 540 ctrl->tx.sl_sz = SLIM_MSGQ_BUF_LEN;
541 ctrl->rx.n = QCOM_RX_MSGS; 541 ctrl->rx.n = QCOM_RX_MSGS;
542 ctrl->rx.sl_sz = SLIM_MSGQ_BUF_LEN; 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 GFP_KERNEL); 544 GFP_KERNEL);
545 if (!ctrl->wr_comp) 545 if (!ctrl->wr_comp)
546 return -ENOMEM; 546 return -ENOMEM;
diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index 2d9ab2620b82..04b1a0950387 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -143,7 +143,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev,
143 if (!max_maps) 143 if (!max_maps)
144 return max_maps; 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 if (!*map) 147 if (!*map)
148 return -ENOMEM; 148 return -ENOMEM;
149 149
diff --git a/drivers/staging/rtlwifi/efuse.c b/drivers/staging/rtlwifi/efuse.c
index d7c7d146a84d..1dc71455f270 100644
--- a/drivers/staging/rtlwifi/efuse.c
+++ b/drivers/staging/rtlwifi/efuse.c
@@ -237,8 +237,8 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
237 } 237 }
238 238
239 /* allocate memory for efuse_tbl and efuse_word */ 239 /* allocate memory for efuse_tbl and efuse_word */
240 efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] * 240 efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE],
241 sizeof(u8), GFP_ATOMIC); 241 GFP_ATOMIC);
242 if (!efuse_tbl) 242 if (!efuse_tbl)
243 return; 243 return;
244 efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC); 244 efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC);
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index 167e98f8688e..4fc521c51c0e 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -865,7 +865,7 @@ static void do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp,
865 if (cmdrsp->scsi.no_disk_result == 0) 865 if (cmdrsp->scsi.no_disk_result == 0)
866 return; 866 return;
867 867
868 buf = kzalloc(sizeof(char) * 36, GFP_KERNEL); 868 buf = kzalloc(36, GFP_KERNEL);
869 if (!buf) 869 if (!buf)
870 return; 870 return;
871 871
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index f0e8f0f4ccb4..efe8214f2df3 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -250,7 +250,7 @@ int transport_alloc_session_tags(struct se_session *se_sess,
250{ 250{
251 int rc; 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 GFP_KERNEL | __GFP_NOWARN | __GFP_RETRY_MAYFAIL); 254 GFP_KERNEL | __GFP_NOWARN | __GFP_RETRY_MAYFAIL);
255 if (!se_sess->sess_cmd_map) { 255 if (!se_sess->sess_cmd_map) {
256 se_sess->sess_cmd_map = vzalloc(tag_num * tag_size); 256 se_sess->sess_cmd_map = vzalloc(tag_num * tag_size);
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 94b183efd236..7f96dfa32b9c 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1717,8 +1717,9 @@ static int tcmu_configure_device(struct se_device *dev)
1717 1717
1718 info = &udev->uio_info; 1718 info = &udev->uio_info;
1719 1719
1720 udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) * 1720 udev->data_bitmap = kcalloc(BITS_TO_LONGS(udev->max_blocks),
1721 sizeof(unsigned long), GFP_KERNEL); 1721 sizeof(unsigned long),
1722 GFP_KERNEL);
1722 if (!udev->data_bitmap) { 1723 if (!udev->data_bitmap) {
1723 ret = -ENOMEM; 1724 ret = -ENOMEM;
1724 goto err_bitmap_alloc; 1725 goto err_bitmap_alloc;
diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
index c719167e9f28..45e7e5cbdffb 100644
--- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
+++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
@@ -96,7 +96,7 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
96 } 96 }
97 97
98 *trt_count = p->package.count; 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 if (!trts) { 100 if (!trts) {
101 result = -ENOMEM; 101 result = -ENOMEM;
102 goto end; 102 goto end;
@@ -178,7 +178,7 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp,
178 178
179 /* ignore p->package.elements[0], as this is _ART Revision field */ 179 /* ignore p->package.elements[0], as this is _ART Revision field */
180 *art_count = p->package.count - 1; 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 if (!arts) { 182 if (!arts) {
183 result = -ENOMEM; 183 result = -ENOMEM;
184 goto end; 184 goto end;
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
index 145a5c53ff5c..953c83967ceb 100644
--- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
+++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
@@ -239,9 +239,10 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
239 if (ACPI_FAILURE(status)) 239 if (ACPI_FAILURE(status))
240 trip_cnt = 0; 240 trip_cnt = 0;
241 else { 241 else {
242 int34x_thermal_zone->aux_trips = kzalloc( 242 int34x_thermal_zone->aux_trips =
243 sizeof(*int34x_thermal_zone->aux_trips) * 243 kcalloc(trip_cnt,
244 trip_cnt, GFP_KERNEL); 244 sizeof(*int34x_thermal_zone->aux_trips),
245 GFP_KERNEL);
245 if (!int34x_thermal_zone->aux_trips) { 246 if (!int34x_thermal_zone->aux_trips) {
246 ret = -ENOMEM; 247 ret = -ENOMEM;
247 goto err_trip_alloc; 248 goto err_trip_alloc;
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index e09f0354a4bc..5798420ac29c 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -870,7 +870,7 @@ __init *thermal_of_build_thermal_zone(struct device_node *np)
870 if (tz->ntrips == 0) /* must have at least one child */ 870 if (tz->ntrips == 0) /* must have at least one child */
871 goto finish; 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 if (!tz->trips) { 874 if (!tz->trips) {
875 ret = -ENOMEM; 875 ret = -ENOMEM;
876 goto free_tz; 876 goto free_tz;
@@ -896,7 +896,7 @@ __init *thermal_of_build_thermal_zone(struct device_node *np)
896 if (tz->num_tbps == 0) 896 if (tz->num_tbps == 0)
897 goto finish; 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 if (!tz->tbps) { 900 if (!tz->tbps) {
901 ret = -ENOMEM; 901 ret = -ENOMEM;
902 goto free_trips; 902 goto free_trips;
diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c
index 1a6c88b10a39..1ef937d799e4 100644
--- a/drivers/thermal/x86_pkg_temp_thermal.c
+++ b/drivers/thermal/x86_pkg_temp_thermal.c
@@ -516,7 +516,8 @@ static int __init pkg_temp_thermal_init(void)
516 return -ENODEV; 516 return -ENODEV;
517 517
518 max_packages = topology_max_packages(); 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 if (!packages) 521 if (!packages)
521 return -ENOMEM; 522 return -ENOMEM;
522 523
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index 47ac56817c43..eea4049b5dcc 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -754,7 +754,7 @@ static int __init ehv_bc_init(void)
754 * array, then you can use pointer math (e.g. "bc - bcs") to get its 754 * array, then you can use pointer math (e.g. "bc - bcs") to get its
755 * tty index. 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 if (!bcs) 758 if (!bcs)
759 return -ENOMEM; 759 return -ENOMEM;
760 760
diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c
index 1c1bd0afcd48..37caba7c3aff 100644
--- a/drivers/tty/goldfish.c
+++ b/drivers/tty/goldfish.c
@@ -245,8 +245,9 @@ static int goldfish_tty_create_driver(void)
245 int ret; 245 int ret;
246 struct tty_driver *tty; 246 struct tty_driver *tty;
247 247
248 goldfish_ttys = kzalloc(sizeof(*goldfish_ttys) * 248 goldfish_ttys = kcalloc(goldfish_tty_line_count,
249 goldfish_tty_line_count, GFP_KERNEL); 249 sizeof(*goldfish_ttys),
250 GFP_KERNEL);
250 if (goldfish_ttys == NULL) { 251 if (goldfish_ttys == NULL) {
251 ret = -ENOMEM; 252 ret = -ENOMEM;
252 goto err_alloc_goldfish_ttys_failed; 253 goto err_alloc_goldfish_ttys_failed;
diff --git a/drivers/tty/hvc/hvc_iucv.c b/drivers/tty/hvc/hvc_iucv.c
index a74680729825..2af1e5751bd6 100644
--- a/drivers/tty/hvc/hvc_iucv.c
+++ b/drivers/tty/hvc/hvc_iucv.c
@@ -1252,7 +1252,7 @@ static int hvc_iucv_setup_filter(const char *val)
1252 if (size > MAX_VMID_FILTER) 1252 if (size > MAX_VMID_FILTER)
1253 return -ENOSPC; 1253 return -ENOSPC;
1254 1254
1255 array = kzalloc(size * 8, GFP_KERNEL); 1255 array = kcalloc(size, 8, GFP_KERNEL);
1256 if (!array) 1256 if (!array)
1257 return -ENOMEM; 1257 return -ENOMEM;
1258 1258
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 760d5dd0aada..cb85002a10d8 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -991,7 +991,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
991 991
992 priv->tx_dma_use = 1; 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 if (!priv->sg_tx_p) { 995 if (!priv->sg_tx_p) {
996 dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__); 996 dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__);
997 return 0; 997 return 0;
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 890b8832aff2..9c14a453f73c 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2445,7 +2445,7 @@ int uart_register_driver(struct uart_driver *drv)
2445 * Maybe we should be using a slab cache for this, especially if 2445 * Maybe we should be using a slab cache for this, especially if
2446 * we have a large number of ports to handle. 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 if (!drv->state) 2449 if (!drv->state)
2450 goto out; 2450 goto out;
2451 2451
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index b93d0225f8c9..72131b5e132e 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -1125,8 +1125,9 @@ static int __init sunsab_init(void)
1125 } 1125 }
1126 1126
1127 if (num_channels) { 1127 if (num_channels) {
1128 sunsab_ports = kzalloc(sizeof(struct uart_sunsab_port) * 1128 sunsab_ports = kcalloc(num_channels,
1129 num_channels, GFP_KERNEL); 1129 sizeof(struct uart_sunsab_port),
1130 GFP_KERNEL);
1130 if (!sunsab_ports) 1131 if (!sunsab_ports)
1131 return -ENOMEM; 1132 return -ENOMEM;
1132 1133
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
index 31d5b1d3b5af..91aea8823af5 100644
--- a/drivers/uio/uio_pruss.c
+++ b/drivers/uio/uio_pruss.c
@@ -129,7 +129,7 @@ static int pruss_probe(struct platform_device *pdev)
129 if (!gdev) 129 if (!gdev)
130 return -ENOMEM; 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 if (!gdev->info) { 133 if (!gdev->info) {
134 kfree(gdev); 134 kfree(gdev);
135 return -ENOMEM; 135 return -ENOMEM;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 26c2438d2889..fcae521df29b 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1376,7 +1376,7 @@ static int hub_configure(struct usb_hub *hub,
1376 dev_info(hub_dev, "%d port%s detected\n", maxchild, 1376 dev_info(hub_dev, "%d port%s detected\n", maxchild,
1377 (maxchild == 1) ? "" : "s"); 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 if (!hub->ports) { 1380 if (!hub->ports) {
1381 ret = -ENOMEM; 1381 ret = -ENOMEM;
1382 goto fail; 1382 goto fail;
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 1faefea16cec..edaf0b6af4f0 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -5079,13 +5079,14 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
5079 dev_dbg(hsotg->dev, "hcfg=%08x\n", hcfg); 5079 dev_dbg(hsotg->dev, "hcfg=%08x\n", hcfg);
5080 5080
5081#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS 5081#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
5082 hsotg->frame_num_array = kzalloc(sizeof(*hsotg->frame_num_array) * 5082 hsotg->frame_num_array = kcalloc(FRAME_NUM_ARRAY_SIZE,
5083 FRAME_NUM_ARRAY_SIZE, GFP_KERNEL); 5083 sizeof(*hsotg->frame_num_array),
5084 GFP_KERNEL);
5084 if (!hsotg->frame_num_array) 5085 if (!hsotg->frame_num_array)
5085 goto error1; 5086 goto error1;
5086 hsotg->last_frame_num_array = kzalloc( 5087 hsotg->last_frame_num_array =
5087 sizeof(*hsotg->last_frame_num_array) * 5088 kcalloc(FRAME_NUM_ARRAY_SIZE,
5088 FRAME_NUM_ARRAY_SIZE, GFP_KERNEL); 5089 sizeof(*hsotg->last_frame_num_array), GFP_KERNEL);
5089 if (!hsotg->last_frame_num_array) 5090 if (!hsotg->last_frame_num_array)
5090 goto error1; 5091 goto error1;
5091#endif 5092#endif
diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index 03149b9d7ea7..a4d9b5e1e50e 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -138,9 +138,9 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
138 __func__, ep, num_tabs); 138 __func__, ep, num_tabs);
139 139
140 /* Allocate memory for table array */ 140 /* Allocate memory for table array */
141 ep->bd_list.bd_table_array = kzalloc( 141 ep->bd_list.bd_table_array = kcalloc(num_tabs,
142 num_tabs * sizeof(struct bd_table *), 142 sizeof(struct bd_table *),
143 GFP_ATOMIC); 143 GFP_ATOMIC);
144 if (!ep->bd_list.bd_table_array) 144 if (!ep->bd_list.bd_table_array)
145 return -ENOMEM; 145 return -ENOMEM;
146 146
diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index 9a3f7db26a5e..be59309e848c 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -2246,7 +2246,7 @@ static int struct_udc_setup(struct fsl_udc *udc,
2246 pdata = dev_get_platdata(&pdev->dev); 2246 pdata = dev_get_platdata(&pdev->dev);
2247 udc->phy_mode = pdata->phy_mode; 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 if (!udc->eps) 2250 if (!udc->eps)
2251 return -1; 2251 return -1;
2252 2252
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index e56db44708bc..1d87295682b8 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -117,8 +117,9 @@ static struct ehci_tt *find_tt(struct usb_device *udev)
117 if (utt->multi) { 117 if (utt->multi) {
118 tt_index = utt->hcpriv; 118 tt_index = utt->hcpriv;
119 if (!tt_index) { /* Create the index array */ 119 if (!tt_index) { /* Create the index array */
120 tt_index = kzalloc(utt->hub->maxchild * 120 tt_index = kcalloc(utt->hub->maxchild,
121 sizeof(*tt_index), GFP_ATOMIC); 121 sizeof(*tt_index),
122 GFP_ATOMIC);
122 if (!tt_index) 123 if (!tt_index)
123 return ERR_PTR(-ENOMEM); 124 return ERR_PTR(-ENOMEM);
124 utt->hcpriv = tt_index; 125 utt->hcpriv = tt_index;
diff --git a/drivers/usb/host/imx21-hcd.c b/drivers/usb/host/imx21-hcd.c
index 3a8bbfe43a8e..6e3dad19d369 100644
--- a/drivers/usb/host/imx21-hcd.c
+++ b/drivers/usb/host/imx21-hcd.c
@@ -741,8 +741,8 @@ static int imx21_hc_urb_enqueue_isoc(struct usb_hcd *hcd,
741 if (urb_priv == NULL) 741 if (urb_priv == NULL)
742 return -ENOMEM; 742 return -ENOMEM;
743 743
744 urb_priv->isoc_td = kzalloc( 744 urb_priv->isoc_td = kcalloc(urb->number_of_packets, sizeof(struct td),
745 sizeof(struct td) * urb->number_of_packets, mem_flags); 745 mem_flags);
746 if (urb_priv->isoc_td == NULL) { 746 if (urb_priv->isoc_td == NULL) {
747 ret = -ENOMEM; 747 ret = -ENOMEM;
748 goto alloc_td_failed; 748 goto alloc_td_failed;
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index 34e866ad4a81..ad2c082bd0fb 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -1024,7 +1024,8 @@ static long mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg
1024 return -EINVAL; 1024 return -EINVAL;
1025 1025
1026 size = CHUNK_ALIGN(arg); 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 if (vec == NULL) { 1029 if (vec == NULL) {
1029 ret = -ENOMEM; 1030 ret = -ENOMEM;
1030 break; 1031 break;
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 34ee9ebe12a3..33d059c40616 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -1068,7 +1068,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
1068 if (!gpriv) 1068 if (!gpriv)
1069 return -ENOMEM; 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 if (!uep) { 1072 if (!uep) {
1073 ret = -ENOMEM; 1073 ret = -ENOMEM;
1074 goto usbhs_mod_gadget_probe_err_gpriv; 1074 goto usbhs_mod_gadget_probe_err_gpriv;
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index 9677e0e31475..c4922b96c93b 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -803,7 +803,8 @@ int usbhs_pipe_probe(struct usbhs_priv *priv)
803 return -EINVAL; 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 if (!info->pipe) 808 if (!info->pipe)
808 return -ENOMEM; 809 return -ENOMEM;
809 810
diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpipe.c
index d0f1a6698460..38884aac862b 100644
--- a/drivers/usb/wusbcore/wa-rpipe.c
+++ b/drivers/usb/wusbcore/wa-rpipe.c
@@ -470,7 +470,8 @@ error:
470int wa_rpipes_create(struct wahc *wa) 470int wa_rpipes_create(struct wahc *wa)
471{ 471{
472 wa->rpipes = le16_to_cpu(wa->wa_descr->wNumRPipes); 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 GFP_KERNEL); 475 GFP_KERNEL);
475 if (wa->rpipe_bm == NULL) 476 if (wa->rpipe_bm == NULL)
476 return -ENOMEM; 477 return -ENOMEM;
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index ce10eb75b042..17fcd3b2e686 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -1685,22 +1685,25 @@ static int vhost_scsi_nexus_cb(struct se_portal_group *se_tpg,
1685 for (i = 0; i < VHOST_SCSI_DEFAULT_TAGS; i++) { 1685 for (i = 0; i < VHOST_SCSI_DEFAULT_TAGS; i++) {
1686 tv_cmd = &((struct vhost_scsi_cmd *)se_sess->sess_cmd_map)[i]; 1686 tv_cmd = &((struct vhost_scsi_cmd *)se_sess->sess_cmd_map)[i];
1687 1687
1688 tv_cmd->tvc_sgl = kzalloc(sizeof(struct scatterlist) * 1688 tv_cmd->tvc_sgl = kcalloc(VHOST_SCSI_PREALLOC_SGLS,
1689 VHOST_SCSI_PREALLOC_SGLS, GFP_KERNEL); 1689 sizeof(struct scatterlist),
1690 GFP_KERNEL);
1690 if (!tv_cmd->tvc_sgl) { 1691 if (!tv_cmd->tvc_sgl) {
1691 pr_err("Unable to allocate tv_cmd->tvc_sgl\n"); 1692 pr_err("Unable to allocate tv_cmd->tvc_sgl\n");
1692 goto out; 1693 goto out;
1693 } 1694 }
1694 1695
1695 tv_cmd->tvc_upages = kzalloc(sizeof(struct page *) * 1696 tv_cmd->tvc_upages = kcalloc(VHOST_SCSI_PREALLOC_UPAGES,
1696 VHOST_SCSI_PREALLOC_UPAGES, GFP_KERNEL); 1697 sizeof(struct page *),
1698 GFP_KERNEL);
1697 if (!tv_cmd->tvc_upages) { 1699 if (!tv_cmd->tvc_upages) {
1698 pr_err("Unable to allocate tv_cmd->tvc_upages\n"); 1700 pr_err("Unable to allocate tv_cmd->tvc_upages\n");
1699 goto out; 1701 goto out;
1700 } 1702 }
1701 1703
1702 tv_cmd->tvc_prot_sgl = kzalloc(sizeof(struct scatterlist) * 1704 tv_cmd->tvc_prot_sgl = kcalloc(VHOST_SCSI_PREALLOC_PROT_SGLS,
1703 VHOST_SCSI_PREALLOC_PROT_SGLS, GFP_KERNEL); 1705 sizeof(struct scatterlist),
1706 GFP_KERNEL);
1704 if (!tv_cmd->tvc_prot_sgl) { 1707 if (!tv_cmd->tvc_prot_sgl) {
1705 pr_err("Unable to allocate tv_cmd->tvc_prot_sgl\n"); 1708 pr_err("Unable to allocate tv_cmd->tvc_prot_sgl\n");
1706 goto out; 1709 goto out;
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index 08b822656846..ff45dca3ee46 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -649,7 +649,7 @@ static void *sti_bmode_font_raw(struct sti_cooked_font *f)
649 unsigned char *n, *p, *q; 649 unsigned char *n, *p, *q;
650 int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); 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 if (!n) 653 if (!n)
654 return NULL; 654 return NULL;
655 p = n + 3; 655 p = n + 3;
diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c
index 9f9a7bef1ff6..d6ba348deb9f 100644
--- a/drivers/video/fbdev/broadsheetfb.c
+++ b/drivers/video/fbdev/broadsheetfb.c
@@ -617,7 +617,7 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par,
617 int tail_start_addr; 617 int tail_start_addr;
618 int start_sector_addr; 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 if (!sector_buffer) 621 if (!sector_buffer)
622 return -ENOMEM; 622 return -ENOMEM;
623 623
diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 522cf441842c..852d86c1c527 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -620,7 +620,7 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize,
620 int num = 0, i, first = 1; 620 int num = 0, i, first = 1;
621 int ver, rev; 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 if (mode == NULL) 624 if (mode == NULL)
625 return NULL; 625 return NULL;
626 626
@@ -1055,8 +1055,9 @@ void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
1055 if (!(num + svd_n)) 1055 if (!(num + svd_n))
1056 return; 1056 return;
1057 1057
1058 m = kzalloc((specs->modedb_len + num + svd_n) * 1058 m = kcalloc(specs->modedb_len + num + svd_n,
1059 sizeof(struct fb_videomode), GFP_KERNEL); 1059 sizeof(struct fb_videomode),
1060 GFP_KERNEL);
1060 1061
1061 if (!m) 1062 if (!m)
1062 return; 1063 return;
diff --git a/drivers/video/fbdev/mmp/fb/mmpfb.c b/drivers/video/fbdev/mmp/fb/mmpfb.c
index 92279e02dd94..f27697e07c55 100644
--- a/drivers/video/fbdev/mmp/fb/mmpfb.c
+++ b/drivers/video/fbdev/mmp/fb/mmpfb.c
@@ -493,8 +493,8 @@ static int modes_setup(struct mmpfb_info *fbi)
493 return 0; 493 return 0;
494 } 494 }
495 /* put videomode list to info structure */ 495 /* put videomode list to info structure */
496 videomodes = kzalloc(sizeof(struct fb_videomode) * videomode_num, 496 videomodes = kcalloc(videomode_num, sizeof(struct fb_videomode),
497 GFP_KERNEL); 497 GFP_KERNEL);
498 if (!videomodes) { 498 if (!videomodes) {
499 dev_err(fbi->dev, "can't malloc video modes\n"); 499 dev_err(fbi->dev, "can't malloc video modes\n");
500 return -ENOMEM; 500 return -ENOMEM;
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/manager.c b/drivers/video/fbdev/omap2/omapfb/dss/manager.c
index 69f86d2cc274..d21c641e1f3c 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/manager.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/manager.c
@@ -42,8 +42,8 @@ int dss_init_overlay_managers(void)
42 42
43 num_managers = dss_feat_get_num_mgrs(); 43 num_managers = dss_feat_get_num_mgrs();
44 44
45 managers = kzalloc(sizeof(struct omap_overlay_manager) * num_managers, 45 managers = kcalloc(num_managers, sizeof(struct omap_overlay_manager),
46 GFP_KERNEL); 46 GFP_KERNEL);
47 47
48 BUG_ON(managers == NULL); 48 BUG_ON(managers == NULL);
49 49
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/overlay.c b/drivers/video/fbdev/omap2/omapfb/dss/overlay.c
index d6c5d75d2ef8..be17a4785a5e 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/overlay.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/overlay.c
@@ -59,8 +59,8 @@ void dss_init_overlays(struct platform_device *pdev)
59 59
60 num_overlays = dss_feat_get_num_ovls(); 60 num_overlays = dss_feat_get_num_ovls();
61 61
62 overlays = kzalloc(sizeof(struct omap_overlay) * num_overlays, 62 overlays = kcalloc(num_overlays, sizeof(struct omap_overlay),
63 GFP_KERNEL); 63 GFP_KERNEL);
64 64
65 BUG_ON(overlays == NULL); 65 BUG_ON(overlays == NULL);
66 66
diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c
index c592ca513115..440a6636d8f0 100644
--- a/drivers/video/fbdev/uvesafb.c
+++ b/drivers/video/fbdev/uvesafb.c
@@ -486,8 +486,9 @@ static int uvesafb_vbe_getmodes(struct uvesafb_ktask *task,
486 mode++; 486 mode++;
487 } 487 }
488 488
489 par->vbe_modes = kzalloc(sizeof(struct vbe_mode_ib) * 489 par->vbe_modes = kcalloc(par->vbe_modes_cnt,
490 par->vbe_modes_cnt, GFP_KERNEL); 490 sizeof(struct vbe_mode_ib),
491 GFP_KERNEL);
491 if (!par->vbe_modes) 492 if (!par->vbe_modes)
492 return -ENOMEM; 493 return -ENOMEM;
493 494
@@ -858,7 +859,7 @@ static int uvesafb_vbe_init_mode(struct fb_info *info)
858 * Convert the modelist into a modedb so that we can use it with 859 * Convert the modelist into a modedb so that we can use it with
859 * fb_find_mode(). 860 * fb_find_mode().
860 */ 861 */
861 mode = kzalloc(i * sizeof(*mode), GFP_KERNEL); 862 mode = kcalloc(i, sizeof(*mode), GFP_KERNEL);
862 if (mode) { 863 if (mode) {
863 i = 0; 864 i = 0;
864 list_for_each(pos, &info->modelist) { 865 list_for_each(pos, &info->modelist) {
diff --git a/drivers/video/of_display_timing.c b/drivers/video/of_display_timing.c
index 83b8963c9657..5244e93ceafc 100644
--- a/drivers/video/of_display_timing.c
+++ b/drivers/video/of_display_timing.c
@@ -181,8 +181,9 @@ struct display_timings *of_get_display_timings(const struct device_node *np)
181 goto entryfail; 181 goto entryfail;
182 } 182 }
183 183
184 disp->timings = kzalloc(sizeof(struct display_timing *) * 184 disp->timings = kcalloc(disp->num_timings,
185 disp->num_timings, GFP_KERNEL); 185 sizeof(struct display_timing *),
186 GFP_KERNEL);
186 if (!disp->timings) { 187 if (!disp->timings) {
187 pr_err("%pOF: could not allocate timings array\n", np); 188 pr_err("%pOF: could not allocate timings array\n", np);
188 goto entryfail; 189 goto entryfail;
diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
index 4e05d7f711fe..8ba726e600e9 100644
--- a/drivers/virt/fsl_hypervisor.c
+++ b/drivers/virt/fsl_hypervisor.c
@@ -223,7 +223,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)
223 * 'pages' is an array of struct page pointers that's initialized by 223 * 'pages' is an array of struct page pointers that's initialized by
224 * get_user_pages(). 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 if (!pages) { 227 if (!pages) {
228 pr_debug("fsl-hv: could not allocate page list\n"); 228 pr_debug("fsl-hv: could not allocate page list\n");
229 return -ENOMEM; 229 return -ENOMEM;
diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
index a491d0ed3f16..b563a4499cc8 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -119,7 +119,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
119 if (!vp_dev->msix_names) 119 if (!vp_dev->msix_names)
120 goto error; 120 goto error;
121 vp_dev->msix_affinity_masks 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 GFP_KERNEL); 123 GFP_KERNEL);
124 if (!vp_dev->msix_affinity_masks) 124 if (!vp_dev->msix_affinity_masks)
125 goto error; 125 goto error;
diff --git a/drivers/xen/arm-device.c b/drivers/xen/arm-device.c
index 85dd20e05726..3e789c77f568 100644
--- a/drivers/xen/arm-device.c
+++ b/drivers/xen/arm-device.c
@@ -70,9 +70,9 @@ static int xen_map_device_mmio(const struct resource *resources,
70 if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0)) 70 if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0))
71 continue; 71 continue;
72 72
73 gpfns = kzalloc(sizeof(xen_pfn_t) * nr, GFP_KERNEL); 73 gpfns = kcalloc(nr, sizeof(xen_pfn_t), GFP_KERNEL);
74 idxs = kzalloc(sizeof(xen_ulong_t) * nr, GFP_KERNEL); 74 idxs = kcalloc(nr, sizeof(xen_ulong_t), GFP_KERNEL);
75 errs = kzalloc(sizeof(int) * nr, GFP_KERNEL); 75 errs = kcalloc(nr, sizeof(int), GFP_KERNEL);
76 if (!gpfns || !idxs || !errs) { 76 if (!gpfns || !idxs || !errs) {
77 kfree(gpfns); 77 kfree(gpfns);
78 kfree(idxs); 78 kfree(idxs);
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index dc062b195c46..a3fdb4fe967d 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -1603,8 +1603,8 @@ static int btrfsic_read_block(struct btrfsic_state *state,
1603 1603
1604 num_pages = (block_ctx->len + (u64)PAGE_SIZE - 1) >> 1604 num_pages = (block_ctx->len + (u64)PAGE_SIZE - 1) >>
1605 PAGE_SHIFT; 1605 PAGE_SHIFT;
1606 block_ctx->mem_to_free = kzalloc((sizeof(*block_ctx->datav) + 1606 block_ctx->mem_to_free = kcalloc(sizeof(*block_ctx->datav) +
1607 sizeof(*block_ctx->pagev)) * 1607 sizeof(*block_ctx->pagev),
1608 num_pages, GFP_NOFS); 1608 num_pages, GFP_NOFS);
1609 if (!block_ctx->mem_to_free) 1609 if (!block_ctx->mem_to_free)
1610 return -ENOMEM; 1610 return -ENOMEM;
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 5aca336642c0..42329b25877d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2077,7 +2077,7 @@ struct cifs_writedata *
2077cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete) 2077cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete)
2078{ 2078{
2079 struct page **pages = 2079 struct page **pages =
2080 kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS); 2080 kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
2081 if (pages) 2081 if (pages)
2082 return cifs_writedata_direct_alloc(pages, complete); 2082 return cifs_writedata_direct_alloc(pages, complete);
2083 2083
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 87eece6fbd48..8d41ca7bfcf1 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2900,7 +2900,7 @@ static struct cifs_readdata *
2900cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete) 2900cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete)
2901{ 2901{
2902 struct page **pages = 2902 struct page **pages =
2903 kzalloc(sizeof(struct page *) * nr_pages, GFP_KERNEL); 2903 kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);
2904 struct cifs_readdata *ret = NULL; 2904 struct cifs_readdata *ret = NULL;
2905 2905
2906 if (pages) { 2906 if (pages) {
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index c969275ce3ee..0057fe3f248d 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -577,7 +577,7 @@ int ext4_ext_precache(struct inode *inode)
577 down_read(&ei->i_data_sem); 577 down_read(&ei->i_data_sem);
578 depth = ext_depth(inode); 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 GFP_NOFS); 581 GFP_NOFS);
582 if (path == NULL) { 582 if (path == NULL) {
583 up_read(&ei->i_data_sem); 583 up_read(&ei->i_data_sem);
@@ -879,7 +879,7 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block,
879 } 879 }
880 if (!path) { 880 if (!path) {
881 /* account possible depth increase */ 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 GFP_NOFS); 883 GFP_NOFS);
884 if (unlikely(!path)) 884 if (unlikely(!path))
885 return ERR_PTR(-ENOMEM); 885 return ERR_PTR(-ENOMEM);
@@ -1063,7 +1063,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
1063 * We need this to handle errors and free blocks 1063 * We need this to handle errors and free blocks
1064 * upon them. 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 if (!ablocks) 1067 if (!ablocks)
1068 return -ENOMEM; 1068 return -ENOMEM;
1069 1069
@@ -2921,7 +2921,7 @@ again:
2921 path[k].p_block = 2921 path[k].p_block =
2922 le16_to_cpu(path[k].p_hdr->eh_entries)+1; 2922 le16_to_cpu(path[k].p_hdr->eh_entries)+1;
2923 } else { 2923 } else {
2924 path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1), 2924 path = kcalloc(depth + 1, sizeof(struct ext4_ext_path),
2925 GFP_NOFS); 2925 GFP_NOFS);
2926 if (path == NULL) { 2926 if (path == NULL) {
2927 ext4_journal_stop(handle); 2927 ext4_journal_stop(handle);
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index c75ad982bcfc..956f27826026 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -461,7 +461,7 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
461 fh_count = be32_to_cpup(p); 461 fh_count = be32_to_cpup(p);
462 462
463 fls->mirror_array[i]->fh_versions = 463 fls->mirror_array[i]->fh_versions =
464 kzalloc(fh_count * sizeof(struct nfs_fh), 464 kcalloc(fh_count, sizeof(struct nfs_fh),
465 gfp_flags); 465 gfp_flags);
466 if (fls->mirror_array[i]->fh_versions == NULL) { 466 if (fls->mirror_array[i]->fh_versions == NULL) {
467 rc = -ENOMEM; 467 rc = -ENOMEM;
diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
index d62279d3fc5d..59aa04976331 100644
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -99,7 +99,8 @@ nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev,
99 version_count = be32_to_cpup(p); 99 version_count = be32_to_cpup(p);
100 dprintk("%s: version count %d\n", __func__, version_count); 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 gfp_flags); 104 gfp_flags);
104 if (!ds_versions) 105 if (!ds_versions)
105 goto out_scratch; 106 goto out_scratch;
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 8ceb25a10ea0..a1143f7c2201 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -404,8 +404,9 @@ fsloc_parse(char **mesg, char *buf, struct nfsd4_fs_locations *fsloc)
404 if (fsloc->locations_count == 0) 404 if (fsloc->locations_count == 0)
405 return 0; 405 return 0;
406 406
407 fsloc->locations = kzalloc(fsloc->locations_count 407 fsloc->locations = kcalloc(fsloc->locations_count,
408 * sizeof(struct nfsd4_fs_location), GFP_KERNEL); 408 sizeof(struct nfsd4_fs_location),
409 GFP_KERNEL);
409 if (!fsloc->locations) 410 if (!fsloc->locations)
410 return -ENOMEM; 411 return -ENOMEM;
411 for (i=0; i < fsloc->locations_count; i++) { 412 for (i=0; i < fsloc->locations_count; i++) {
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index e5dcea6cee5f..bd3475694e83 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1383,7 +1383,7 @@ static int __ocfs2_recovery_thread(void *arg)
1383 goto bail; 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 if (!rm_quota) { 1387 if (!rm_quota) {
1388 status = -ENOMEM; 1388 status = -ENOMEM;
1389 goto bail; 1389 goto bail;
diff --git a/fs/ocfs2/sysfile.c b/fs/ocfs2/sysfile.c
index af155c183123..5965f3878d49 100644
--- a/fs/ocfs2/sysfile.c
+++ b/fs/ocfs2/sysfile.c
@@ -69,10 +69,11 @@ static struct inode **get_local_system_inode(struct ocfs2_super *osb,
69 spin_unlock(&osb->osb_lock); 69 spin_unlock(&osb->osb_lock);
70 70
71 if (unlikely(!local_system_inodes)) { 71 if (unlikely(!local_system_inodes)) {
72 local_system_inodes = kzalloc(sizeof(struct inode *) * 72 local_system_inodes =
73 NUM_LOCAL_SYSTEM_INODES * 73 kzalloc(array3_size(sizeof(struct inode *),
74 osb->max_slots, 74 NUM_LOCAL_SYSTEM_INODES,
75 GFP_NOFS); 75 osb->max_slots),
76 GFP_NOFS);
76 if (!local_system_inodes) { 77 if (!local_system_inodes) {
77 mlog_errno(-ENOMEM); 78 mlog_errno(-ENOMEM);
78 /* 79 /*
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c
index 08801b45df00..c993dd8db739 100644
--- a/fs/overlayfs/namei.c
+++ b/fs/overlayfs/namei.c
@@ -612,7 +612,7 @@ static int ovl_get_index_name_fh(struct ovl_fh *fh, struct qstr *name)
612{ 612{
613 char *n, *s; 613 char *n, *s;
614 614
615 n = kzalloc(fh->len * 2, GFP_KERNEL); 615 n = kcalloc(fh->len, 2, GFP_KERNEL);
616 if (!n) 616 if (!n)
617 return -ENOMEM; 617 return -ENOMEM;
618 618
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 4d765e5e91ed..89921a0d2ebb 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1426,7 +1426,7 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
1426 /* If there are mixed files and directories we need a new table */ 1426 /* If there are mixed files and directories we need a new table */
1427 if (nr_dirs && nr_files) { 1427 if (nr_dirs && nr_files) {
1428 struct ctl_table *new; 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 GFP_KERNEL); 1430 GFP_KERNEL);
1431 if (!files) 1431 if (!files)
1432 goto out; 1432 goto out;
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index b13fc024d2ee..132ec4406ed0 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1044,7 +1044,8 @@ research:
1044 if (blocks_needed == 1) { 1044 if (blocks_needed == 1) {
1045 un = &unf_single; 1045 un = &unf_single;
1046 } else { 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 if (!un) { 1049 if (!un) {
1049 un = &unf_single; 1050 un = &unf_single;
1050 blocks_needed = 1; 1051 blocks_needed = 1;
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 0d27d41f5c6e..fc77ea736da7 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1585,7 +1585,7 @@ static struct udf_vds_record *handle_partition_descriptor(
1585 struct udf_vds_record *new_loc; 1585 struct udf_vds_record *new_loc;
1586 unsigned int new_size = ALIGN(partnum, PART_DESC_ALLOC_STEP); 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 if (!new_loc) 1589 if (!new_loc)
1590 return ERR_PTR(-ENOMEM); 1590 return ERR_PTR(-ENOMEM);
1591 memcpy(new_loc, data->part_descs_loc, 1591 memcpy(new_loc, data->part_descs_loc,
@@ -1644,8 +1644,9 @@ static noinline int udf_process_sequence(
1644 1644
1645 memset(data.vds, 0, sizeof(struct udf_vds_record) * VDS_POS_LENGTH); 1645 memset(data.vds, 0, sizeof(struct udf_vds_record) * VDS_POS_LENGTH);
1646 data.size_part_descs = PART_DESC_ALLOC_STEP; 1646 data.size_part_descs = PART_DESC_ALLOC_STEP;
1647 data.part_descs_loc = kzalloc(sizeof(*data.part_descs_loc) * 1647 data.part_descs_loc = kcalloc(data.size_part_descs,
1648 data.size_part_descs, GFP_KERNEL); 1648 sizeof(*data.part_descs_loc),
1649 GFP_KERNEL);
1649 if (!data.part_descs_loc) 1650 if (!data.part_descs_loc)
1650 return -ENOMEM; 1651 return -ENOMEM;
1651 1652
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index cced0c1e63e2..1494e087890e 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -5447,7 +5447,7 @@ static int jit_subprogs(struct bpf_verifier_env *env)
5447 insn->imm = 1; 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 if (!func) 5451 if (!func)
5452 return -ENOMEM; 5452 return -ENOMEM;
5453 5453
diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index aaa69531fae2..2ddfce8f1e8f 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -691,7 +691,7 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0)
691 } 691 }
692 if (!s->usable) 692 if (!s->usable)
693 return KDB_NOTIMP; 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 if (!s->command) { 695 if (!s->command) {
696 kdb_printf("Could not allocate new kdb_defcmd table for %s\n", 696 kdb_printf("Could not allocate new kdb_defcmd table for %s\n",
697 cmdstr); 697 cmdstr);
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 1725b902983f..ccc579a7d32e 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1184,7 +1184,8 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
1184 if (unlikely(!area)) 1184 if (unlikely(!area))
1185 goto out; 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 if (!area->bitmap) 1189 if (!area->bitmap)
1189 goto free_area; 1190 goto free_area;
1190 1191
diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 4ceeb13a74ed..8402b3349dca 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -989,7 +989,8 @@ static int __init lock_torture_init(void)
989 } 989 }
990 990
991 if (nwriters_stress) { 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 GFP_KERNEL); 994 GFP_KERNEL);
994 if (writer_tasks == NULL) { 995 if (writer_tasks == NULL) {
995 VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory"); 996 VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory");
@@ -999,7 +1000,8 @@ static int __init lock_torture_init(void)
999 } 1000 }
1000 1001
1001 if (cxt.cur_ops->readlock) { 1002 if (cxt.cur_ops->readlock) {
1002 reader_tasks = kzalloc(cxt.nrealreaders_stress * sizeof(reader_tasks[0]), 1003 reader_tasks = kcalloc(cxt.nrealreaders_stress,
1004 sizeof(reader_tasks[0]),
1003 GFP_KERNEL); 1005 GFP_KERNEL);
1004 if (reader_tasks == NULL) { 1006 if (reader_tasks == NULL) {
1005 VERBOSE_TOROUT_ERRSTRING("reader_tasks: Out of memory"); 1007 VERBOSE_TOROUT_ERRSTRING("reader_tasks: Out of memory");
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e497c05aab7f..1866e64792a7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10215,10 +10215,10 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
10215 struct cfs_rq *cfs_rq; 10215 struct cfs_rq *cfs_rq;
10216 int i; 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 if (!tg->cfs_rq) 10219 if (!tg->cfs_rq)
10220 goto err; 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 if (!tg->se) 10222 if (!tg->se)
10223 goto err; 10223 goto err;
10224 10224
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index ef3c4e6f5345..47556b0c9a95 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -183,10 +183,10 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
183 struct sched_rt_entity *rt_se; 183 struct sched_rt_entity *rt_se;
184 int i; 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 if (!tg->rt_rq) 187 if (!tg->rt_rq)
188 goto err; 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 if (!tg->rt_se) 190 if (!tg->rt_se)
191 goto err; 191 goto err;
192 192
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 6a78cf70761d..2d9837c0aff4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -3047,7 +3047,8 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
3047 if (IS_ERR(kbuf)) 3047 if (IS_ERR(kbuf))
3048 return PTR_ERR(kbuf); 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 GFP_KERNEL); 3052 GFP_KERNEL);
3052 if (!tmp_bitmap) { 3053 if (!tmp_bitmap) {
3053 kfree(kbuf); 3054 kfree(kbuf);
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index df4b6254f986..efed9c1cfb7e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -728,7 +728,7 @@ static int ftrace_profile_init_cpu(int cpu)
728 */ 728 */
729 size = FTRACE_PROFILE_HASH_SIZE; 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 if (!stat->hash) 733 if (!stat->hash)
734 return -ENOMEM; 734 return -ENOMEM;
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8ea855015613..c9336e98ac59 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4361,7 +4361,8 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled)
4361 4361
4362 if (mask == TRACE_ITER_RECORD_TGID) { 4362 if (mask == TRACE_ITER_RECORD_TGID) {
4363 if (!tgid_map) 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 GFP_KERNEL); 4366 GFP_KERNEL);
4366 if (!tgid_map) { 4367 if (!tgid_map) {
4367 tr->trace_flags &= ~TRACE_ITER_RECORD_TGID; 4368 tr->trace_flags &= ~TRACE_ITER_RECORD_TGID;
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 465a28b4cd32..78b192071ef7 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5638,7 +5638,7 @@ static void __init wq_numa_init(void)
5638 * available. Build one from cpu_to_node() which should have been 5638 * available. Build one from cpu_to_node() which should have been
5639 * fully initialized by now. 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 BUG_ON(!tbl); 5642 BUG_ON(!tbl);
5643 5643
5644 for_each_node(node) 5644 for_each_node(node)
diff --git a/lib/lru_cache.c b/lib/lru_cache.c
index 28ba40b99337..2b10a4024c35 100644
--- a/lib/lru_cache.c
+++ b/lib/lru_cache.c
@@ -119,7 +119,7 @@ struct lru_cache *lc_create(const char *name, struct kmem_cache *cache,
119 slot = kcalloc(e_count, sizeof(struct hlist_head), GFP_KERNEL); 119 slot = kcalloc(e_count, sizeof(struct hlist_head), GFP_KERNEL);
120 if (!slot) 120 if (!slot)
121 goto out_fail; 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 if (!element) 123 if (!element)
124 goto out_fail; 124 goto out_fail;
125 125
diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c
index 2dbfc4c8a237..20ed0f766787 100644
--- a/lib/mpi/mpiutil.c
+++ b/lib/mpi/mpiutil.c
@@ -98,7 +98,7 @@ int mpi_resize(MPI a, unsigned nlimbs)
98 kzfree(a->d); 98 kzfree(a->d);
99 a->d = p; 99 a->d = p;
100 } else { 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 if (!a->d) 102 if (!a->d)
103 return -ENOMEM; 103 return -ENOMEM;
104 } 104 }
diff --git a/mm/slab.c b/mm/slab.c
index 36688f6c87eb..aa76a70e087e 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4338,7 +4338,8 @@ static int leaks_show(struct seq_file *m, void *p)
4338 if (x[0] == x[1]) { 4338 if (x[0] == x[1]) {
4339 /* Increase the buffer size */ 4339 /* Increase the buffer size */
4340 mutex_unlock(&slab_mutex); 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 if (!m->private) { 4343 if (!m->private) {
4343 /* Too bad, we are really out */ 4344 /* Too bad, we are really out */
4344 m->private = x; 4345 m->private = x;
diff --git a/mm/slub.c b/mm/slub.c
index faf5dcb7b44f..a3b8467c14af 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3623,8 +3623,9 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
3623#ifdef CONFIG_SLUB_DEBUG 3623#ifdef CONFIG_SLUB_DEBUG
3624 void *addr = page_address(page); 3624 void *addr = page_address(page);
3625 void *p; 3625 void *p;
3626 unsigned long *map = kzalloc(BITS_TO_LONGS(page->objects) * 3626 unsigned long *map = kcalloc(BITS_TO_LONGS(page->objects),
3627 sizeof(long), GFP_ATOMIC); 3627 sizeof(long),
3628 GFP_ATOMIC);
3628 if (!map) 3629 if (!map)
3629 return; 3630 return;
3630 slab_err(s, page, text, s->name); 3631 slab_err(s, page, text, s->name);
@@ -4752,7 +4753,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
4752 int x; 4753 int x;
4753 unsigned long *nodes; 4754 unsigned long *nodes;
4754 4755
4755 nodes = kzalloc(sizeof(unsigned long) * nr_node_ids, GFP_KERNEL); 4756 nodes = kcalloc(nr_node_ids, sizeof(unsigned long), GFP_KERNEL);
4756 if (!nodes) 4757 if (!nodes)
4757 return -ENOMEM; 4758 return -ENOMEM;
4758 4759
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index cb4729539b82..920665dd92db 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -333,7 +333,7 @@ static int br_mdb_rehash(struct net_bridge_mdb_htable __rcu **mdbp, int max,
333 mdb->max = max; 333 mdb->max = max;
334 mdb->old = old; 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 if (!mdb->mhash) { 337 if (!mdb->mhash) {
338 kfree(mdb); 338 kfree(mdb);
339 return -ENOMEM; 339 return -ENOMEM;
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 394ff1d2791f..9393f25df08d 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1105,7 +1105,8 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1105 } 1105 }
1106 1106
1107 /* create and init array for received CAN frames */ 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 GFP_KERNEL); 1110 GFP_KERNEL);
1110 if (!op->last_frames) { 1111 if (!op->last_frames) {
1111 kfree(op->frames); 1112 kfree(op->frames);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 436e4f9cc7f0..8be6be2d9c7b 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -911,7 +911,7 @@ static noinline_for_stack int ethtool_get_sset_info(struct net_device *dev,
911 memset(&info, 0, sizeof(info)); 911 memset(&info, 0, sizeof(info));
912 info.cmd = ETHTOOL_GSSET_INFO; 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 if (!info_buf) 915 if (!info_buf)
916 return -ENOMEM; 916 return -ENOMEM;
917 917
@@ -1017,7 +1017,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
1017 if (info.cmd == ETHTOOL_GRXCLSRLALL) { 1017 if (info.cmd == ETHTOOL_GRXCLSRLALL) {
1018 if (info.rule_cnt > 0) { 1018 if (info.rule_cnt > 0) {
1019 if (info.rule_cnt <= KMALLOC_MAX_SIZE / sizeof(u32)) 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 GFP_USER); 1021 GFP_USER);
1022 if (!rule_buf) 1022 if (!rule_buf)
1023 return -ENOMEM; 1023 return -ENOMEM;
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
index dc2960be51e0..b231e40f006a 100644
--- a/net/ieee802154/nl-phy.c
+++ b/net/ieee802154/nl-phy.c
@@ -38,7 +38,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 portid,
38{ 38{
39 void *hdr; 39 void *hdr;
40 int i, pages = 0; 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 pr_debug("%s\n", __func__); 43 pr_debug("%s\n", __func__);
44 44
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 63aa39b3af03..b21833651394 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -567,7 +567,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt,
567 struct nlattr *mx; 567 struct nlattr *mx;
568 int len = 0; 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 if (!mx) 571 if (!mx)
572 return -ENOMEM; 572 return -ENOMEM;
573 573
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 6bcd1eacc1f0..1df6e97106d7 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -649,7 +649,7 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
649 649
650 hash = rcu_dereference(nh->nh_exceptions); 650 hash = rcu_dereference(nh->nh_exceptions);
651 if (!hash) { 651 if (!hash) {
652 hash = kzalloc(FNHE_HASH_SIZE * sizeof(*hash), GFP_ATOMIC); 652 hash = kcalloc(FNHE_HASH_SIZE, sizeof(*hash), GFP_ATOMIC);
653 if (!hash) 653 if (!hash)
654 goto out_unlock; 654 goto out_unlock;
655 rcu_assign_pointer(nh->nh_exceptions, hash); 655 rcu_assign_pointer(nh->nh_exceptions, hash);
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index d8c4b6374377..be491bf6ab6e 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -956,7 +956,7 @@ static int __net_init icmpv6_sk_init(struct net *net)
956 int err, i, j; 956 int err, i, j;
957 957
958 net->ipv6.icmp_sk = 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 if (!net->ipv6.icmp_sk) 960 if (!net->ipv6.icmp_sk)
961 return -ENOMEM; 961 return -ENOMEM;
962 962
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 89178b46b32f..d9558ffb8acf 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -1186,7 +1186,7 @@ static int ieee80211_chsw_switch_vifs(struct ieee80211_local *local,
1186 lockdep_assert_held(&local->mtx); 1186 lockdep_assert_held(&local->mtx);
1187 lockdep_assert_held(&local->chanctx_mtx); 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 if (!vif_chsw) 1190 if (!vif_chsw)
1191 return -ENOMEM; 1191 return -ENOMEM;
1192 1192
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 7fadfbca9f1b..76048b53c5b2 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -592,7 +592,7 @@ minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
592 max_rates = sband->n_bitrates; 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 if (!mi->r) 596 if (!mi->r)
597 goto error; 597 goto error;
598 598
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 267ab9d5137e..67ebdeaffbbc 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -1313,7 +1313,7 @@ minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
1313 if (!msp) 1313 if (!msp)
1314 return NULL; 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 if (!msp->ratelist) 1317 if (!msp->ratelist)
1318 goto error; 1318 goto error;
1319 1319
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index a3b1bcc2b461..2e917a6d239d 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -1157,7 +1157,7 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1157 } 1157 }
1158 } 1158 }
1159 1159
1160 ie = kzalloc(num_bands * iebufsz, GFP_KERNEL); 1160 ie = kcalloc(iebufsz, num_bands, GFP_KERNEL);
1161 if (!ie) { 1161 if (!ie) {
1162 ret = -ENOMEM; 1162 ret = -ENOMEM;
1163 goto out; 1163 goto out;
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 2d82c88efd0b..5e2e511c4a6f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1803,8 +1803,9 @@ static int ieee80211_reconfig_nan(struct ieee80211_sub_if_data *sdata)
1803 if (WARN_ON(res)) 1803 if (WARN_ON(res))
1804 return res; 1804 return res;
1805 1805
1806 funcs = kzalloc((sdata->local->hw.max_nan_de_entries + 1) * 1806 funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1,
1807 sizeof(*funcs), GFP_KERNEL); 1807 sizeof(*funcs),
1808 GFP_KERNEL);
1808 if (!funcs) 1809 if (!funcs)
1809 return -ENOMEM; 1810 return -ENOMEM;
1810 1811
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index cae4a026859d..f0411fbffe77 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -5303,7 +5303,7 @@ static int nf_tables_flowtable_parse_hook(const struct nft_ctx *ctx,
5303 if (err < 0) 5303 if (err < 0)
5304 return err; 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 if (!ops) 5307 if (!ops)
5308 return -ENOMEM; 5308 return -ENOMEM;
5309 5309
diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
index cb5b5f207777..e5d27b2e4eba 100644
--- a/net/netfilter/nfnetlink_cthelper.c
+++ b/net/netfilter/nfnetlink_cthelper.c
@@ -190,8 +190,9 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper,
190 if (class_max > NF_CT_MAX_EXPECT_CLASSES) 190 if (class_max > NF_CT_MAX_EXPECT_CLASSES)
191 return -EOVERFLOW; 191 return -EOVERFLOW;
192 192
193 expect_policy = kzalloc(sizeof(struct nf_conntrack_expect_policy) * 193 expect_policy = kcalloc(class_max,
194 class_max, GFP_KERNEL); 194 sizeof(struct nf_conntrack_expect_policy),
195 GFP_KERNEL);
195 if (expect_policy == NULL) 196 if (expect_policy == NULL)
196 return -ENOMEM; 197 return -ENOMEM;
197 198
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index b97eb766a1d5..93fbcafbf388 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1395,7 +1395,7 @@ static int __init nr_proto_init(void)
1395 return -1; 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 if (dev_nr == NULL) { 1399 if (dev_nr == NULL) {
1400 printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n"); 1400 printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n");
1401 return -1; 1401 return -1;
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index f81c1d0ddff4..19f6765566e7 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -47,7 +47,7 @@ static struct hlist_head *dev_table;
47 */ 47 */
48int ovs_vport_init(void) 48int 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 GFP_KERNEL); 51 GFP_KERNEL);
52 if (!dev_table) 52 if (!dev_table)
53 return -ENOMEM; 53 return -ENOMEM;
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 02deee29e7f1..b6ad38e48f62 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -163,7 +163,8 @@ static void rds_ib_add_one(struct ib_device *device)
163 rds_ibdev->max_initiator_depth = device->attrs.max_qp_init_rd_atom; 163 rds_ibdev->max_initiator_depth = device->attrs.max_qp_init_rd_atom;
164 rds_ibdev->max_responder_resources = device->attrs.max_qp_rd_atom; 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 GFP_KERNEL); 168 GFP_KERNEL);
168 if (!rds_ibdev->vector_load) { 169 if (!rds_ibdev->vector_load) {
169 pr_err("RDS/IB: %s failed to allocate vector memory\n", 170 pr_err("RDS/IB: %s failed to allocate vector memory\n",
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 5b73fea849df..ebe42e7eb456 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1514,7 +1514,8 @@ static int __init rose_proto_init(void)
1514 1514
1515 rose_callsign = null_ax25_address; 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 if (dev_rose == NULL) { 1519 if (dev_rose == NULL) {
1519 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); 1520 printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");
1520 rc = -ENOMEM; 1521 rc = -ENOMEM;
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index e64630cd3331..5b537613946f 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -482,8 +482,9 @@ int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp)
482 return 0; 482 return 0;
483 483
484 /* Allocated the array of pointers to transorms */ 484 /* Allocated the array of pointers to transorms */
485 ep->auth_hmacs = kzalloc(sizeof(struct crypto_shash *) * 485 ep->auth_hmacs = kcalloc(SCTP_AUTH_NUM_HMACS,
486 SCTP_AUTH_NUM_HMACS, gfp); 486 sizeof(struct crypto_shash *),
487 gfp);
487 if (!ep->auth_hmacs) 488 if (!ep->auth_hmacs)
488 return -ENOMEM; 489 return -ENOMEM;
489 490
diff --git a/net/smc/smc_wr.c b/net/smc/smc_wr.c
index cc7c1bb60fe8..dbd2605d1962 100644
--- a/net/smc/smc_wr.c
+++ b/net/smc/smc_wr.c
@@ -584,9 +584,9 @@ int smc_wr_alloc_link_mem(struct smc_link *link)
584 GFP_KERNEL); 584 GFP_KERNEL);
585 if (!link->wr_rx_sges) 585 if (!link->wr_rx_sges)
586 goto no_mem_wr_tx_sges; 586 goto no_mem_wr_tx_sges;
587 link->wr_tx_mask = kzalloc( 587 link->wr_tx_mask = kcalloc(BITS_TO_LONGS(SMC_WR_BUF_CNT),
588 BITS_TO_LONGS(SMC_WR_BUF_CNT) * sizeof(*link->wr_tx_mask), 588 sizeof(*link->wr_tx_mask),
589 GFP_KERNEL); 589 GFP_KERNEL);
590 if (!link->wr_tx_mask) 590 if (!link->wr_tx_mask)
591 goto no_mem_wr_rx_sges; 591 goto no_mem_wr_rx_sges;
592 link->wr_tx_pends = kcalloc(SMC_WR_BUF_CNT, 592 link->wr_tx_pends = kcalloc(SMC_WR_BUF_CNT,
diff --git a/net/sunrpc/auth_gss/gss_rpc_upcall.c b/net/sunrpc/auth_gss/gss_rpc_upcall.c
index 46b295e4f2b8..d58bd058b09b 100644
--- a/net/sunrpc/auth_gss/gss_rpc_upcall.c
+++ b/net/sunrpc/auth_gss/gss_rpc_upcall.c
@@ -224,7 +224,7 @@ static void gssp_free_receive_pages(struct gssx_arg_accept_sec_context *arg)
224static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg) 224static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg)
225{ 225{
226 arg->npages = DIV_ROUND_UP(NGROUPS_MAX * 4, PAGE_SIZE); 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 * XXX: actual pages are allocated by xdr layer in 229 * XXX: actual pages are allocated by xdr layer in
230 * xdr_partial_copy_from_skb. 230 * xdr_partial_copy_from_skb.
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index cdda4744c9b1..109fbe591e7b 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1683,7 +1683,7 @@ struct cache_detail *cache_create_net(const struct cache_detail *tmpl, struct ne
1683 if (cd == NULL) 1683 if (cd == NULL)
1684 return ERR_PTR(-ENOMEM); 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 GFP_KERNEL); 1687 GFP_KERNEL);
1688 if (cd->hash_table == NULL) { 1688 if (cd->hash_table == NULL) {
1689 kfree(cd); 1689 kfree(cd);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 07514ca011b2..c7bbe5f0aae8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -10833,7 +10833,7 @@ static int nl80211_parse_wowlan_nd(struct cfg80211_registered_device *rdev,
10833 struct nlattr **tb; 10833 struct nlattr **tb;
10834 int err; 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 if (!tb) 10837 if (!tb)
10838 return -ENOMEM; 10838 return -ENOMEM;
10839 10839
@@ -11793,7 +11793,7 @@ static int nl80211_nan_add_func(struct sk_buff *skb,
11793 11793
11794 func->srf_num_macs = n_entries; 11794 func->srf_num_macs = n_entries;
11795 func->srf_macs = 11795 func->srf_macs =
11796 kzalloc(sizeof(*func->srf_macs) * n_entries, 11796 kcalloc(n_entries, sizeof(*func->srf_macs),
11797 GFP_KERNEL); 11797 GFP_KERNEL);
11798 if (!func->srf_macs) { 11798 if (!func->srf_macs) {
11799 err = -ENOMEM; 11799 err = -ENOMEM;
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index b9e6b2cafa69..0e566a01d217 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -475,7 +475,7 @@ static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile)
475 /* currently 4 exec bits and entries 0-3 are reserved iupcx */ 475 /* currently 4 exec bits and entries 0-3 are reserved iupcx */
476 if (size > 16 - 4) 476 if (size > 16 - 4)
477 goto fail; 477 goto fail;
478 profile->file.trans.table = kzalloc(sizeof(char *) * size, 478 profile->file.trans.table = kcalloc(size, sizeof(char *),
479 GFP_KERNEL); 479 GFP_KERNEL);
480 if (!profile->file.trans.table) 480 if (!profile->file.trans.table)
481 goto fail; 481 goto fail;
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index a2d44824121c..dd2ceec06fef 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2118,7 +2118,7 @@ int security_load_policy(struct selinux_state *state, void *data, size_t len)
2118 int rc = 0; 2118 int rc = 0;
2119 struct policy_file file = { data, len }, *fp = &file; 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 if (!oldpolicydb) { 2122 if (!oldpolicydb) {
2123 rc = -ENOMEM; 2123 rc = -ENOMEM;
2124 goto out; 2124 goto out;
diff --git a/sound/firewire/fireface/ff-protocol-ff400.c b/sound/firewire/fireface/ff-protocol-ff400.c
index 12aa15df435d..ad7a0a32557d 100644
--- a/sound/firewire/fireface/ff-protocol-ff400.c
+++ b/sound/firewire/fireface/ff-protocol-ff400.c
@@ -147,7 +147,7 @@ static int ff400_switch_fetching_mode(struct snd_ff *ff, bool enable)
147 __le32 *reg; 147 __le32 *reg;
148 int i; 148 int i;
149 149
150 reg = kzalloc(sizeof(__le32) * 18, GFP_KERNEL); 150 reg = kcalloc(18, sizeof(__le32), GFP_KERNEL);
151 if (reg == NULL) 151 if (reg == NULL)
152 return -ENOMEM; 152 return -ENOMEM;
153 153
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index 908658a00377..2ada8444abd9 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -275,7 +275,7 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
275 275
276 /* Get AMIXER resource */ 276 /* Get AMIXER resource */
277 n_amixer = (n_amixer < 2) ? 2 : n_amixer; 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 if (!apcm->amixers) { 279 if (!apcm->amixers) {
280 err = -ENOMEM; 280 err = -ENOMEM;
281 goto error1; 281 goto error1;
@@ -543,18 +543,18 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
543 } 543 }
544 544
545 if (n_srcc) { 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 if (!apcm->srccs) 547 if (!apcm->srccs)
548 return -ENOMEM; 548 return -ENOMEM;
549 } 549 }
550 if (n_amixer) { 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 if (!apcm->amixers) { 552 if (!apcm->amixers) {
553 err = -ENOMEM; 553 err = -ENOMEM;
554 goto error1; 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 if (!apcm->srcimps) { 558 if (!apcm->srcimps) {
559 err = -ENOMEM; 559 err = -ENOMEM;
560 goto error1; 560 goto error1;
@@ -819,7 +819,7 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc,
819 819
820 /* Get AMIXER resource */ 820 /* Get AMIXER resource */
821 n_amixer = (n_amixer < 2) ? 2 : n_amixer; 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 if (!apcm->amixers) { 823 if (!apcm->amixers) {
824 err = -ENOMEM; 824 err = -ENOMEM;
825 goto error1; 825 goto error1;
@@ -1378,19 +1378,19 @@ static int atc_get_resources(struct ct_atc *atc)
1378 num_daios = ((atc->model == CTSB1270) ? 8 : 7); 1378 num_daios = ((atc->model == CTSB1270) ? 8 : 7);
1379 num_srcs = ((atc->model == CTSB1270) ? 6 : 4); 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 if (!atc->daios) 1382 if (!atc->daios)
1383 return -ENOMEM; 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 if (!atc->srcs) 1386 if (!atc->srcs)
1387 return -ENOMEM; 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 if (!atc->srcimps) 1390 if (!atc->srcimps)
1391 return -ENOMEM; 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 if (!atc->pcm) 1394 if (!atc->pcm)
1395 return -ENOMEM; 1395 return -ENOMEM;
1396 1396
diff --git a/sound/pci/ctxfi/ctdaio.c b/sound/pci/ctxfi/ctdaio.c
index 7f089cb433e1..f35a7341e446 100644
--- a/sound/pci/ctxfi/ctdaio.c
+++ b/sound/pci/ctxfi/ctdaio.c
@@ -398,7 +398,8 @@ static int dao_rsc_init(struct dao *dao,
398 if (err) 398 if (err)
399 return err; 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 if (!dao->imappers) { 403 if (!dao->imappers) {
403 err = -ENOMEM; 404 err = -ENOMEM;
404 goto error1; 405 goto error1;
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c
index 4f4a2a5dedb8..db710d0a609f 100644
--- a/sound/pci/ctxfi/ctmixer.c
+++ b/sound/pci/ctxfi/ctmixer.c
@@ -910,13 +910,14 @@ static int ct_mixer_get_mem(struct ct_mixer **rmixer)
910 if (!mixer) 910 if (!mixer)
911 return -ENOMEM; 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 GFP_KERNEL); 914 GFP_KERNEL);
915 if (!mixer->amixers) { 915 if (!mixer->amixers) {
916 err = -ENOMEM; 916 err = -ENOMEM;
917 goto error1; 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 if (!mixer->sums) { 921 if (!mixer->sums) {
921 err = -ENOMEM; 922 err = -ENOMEM;
922 goto error2; 923 goto error2;
diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c
index bb4c9c3c89ae..a4fc10723fc6 100644
--- a/sound/pci/ctxfi/ctsrc.c
+++ b/sound/pci/ctxfi/ctsrc.c
@@ -679,7 +679,7 @@ static int srcimp_rsc_init(struct srcimp *srcimp,
679 return err; 679 return err;
680 680
681 /* Reserve memory for imapper nodes */ 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 GFP_KERNEL); 683 GFP_KERNEL);
684 if (!srcimp->imappers) { 684 if (!srcimp->imappers) {
685 err = -ENOMEM; 685 err = -ENOMEM;
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 292e2c592c17..04e949aa01ad 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -7482,7 +7482,9 @@ static int ca0132_prepare_verbs(struct hda_codec *codec)
7482 spec->chip_init_verbs = ca0132_init_verbs0; 7482 spec->chip_init_verbs = ca0132_init_verbs0;
7483 if (spec->quirk == QUIRK_SBZ) 7483 if (spec->quirk == QUIRK_SBZ)
7484 spec->sbz_init_verbs = sbz_init_verbs; 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 if (!spec->spec_init_verbs) 7488 if (!spec->spec_init_verbs)
7487 return -ENOMEM; 7489 return -ENOMEM;
7488 7490
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 2175dccdf388..2fcdd84021a5 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1899,7 +1899,7 @@ static void *wm_adsp_read_algs(struct wm_adsp *dsp, size_t n_algs,
1899 adsp_warn(dsp, "Algorithm list end %x 0x%x != 0xbedead\n", 1899 adsp_warn(dsp, "Algorithm list end %x 0x%x != 0xbedead\n",
1900 pos + len, be32_to_cpu(val)); 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 if (!alg) 1903 if (!alg)
1904 return ERR_PTR(-ENOMEM); 1904 return ERR_PTR(-ENOMEM);
1905 1905
diff --git a/sound/soc/intel/common/sst-ipc.c b/sound/soc/intel/common/sst-ipc.c
index 62f3a8e0ec87..dcff13802c00 100644
--- a/sound/soc/intel/common/sst-ipc.c
+++ b/sound/soc/intel/common/sst-ipc.c
@@ -121,8 +121,8 @@ static int msg_empty_list_init(struct sst_generic_ipc *ipc)
121{ 121{
122 int i; 122 int i;
123 123
124 ipc->msg = kzalloc(sizeof(struct ipc_message) * 124 ipc->msg = kcalloc(IPC_EMPTY_LIST_SIZE, sizeof(struct ipc_message),
125 IPC_EMPTY_LIST_SIZE, GFP_KERNEL); 125 GFP_KERNEL);
126 if (ipc->msg == NULL) 126 if (ipc->msg == NULL)
127 return -ENOMEM; 127 return -ENOMEM;
128 128
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3d56f1fe5914..61542847cb3b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -373,8 +373,8 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
373 if (!rtd->dai_link->ops) 373 if (!rtd->dai_link->ops)
374 rtd->dai_link->ops = &null_snd_soc_ops; 374 rtd->dai_link->ops = &null_snd_soc_ops;
375 375
376 rtd->codec_dais = kzalloc(sizeof(struct snd_soc_dai *) * 376 rtd->codec_dais = kcalloc(dai_link->num_codecs,
377 dai_link->num_codecs, 377 sizeof(struct snd_soc_dai *),
378 GFP_KERNEL); 378 GFP_KERNEL);
379 if (!rtd->codec_dais) { 379 if (!rtd->codec_dais) {
380 kfree(rtd); 380 kfree(rtd);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 255cad43a972..229c12349803 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3055,7 +3055,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
3055 continue; 3055 continue;
3056 3056
3057 if (w->num_kcontrols) { 3057 if (w->num_kcontrols) {
3058 w->kcontrols = kzalloc(w->num_kcontrols * 3058 w->kcontrols = kcalloc(w->num_kcontrols,
3059 sizeof(struct snd_kcontrol *), 3059 sizeof(struct snd_kcontrol *),
3060 GFP_KERNEL); 3060 GFP_KERNEL);
3061 if (!w->kcontrols) { 3061 if (!w->kcontrols) {
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 3fd5d9c867b9..53f121a50c97 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -885,7 +885,7 @@ static int soc_tplg_denum_create_texts(struct soc_enum *se,
885 int i, ret; 885 int i, ret;
886 886
887 se->dobj.control.dtexts = 887 se->dobj.control.dtexts =
888 kzalloc(sizeof(char *) * ec->items, GFP_KERNEL); 888 kcalloc(ec->items, sizeof(char *), GFP_KERNEL);
889 if (se->dobj.control.dtexts == NULL) 889 if (se->dobj.control.dtexts == NULL)
890 return -ENOMEM; 890 return -ENOMEM;
891 891
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index 224a6a5d1c0e..2dd2518a71d3 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -591,12 +591,14 @@ static int usb6fire_pcm_buffers_init(struct pcm_runtime *rt)
591 int i; 591 int i;
592 592
593 for (i = 0; i < PCM_N_URBS; i++) { 593 for (i = 0; i < PCM_N_URBS; i++) {
594 rt->out_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB 594 rt->out_urbs[i].buffer = kcalloc(PCM_MAX_PACKET_SIZE,
595 * PCM_MAX_PACKET_SIZE, GFP_KERNEL); 595 PCM_N_PACKETS_PER_URB,
596 GFP_KERNEL);
596 if (!rt->out_urbs[i].buffer) 597 if (!rt->out_urbs[i].buffer)
597 return -ENOMEM; 598 return -ENOMEM;
598 rt->in_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB 599 rt->in_urbs[i].buffer = kcalloc(PCM_MAX_PACKET_SIZE,
599 * PCM_MAX_PACKET_SIZE, GFP_KERNEL); 600 PCM_N_PACKETS_PER_URB,
601 GFP_KERNEL);
600 if (!rt->in_urbs[i].buffer) 602 if (!rt->in_urbs[i].buffer)
601 return -ENOMEM; 603 return -ENOMEM;
602 } 604 }
diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c
index 947d6168f24a..d8a14d769f48 100644
--- a/sound/usb/line6/capture.c
+++ b/sound/usb/line6/capture.c
@@ -264,8 +264,8 @@ int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm)
264 struct usb_line6 *line6 = line6pcm->line6; 264 struct usb_line6 *line6 = line6pcm->line6;
265 int i; 265 int i;
266 266
267 line6pcm->in.urbs = kzalloc( 267 line6pcm->in.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *),
268 sizeof(struct urb *) * line6->iso_buffers, GFP_KERNEL); 268 GFP_KERNEL);
269 if (line6pcm->in.urbs == NULL) 269 if (line6pcm->in.urbs == NULL)
270 return -ENOMEM; 270 return -ENOMEM;
271 271
diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c
index 819e9b2d1d6e..dec89d2beb57 100644
--- a/sound/usb/line6/playback.c
+++ b/sound/usb/line6/playback.c
@@ -409,8 +409,8 @@ int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)
409 struct usb_line6 *line6 = line6pcm->line6; 409 struct usb_line6 *line6 = line6pcm->line6;
410 int i; 410 int i;
411 411
412 line6pcm->out.urbs = kzalloc( 412 line6pcm->out.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *),
413 sizeof(struct urb *) * line6->iso_buffers, GFP_KERNEL); 413 GFP_KERNEL);
414 if (line6pcm->out.urbs == NULL) 414 if (line6pcm->out.urbs == NULL)
415 return -ENOMEM; 415 return -ENOMEM;
416 416
diff --git a/virt/kvm/arm/vgic/vgic-v4.c b/virt/kvm/arm/vgic/vgic-v4.c
index bc4265154bac..1ed5f2286b8e 100644
--- a/virt/kvm/arm/vgic/vgic-v4.c
+++ b/virt/kvm/arm/vgic/vgic-v4.c
@@ -126,7 +126,7 @@ int vgic_v4_init(struct kvm *kvm)
126 126
127 nr_vcpus = atomic_read(&kvm->online_vcpus); 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 GFP_KERNEL); 130 GFP_KERNEL);
131 if (!dist->its_vm.vpes) 131 if (!dist->its_vm.vpes)
132 return -ENOMEM; 132 return -ENOMEM;