treewide: kzalloc() -> kcalloc()
authorKees Cook <keescook@chromium.org>
Tue, 12 Jun 2018 21:03:40 +0000 (14:03 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 12 Jun 2018 23:19:22 +0000 (16:19 -0700)
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>
484 files changed:
arch/arm/mach-footbridge/dc21285.c
arch/arm/mach-ixp4xx/common-pci.c
arch/arm/mach-omap1/mcbsp.c
arch/arm/mach-omap2/hsmmc.c
arch/arm/mach-omap2/omap_device.c
arch/arm/mach-omap2/prm_common.c
arch/arm/mach-vexpress/spc.c
arch/arm/mm/dma-mapping.c
arch/arm64/kernel/armv8_deprecated.c
arch/arm64/mm/context.c
arch/ia64/kernel/topology.c
arch/ia64/sn/kernel/io_common.c
arch/ia64/sn/pci/pcibr/pcibr_provider.c
arch/mips/alchemy/common/clock.c
arch/mips/alchemy/common/dbdma.c
arch/mips/alchemy/common/platform.c
arch/mips/alchemy/devboards/platform.c
arch/mips/bmips/dma.c
arch/mips/txx9/rbtx4939/setup.c
arch/powerpc/kernel/vdso.c
arch/powerpc/mm/numa.c
arch/powerpc/net/bpf_jit_comp.c
arch/powerpc/net/bpf_jit_comp64.c
arch/powerpc/oprofile/cell/spu_profiler.c
arch/powerpc/platforms/4xx/pci.c
arch/powerpc/platforms/powernv/opal-sysparam.c
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/xive/native.c
arch/s390/appldata/appldata_base.c
arch/s390/kernel/vdso.c
arch/sh/drivers/dma/dmabrg.c
arch/sh/drivers/pci/pcie-sh7786.c
arch/sparc/kernel/sys_sparc_64.c
arch/x86/events/amd/iommu.c
arch/x86/events/intel/uncore.c
arch/x86/kernel/cpu/mcheck/mce.c
arch/x86/kernel/cpu/mcheck/mce_amd.c
arch/x86/kernel/cpu/mtrr/if.c
arch/x86/kernel/hpet.c
arch/x86/pci/xen.c
arch/x86/platform/uv/uv_time.c
block/bio.c
block/blk-tag.c
drivers/acpi/acpi_platform.c
drivers/acpi/sysfs.c
drivers/android/binder_alloc.c
drivers/ata/libata-core.c
drivers/ata/libata-pmp.c
drivers/atm/fore200e.c
drivers/atm/iphase.c
drivers/block/drbd/drbd_main.c
drivers/block/null_blk.c
drivers/block/ps3vram.c
drivers/block/rsxx/core.c
drivers/block/rsxx/dma.c
drivers/block/xen-blkback/xenbus.c
drivers/block/xen-blkfront.c
drivers/char/agp/amd-k7-agp.c
drivers/char/agp/ati-agp.c
drivers/char/agp/sworks-agp.c
drivers/char/ipmi/ipmi_ssif.c
drivers/clk/renesas/clk-r8a7740.c
drivers/clk/renesas/clk-r8a7779.c
drivers/clk/renesas/clk-rcar-gen2.c
drivers/clk/renesas/clk-rz.c
drivers/clk/st/clkgen-fsyn.c
drivers/clk/st/clkgen-pll.c
drivers/clk/sunxi/clk-usb.c
drivers/clk/tegra/clk.c
drivers/clk/ti/apll.c
drivers/clk/ti/divider.c
drivers/clk/ti/dpll.c
drivers/clocksource/sh_cmt.c
drivers/clocksource/sh_mtu2.c
drivers/clocksource/sh_tmu.c
drivers/cpufreq/acpi-cpufreq.c
drivers/cpufreq/arm_big_little.c
drivers/cpufreq/cppc_cpufreq.c
drivers/cpufreq/ia64-acpi-cpufreq.c
drivers/cpufreq/longhaul.c
drivers/cpufreq/pxa3xx-cpufreq.c
drivers/cpufreq/s3c24xx-cpufreq.c
drivers/cpufreq/sfi-cpufreq.c
drivers/cpufreq/spear-cpufreq.c
drivers/crypto/amcc/crypto4xx_core.c
drivers/crypto/inside-secure/safexcel_hash.c
drivers/crypto/marvell/hash.c
drivers/crypto/n2_core.c
drivers/crypto/qat/qat_common/qat_uclo.c
drivers/dma/ioat/init.c
drivers/dma/mv_xor.c
drivers/dma/pl330.c
drivers/dma/sh/shdma-base.c
drivers/dma/xilinx/zynqmp_dma.c
drivers/edac/amd64_edac.c
drivers/edac/i7core_edac.c
drivers/extcon/extcon.c
drivers/firmware/dell_rbu.c
drivers/firmware/efi/capsule.c
drivers/firmware/efi/runtime-map.c
drivers/fmc/fmc-sdb.c
drivers/gpio/gpio-ml-ioh.c
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c
drivers/gpu/drm/amd/amdgpu/atom.c
drivers/gpu/drm/amd/amdgpu/ci_dpm.c
drivers/gpu/drm/amd/amdgpu/kv_dpm.c
drivers/gpu/drm/amd/amdgpu/si_dpm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
drivers/gpu/drm/amd/display/dc/basics/logger.c
drivers/gpu/drm/amd/display/dc/basics/vector.c
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
drivers/gpu/drm/amd/display/dc/gpio/gpio_service.c
drivers/gpu/drm/amd/display/modules/color/color_gamma.c
drivers/gpu/drm/amd/display/modules/freesync/freesync.c
drivers/gpu/drm/amd/display/modules/stats/stats.c
drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c
drivers/gpu/drm/i915/gvt/vgpu.c
drivers/gpu/drm/i915/intel_hdcp.c
drivers/gpu/drm/i915/selftests/intel_uncore.c
drivers/gpu/drm/nouveau/nvif/fifo.c
drivers/gpu/drm/nouveau/nvif/object.c
drivers/gpu/drm/nouveau/nvkm/core/event.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
drivers/gpu/drm/omapdrm/omap_gem.c
drivers/gpu/drm/radeon/atom.c
drivers/gpu/drm/radeon/btc_dpm.c
drivers/gpu/drm/radeon/ci_dpm.c
drivers/gpu/drm/radeon/kv_dpm.c
drivers/gpu/drm/radeon/ni_dpm.c
drivers/gpu/drm/radeon/r600_dpm.c
drivers/gpu/drm/radeon/radeon_atombios.c
drivers/gpu/drm/radeon/radeon_combios.c
drivers/gpu/drm/radeon/radeon_test.c
drivers/gpu/drm/radeon/rs780_dpm.c
drivers/gpu/drm/radeon/rv6xx_dpm.c
drivers/gpu/drm/radeon/rv770_dpm.c
drivers/gpu/drm/radeon/si_dpm.c
drivers/gpu/drm/radeon/sumo_dpm.c
drivers/gpu/drm/radeon/trinity_dpm.c
drivers/gpu/drm/selftests/test-drm_mm.c
drivers/hid/hid-debug.c
drivers/hv/hv.c
drivers/hv/ring_buffer.c
drivers/hwmon/acpi_power_meter.c
drivers/hwmon/coretemp.c
drivers/hwmon/i5k_amb.c
drivers/hwmon/ibmpex.c
drivers/i2c/busses/i2c-amd756-s4882.c
drivers/i2c/busses/i2c-nforce2-s4985.c
drivers/i2c/busses/i2c-nforce2.c
drivers/i2c/i2c-stub.c
drivers/ide/hpt366.c
drivers/ide/it821x.c
drivers/iio/imu/adis_buffer.c
drivers/iio/inkern.c
drivers/infiniband/core/cache.c
drivers/infiniband/core/device.c
drivers/infiniband/core/iwpm_util.c
drivers/infiniband/hw/cxgb3/cxio_hal.c
drivers/infiniband/hw/cxgb4/device.c
drivers/infiniband/hw/cxgb4/qp.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/mlx4/mad.c
drivers/infiniband/hw/mthca/mthca_mr.c
drivers/infiniband/hw/mthca/mthca_profile.c
drivers/infiniband/hw/nes/nes_mgt.c
drivers/infiniband/hw/nes/nes_verbs.c
drivers/infiniband/hw/ocrdma/ocrdma_hw.c
drivers/infiniband/hw/ocrdma/ocrdma_main.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/qedr/main.c
drivers/infiniband/hw/qedr/verbs.c
drivers/infiniband/hw/qib/qib_iba7322.c
drivers/infiniband/hw/qib/qib_init.c
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
drivers/infiniband/hw/usnic/usnic_vnic.c
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/isert/ib_isert.c
drivers/input/keyboard/omap4-keypad.c
drivers/iommu/dmar.c
drivers/iommu/intel-iommu.c
drivers/iommu/omap-iommu.c
drivers/ipack/carriers/tpci200.c
drivers/irqchip/irq-alpine-msi.c
drivers/irqchip/irq-gic-v2m.c
drivers/irqchip/irq-gic-v3-its.c
drivers/irqchip/irq-gic-v3.c
drivers/irqchip/irq-partition-percpu.c
drivers/irqchip/irq-s3c24xx.c
drivers/isdn/capi/capi.c
drivers/isdn/gigaset/capi.c
drivers/isdn/gigaset/i4l.c
drivers/isdn/hardware/avm/b1.c
drivers/isdn/hisax/fsm.c
drivers/isdn/i4l/isdn_common.c
drivers/isdn/mISDN/fsm.c
drivers/lightnvm/pblk-init.c
drivers/mailbox/pcc.c
drivers/md/bcache/super.c
drivers/md/dm-crypt.c
drivers/md/md-bitmap.c
drivers/md/md-cluster.c
drivers/md/md-multipath.c
drivers/md/raid0.c
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c
drivers/media/dvb-frontends/dib7000p.c
drivers/media/dvb-frontends/dib8000.c
drivers/media/dvb-frontends/dib9000.c
drivers/media/usb/au0828/au0828-video.c
drivers/media/usb/cx231xx/cx231xx-core.c
drivers/media/usb/cx231xx/cx231xx-vbi.c
drivers/media/usb/go7007/go7007-fw.c
drivers/media/usb/pvrusb2/pvrusb2-hdw.c
drivers/media/usb/pvrusb2/pvrusb2-std.c
drivers/media/usb/stk1160/stk1160-video.c
drivers/media/usb/stkwebcam/stk-webcam.c
drivers/media/usb/usbtv/usbtv-video.c
drivers/mfd/cros_ec_dev.c
drivers/mfd/mfd-core.c
drivers/mfd/timberdale.c
drivers/misc/altera-stapl/altera.c
drivers/misc/cxl/guest.c
drivers/misc/cxl/of.c
drivers/misc/genwqe/card_ddcb.c
drivers/misc/sgi-xp/xpc_main.c
drivers/misc/sgi-xp/xpc_partition.c
drivers/misc/sgi-xp/xpnet.c
drivers/misc/sram.c
drivers/mtd/ar7part.c
drivers/mtd/bcm47xxpart.c
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/devices/docg3.c
drivers/mtd/maps/physmap_of_core.c
drivers/mtd/nand/onenand/onenand_base.c
drivers/mtd/ofpart.c
drivers/mtd/parsers/parser_trx.c
drivers/mtd/parsers/sharpslpart.c
drivers/mtd/sm_ftl.c
drivers/mtd/tests/pagetest.c
drivers/mtd/ubi/wl.c
drivers/net/bonding/bond_main.c
drivers/net/can/grcan.c
drivers/net/can/slcan.c
drivers/net/ethernet/broadcom/bcm63xx_enet.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
drivers/net/ethernet/broadcom/cnic.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/brocade/bna/bnad.c
drivers/net/ethernet/calxeda/xgmac.c
drivers/net/ethernet/cavium/thunder/nicvf_queues.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
drivers/net/ethernet/cortina/gemini.c
drivers/net/ethernet/hisilicon/hns/hns_enet.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/jme.c
drivers/net/ethernet/mellanox/mlx4/alloc.c
drivers/net/ethernet/mellanox/mlx4/cmd.c
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
drivers/net/ethernet/mellanox/mlx4/main.c
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c
drivers/net/ethernet/micrel/ksz884x.c
drivers/net/ethernet/neterion/vxge/vxge-config.c
drivers/net/ethernet/neterion/vxge/vxge-main.c
drivers/net/ethernet/pasemi/pasemi_mac.c
drivers/net/ethernet/qlogic/qed/qed_debug.c
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_init_ops.c
drivers/net/ethernet/qlogic/qed/qed_l2.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
drivers/net/ethernet/socionext/netsec.c
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
drivers/net/phy/dp83640.c
drivers/net/slip/slip.c
drivers/net/team/team.c
drivers/net/usb/smsc95xx.c
drivers/net/virtio_net.c
drivers/net/wan/fsl_ucc_hdlc.c
drivers/net/wireless/ath/ath10k/htt_rx.c
drivers/net/wireless/ath/ath10k/wmi-tlv.c
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/carl9170/main.c
drivers/net/wireless/broadcom/b43/phy_n.c
drivers/net/wireless/broadcom/b43legacy/main.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c
drivers/net/wireless/intel/iwlegacy/common.c
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
drivers/net/wireless/intersil/p54/eeprom.c
drivers/net/wireless/intersil/prism54/oid_mgt.c
drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
drivers/net/wireless/marvell/mwifiex/sdio.c
drivers/net/wireless/quantenna/qtnfmac/commands.c
drivers/net/wireless/ralink/rt2x00/rt2x00debug.c
drivers/net/wireless/realtek/rtlwifi/efuse.c
drivers/net/wireless/realtek/rtlwifi/usb.c
drivers/net/wireless/st/cw1200/queue.c
drivers/net/wireless/st/cw1200/scan.c
drivers/nvmem/rockchip-efuse.c
drivers/nvmem/sunxi_sid.c
drivers/of/platform.c
drivers/of/unittest.c
drivers/opp/ti-opp-supply.c
drivers/pci/msi.c
drivers/pci/pci-sysfs.c
drivers/pcmcia/pd6729.c
drivers/pinctrl/bcm/pinctrl-bcm2835.c
drivers/pinctrl/freescale/pinctrl-mxs.c
drivers/pinctrl/pinctrl-lantiq.c
drivers/pinctrl/sirf/pinctrl-sirf.c
drivers/pinctrl/spear/pinctrl-spear.c
drivers/pinctrl/sunxi/pinctrl-sunxi.c
drivers/pinctrl/vt8500/pinctrl-wmt.c
drivers/platform/x86/alienware-wmi.c
drivers/platform/x86/intel_ips.c
drivers/platform/x86/panasonic-laptop.c
drivers/platform/x86/thinkpad_acpi.c
drivers/power/supply/wm97xx_battery.c
drivers/power/supply/z2_battery.c
drivers/powercap/powercap_sys.c
drivers/rapidio/rio-scan.c
drivers/regulator/s2mps11.c
drivers/s390/block/dcssblk.c
drivers/s390/char/keyboard.c
drivers/s390/char/vmur.c
drivers/s390/char/zcore.c
drivers/s390/cio/qdio_setup.c
drivers/s390/cio/qdio_thinint.c
drivers/s390/crypto/pkey_api.c
drivers/s390/net/ctcm_main.c
drivers/s390/net/qeth_core_main.c
drivers/scsi/BusLogic.c
drivers/scsi/aacraid/linit.c
drivers/scsi/aic7xxx/aic7xxx_core.c
drivers/scsi/aic94xx/aic94xx_hwi.c
drivers/scsi/aic94xx/aic94xx_init.c
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/bfa/bfad_attr.c
drivers/scsi/bfa/bfad_bsg.c
drivers/scsi/bnx2fc/bnx2fc_fcoe.c
drivers/scsi/bnx2fc/bnx2fc_io.c
drivers/scsi/csiostor/csio_wr.c
drivers/scsi/esas2r/esas2r_init.c
drivers/scsi/hpsa.c
drivers/scsi/ipr.c
drivers/scsi/libsas/sas_expander.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_vport.c
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fusion.c
drivers/scsi/osst.c
drivers/scsi/pm8001/pm8001_ctl.c
drivers/scsi/pmcraid.c
drivers/scsi/qedi/qedi_main.c
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla2xxx/qla_target.c
drivers/scsi/scsi_debug.c
drivers/scsi/ses.c
drivers/scsi/sg.c
drivers/scsi/smartpqi/smartpqi_init.c
drivers/scsi/st.c
drivers/sh/clk/cpg.c
drivers/sh/intc/core.c
drivers/sh/maple/maple.c
drivers/slimbus/qcom-ctrl.c
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
drivers/staging/rtlwifi/efuse.c
drivers/staging/unisys/visorhba/visorhba_main.c
drivers/target/target_core_transport.c
drivers/target/target_core_user.c
drivers/thermal/int340x_thermal/acpi_thermal_rel.c
drivers/thermal/int340x_thermal/int340x_thermal_zone.c
drivers/thermal/of-thermal.c
drivers/thermal/x86_pkg_temp_thermal.c
drivers/tty/ehv_bytechan.c
drivers/tty/goldfish.c
drivers/tty/hvc/hvc_iucv.c
drivers/tty/serial/pch_uart.c
drivers/tty/serial/serial_core.c
drivers/tty/serial/sunsab.c
drivers/uio/uio_pruss.c
drivers/usb/core/hub.c
drivers/usb/dwc2/hcd.c
drivers/usb/gadget/udc/bdc/bdc_ep.c
drivers/usb/gadget/udc/fsl_udc_core.c
drivers/usb/host/ehci-sched.c
drivers/usb/host/imx21-hcd.c
drivers/usb/mon/mon_bin.c
drivers/usb/renesas_usbhs/mod_gadget.c
drivers/usb/renesas_usbhs/pipe.c
drivers/usb/wusbcore/wa-rpipe.c
drivers/vhost/scsi.c
drivers/video/console/sticore.c
drivers/video/fbdev/broadsheetfb.c
drivers/video/fbdev/core/fbmon.c
drivers/video/fbdev/mmp/fb/mmpfb.c
drivers/video/fbdev/omap2/omapfb/dss/manager.c
drivers/video/fbdev/omap2/omapfb/dss/overlay.c
drivers/video/fbdev/uvesafb.c
drivers/video/of_display_timing.c
drivers/virt/fsl_hypervisor.c
drivers/virtio/virtio_pci_common.c
drivers/xen/arm-device.c
fs/btrfs/check-integrity.c
fs/cifs/cifssmb.c
fs/cifs/file.c
fs/ext4/extents.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/flexfilelayout/flexfilelayoutdev.c
fs/nfsd/export.c
fs/ocfs2/journal.c
fs/ocfs2/sysfile.c
fs/overlayfs/namei.c
fs/proc/proc_sysctl.c
fs/reiserfs/inode.c
fs/udf/super.c
kernel/bpf/verifier.c
kernel/debug/kdb/kdb_main.c
kernel/events/uprobes.c
kernel/locking/locktorture.c
kernel/sched/fair.c
kernel/sched/rt.c
kernel/sysctl.c
kernel/trace/ftrace.c
kernel/trace/trace.c
kernel/workqueue.c
lib/lru_cache.c
lib/mpi/mpiutil.c
mm/slab.c
mm/slub.c
net/bridge/br_multicast.c
net/can/bcm.c
net/core/ethtool.c
net/ieee802154/nl-phy.c
net/ipv4/fib_frontend.c
net/ipv4/route.c
net/ipv6/icmp.c
net/mac80211/chan.c
net/mac80211/rc80211_minstrel.c
net/mac80211/rc80211_minstrel_ht.c
net/mac80211/scan.c
net/mac80211/util.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink_cthelper.c
net/netrom/af_netrom.c
net/openvswitch/vport.c
net/rds/ib.c
net/rose/af_rose.c
net/sctp/auth.c
net/smc/smc_wr.c
net/sunrpc/auth_gss/gss_rpc_upcall.c
net/sunrpc/cache.c
net/wireless/nl80211.c
security/apparmor/policy_unpack.c
security/selinux/ss/services.c
sound/firewire/fireface/ff-protocol-ff400.c
sound/pci/ctxfi/ctatc.c
sound/pci/ctxfi/ctdaio.c
sound/pci/ctxfi/ctmixer.c
sound/pci/ctxfi/ctsrc.c
sound/pci/hda/patch_ca0132.c
sound/soc/codecs/wm_adsp.c
sound/soc/intel/common/sst-ipc.c
sound/soc/soc-core.c
sound/soc/soc-dapm.c
sound/soc/soc-topology.c
sound/usb/6fire/pcm.c
sound/usb/line6/capture.c
sound/usb/line6/playback.c
virt/kvm/arm/vgic/vgic-v4.c

index e7b350f18f5f82b993f36e5f1f258c3e58836c16..16d71bac0061b34d0257f0d226dcdb1886fc49f8 100644 (file)
@@ -252,7 +252,7 @@ int __init dc21285_setup(int nr, struct pci_sys_data *sys)
        if (nr || !footbridge_cfn_mode())
                return 0;
 
-       res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
+       res = kcalloc(2, sizeof(struct resource), GFP_KERNEL);
        if (!res) {
                printk("out of memory for root bus resources");
                return 0;
index bcf3df59f71b447aeb1880a9c9e7743bb9d92398..6835b17113e57f3e5c936c2150c6d33ce385fcd6 100644 (file)
@@ -421,7 +421,7 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
        if (nr >= 1)
                return 0;
 
-       res = kzalloc(sizeof(*res) * 2, GFP_KERNEL);
+       res = kcalloc(2, sizeof(*res), GFP_KERNEL);
        if (res == NULL) {
                /* 
                 * If we're out of memory this early, something is wrong,
index 8ed67f8d1762f3bc5937e46c0519b816d135cddf..27e22e702f96a9e09a87366cd6a695c7bbd46023 100644 (file)
@@ -389,7 +389,7 @@ static void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
 {
        int i;
 
-       omap_mcbsp_devices = kzalloc(size * sizeof(struct platform_device *),
+       omap_mcbsp_devices = kcalloc(size, sizeof(struct platform_device *),
                                     GFP_KERNEL);
        if (!omap_mcbsp_devices) {
                printk(KERN_ERR "Could not register McBSP devices\n");
index b064066d431c2b0e0cd664a5058acc7dca68e92e..9344035d537f05ae9597ff3728e3f6106a6aa23b 100644 (file)
@@ -35,7 +35,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
 {
        char *hc_name;
 
-       hc_name = kzalloc(sizeof(char) * (HSMMC_NAME_LEN + 1), GFP_KERNEL);
+       hc_name = kzalloc(HSMMC_NAME_LEN + 1, GFP_KERNEL);
        if (!hc_name) {
                kfree(hc_name);
                return -ENOMEM;
index 3b829a50d1dbb6258f7e8a18bc6a042c0c2c6ea3..06b6bca3a1799dbf4cc43408071b9c207a0a987e 100644 (file)
@@ -155,7 +155,7 @@ static int omap_device_build_from_dt(struct platform_device *pdev)
        if (!omap_hwmod_parse_module_range(NULL, node, &res))
                return -ENODEV;
 
-       hwmods = kzalloc(sizeof(struct omap_hwmod *) * oh_cnt, GFP_KERNEL);
+       hwmods = kcalloc(oh_cnt, sizeof(struct omap_hwmod *), GFP_KERNEL);
        if (!hwmods) {
                ret = -ENOMEM;
                goto odbfd_exit;
@@ -405,7 +405,7 @@ omap_device_copy_resources(struct omap_hwmod *oh,
                goto error;
        }
 
-       res = kzalloc(sizeof(*res) * 2, GFP_KERNEL);
+       res = kcalloc(2, sizeof(*res), GFP_KERNEL);
        if (!res)
                return -ENOMEM;
 
index 021b5a8b9c0a6200ca6b8632fdc130fc3735ce54..058a37e6d11c34955ab37f4df9833cdb0166fb6c 100644 (file)
@@ -285,10 +285,11 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
 
        prcm_irq_setup = irq_setup;
 
-       prcm_irq_chips = kzalloc(sizeof(void *) * nr_regs, GFP_KERNEL);
-       prcm_irq_setup->saved_mask = kzalloc(sizeof(u32) * nr_regs, GFP_KERNEL);
-       prcm_irq_setup->priority_mask = kzalloc(sizeof(u32) * nr_regs,
-               GFP_KERNEL);
+       prcm_irq_chips = kcalloc(nr_regs, sizeof(void *), GFP_KERNEL);
+       prcm_irq_setup->saved_mask = kcalloc(nr_regs, sizeof(u32),
+                                            GFP_KERNEL);
+       prcm_irq_setup->priority_mask = kcalloc(nr_regs, sizeof(u32),
+                                               GFP_KERNEL);
 
        if (!prcm_irq_chips || !prcm_irq_setup->saved_mask ||
            !prcm_irq_setup->priority_mask)
index 21c064267af5a4f95df0052a944b0ebf0490215d..0f5381d1349418c5de2723be59811be30a402f8e 100644 (file)
@@ -403,7 +403,7 @@ static int ve_spc_populate_opps(uint32_t cluster)
        uint32_t data = 0, off, ret, idx;
        struct ve_spc_opp *opps;
 
-       opps = kzalloc(sizeof(*opps) * MAX_OPPS, GFP_KERNEL);
+       opps = kcalloc(MAX_OPPS, sizeof(*opps), GFP_KERNEL);
        if (!opps)
                return -ENOMEM;
 
index af27f1c22d93b81c5017b01cf2d89af8c01ceefa..be0fa7e39c2621ea4a9a83744e513f4d62d246c4 100644 (file)
@@ -2162,8 +2162,8 @@ arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size)
                goto err;
 
        mapping->bitmap_size = bitmap_size;
-       mapping->bitmaps = kzalloc(extensions * sizeof(unsigned long *),
-                               GFP_KERNEL);
+       mapping->bitmaps = kcalloc(extensions, sizeof(unsigned long *),
+                                  GFP_KERNEL);
        if (!mapping->bitmaps)
                goto err2;
 
index 97d45d5151d42a813a2be2eaee8f224ea7c9480c..d4707abb2f1678fb67cd8d83aa6da5f0ef1ce227 100644 (file)
@@ -234,8 +234,8 @@ static void __init register_insn_emulation_sysctl(void)
        struct insn_emulation *insn;
        struct ctl_table *insns_sysctl, *sysctl;
 
-       insns_sysctl = kzalloc(sizeof(*sysctl) * (nr_insn_emulated + 1),
-                             GFP_KERNEL);
+       insns_sysctl = kcalloc(nr_insn_emulated + 1, sizeof(*sysctl),
+                              GFP_KERNEL);
 
        raw_spin_lock_irqsave(&insn_emulation_lock, flags);
        list_for_each_entry(insn, &insn_emulation, node) {
index 301417ae2ba815507e1d3ed1abfccd197973ecf2..c127f94da8e2854bc3a3156f4dbe31126618c559 100644 (file)
@@ -263,7 +263,7 @@ static int asids_init(void)
         */
        WARN_ON(NUM_USER_ASIDS - 1 <= num_possible_cpus());
        atomic64_set(&asid_generation, ASID_FIRST_VERSION);
-       asid_map = kzalloc(BITS_TO_LONGS(NUM_USER_ASIDS) * sizeof(*asid_map),
+       asid_map = kcalloc(BITS_TO_LONGS(NUM_USER_ASIDS), sizeof(*asid_map),
                           GFP_KERNEL);
        if (!asid_map)
                panic("Failed to allocate bitmap for %lu ASIDs\n",
index d76529cbff2003d4746d2a2b7bbf9b4b2d08044c..9b820f7a6a989704e4ffbd25cdfc5a247f85f341 100644 (file)
@@ -85,7 +85,7 @@ static int __init topology_init(void)
        }
 #endif
 
-       sysfs_cpus = kzalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL);
+       sysfs_cpus = kcalloc(NR_CPUS, sizeof(struct ia64_cpu), GFP_KERNEL);
        if (!sysfs_cpus)
                panic("kzalloc in topology_init failed - NR_CPUS too big?");
 
@@ -319,8 +319,8 @@ static int cpu_cache_sysfs_init(unsigned int cpu)
                return -1;
        }
 
-       this_cache=kzalloc(sizeof(struct cache_info)*unique_caches,
-                       GFP_KERNEL);
+       this_cache=kcalloc(unique_caches, sizeof(struct cache_info),
+                          GFP_KERNEL);
        if (this_cache == NULL)
                return -ENOMEM;
 
index 8479e9a7ce163f1a670a3c15710384f449d0a364..102aabad6d20afdb9bfff0804311d4fd683a138c 100644 (file)
@@ -132,7 +132,7 @@ static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
        printk_once(KERN_WARNING
                "PROM version < 4.50 -- implementing old PROM flush WAR\n");
 
-       war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL);
+       war_list = kcalloc(DEV_PER_WIDGET, sizeof(*war_list), GFP_KERNEL);
        BUG_ON(!war_list);
 
        SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
index 8dbbef4a4f47be7c6dfa86db4df89c870b7dac6a..7195df1da121fba60ffe69bba64f937fe812e334 100644 (file)
@@ -184,7 +184,7 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
        /* Setup the PMU ATE map */
        soft->pbi_int_ate_resource.lowest_free_index = 0;
        soft->pbi_int_ate_resource.ate =
-           kzalloc(soft->pbi_int_ate_size * sizeof(u64), GFP_KERNEL);
+           kcalloc(soft->pbi_int_ate_size, sizeof(u64), GFP_KERNEL);
 
        if (!soft->pbi_int_ate_resource.ate) {
                kfree(soft);
index 6b6f6851df92b68fdaaa19f2fa6f7dead54b9395..d129475fd40dee71e759d4679c3b9eac48c24e91 100644 (file)
@@ -985,7 +985,7 @@ static int __init alchemy_clk_setup_imux(int ctype)
                return -ENODEV;
        }
 
-       a = kzalloc((sizeof(*a)) * 6, GFP_KERNEL);
+       a = kcalloc(6, sizeof(*a), GFP_KERNEL);
        if (!a)
                return -ENOMEM;
 
index 24b04758cce522c57c0499db68f64a5f6ea4d453..4ca2c28878e0f7bc970975e75b9458fd3d4ddd8f 100644 (file)
@@ -1050,7 +1050,7 @@ static int __init dbdma_setup(unsigned int irq, dbdev_tab_t *idtable)
 {
        int ret;
 
-       dbdev_tab = kzalloc(sizeof(dbdev_tab_t) * DBDEV_TAB_SIZE, GFP_KERNEL);
+       dbdev_tab = kcalloc(DBDEV_TAB_SIZE, sizeof(dbdev_tab_t), GFP_KERNEL);
        if (!dbdev_tab)
                return -ENOMEM;
 
index d77a64f4c78ba2b6c1353373bc41969d7c8d1e4a..1454d9f6ab2d425d7828c6b934e21314e1cb2449 100644 (file)
@@ -115,7 +115,7 @@ static void __init alchemy_setup_uarts(int ctype)
        uartclk = clk_get_rate(clk);
        clk_put(clk);
 
-       ports = kzalloc(s * (c + 1), GFP_KERNEL);
+       ports = kcalloc(s, (c + 1), GFP_KERNEL);
        if (!ports) {
                printk(KERN_INFO "Alchemy: no memory for UART data\n");
                return;
@@ -198,7 +198,7 @@ static unsigned long alchemy_ehci_data[][2] __initdata = {
 
 static int __init _new_usbres(struct resource **r, struct platform_device **d)
 {
-       *r = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
+       *r = kcalloc(2, sizeof(struct resource), GFP_KERNEL);
        if (!*r)
                return -ENOMEM;
        *d = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
index 4640edab207c4cb5a3a1c44e4f7255669eaf344e..203854ddd1bb34df9ff90eae917c72515524aa41 100644 (file)
@@ -103,7 +103,7 @@ int __init db1x_register_pcmcia_socket(phys_addr_t pcmcia_attr_start,
        if (stschg_irq)
                cnt++;
 
-       sr = kzalloc(sizeof(struct resource) * cnt, GFP_KERNEL);
+       sr = kcalloc(cnt, sizeof(struct resource), GFP_KERNEL);
        if (!sr)
                return -ENOMEM;
 
@@ -178,7 +178,7 @@ int __init db1x_register_norflash(unsigned long size, int width,
                return -EINVAL;
 
        ret = -ENOMEM;
-       parts = kzalloc(sizeof(struct mtd_partition) * 5, GFP_KERNEL);
+       parts = kcalloc(5, sizeof(struct mtd_partition), GFP_KERNEL);
        if (!parts)
                goto out;
 
index 04790f4e1805b5cc4ae5623757baada034e78814..6dec30842b2f44515b3e272e94eb31d88dce976a 100644 (file)
@@ -94,7 +94,7 @@ static int __init bmips_init_dma_ranges(void)
                goto out_bad;
 
        /* add a dummy (zero) entry at the end as a sentinel */
-       bmips_dma_ranges = kzalloc(sizeof(struct bmips_dma_range) * (len + 1),
+       bmips_dma_ranges = kcalloc(len + 1, sizeof(struct bmips_dma_range),
                                   GFP_KERNEL);
        if (!bmips_dma_ranges)
                goto out_bad;
index fd26fadc86171d52a757f521617863d9fa1d3b7c..ef29a9c2ffd602e1d6e1ed30ba0860a773f6a1aa 100644 (file)
@@ -219,7 +219,7 @@ static int __init rbtx4939_led_probe(struct platform_device *pdev)
                "nand-disk",
        };
 
-       leds_data = kzalloc(sizeof(*leds_data) * RBTX4939_MAX_7SEGLEDS,
+       leds_data = kcalloc(RBTX4939_MAX_7SEGLEDS, sizeof(*leds_data),
                            GFP_KERNEL);
        if (!leds_data)
                return -ENOMEM;
index b44ec104a5a16178662f021b768106bb43cda8dd..d2205b97628cdd604114f777d26bf44606c58400 100644 (file)
@@ -791,7 +791,7 @@ static int __init vdso_init(void)
 
 #ifdef CONFIG_VDSO32
        /* Make sure pages are in the correct state */
-       vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 2),
+       vdso32_pagelist = kcalloc(vdso32_pages + 2, sizeof(struct page *),
                                  GFP_KERNEL);
        BUG_ON(vdso32_pagelist == NULL);
        for (i = 0; i < vdso32_pages; i++) {
@@ -805,7 +805,7 @@ static int __init vdso_init(void)
 #endif
 
 #ifdef CONFIG_PPC64
-       vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 2),
+       vdso64_pagelist = kcalloc(vdso64_pages + 2, sizeof(struct page *),
                                  GFP_KERNEL);
        BUG_ON(vdso64_pagelist == NULL);
        for (i = 0; i < vdso64_pages; i++) {
index 57a5029b4521b0ea0f179b259ee3bef4dc0cfde5..0c7e05d8924481f3e4b3fca1d23cb293bab5320d 100644 (file)
@@ -1316,7 +1316,7 @@ int numa_update_cpu_topology(bool cpus_locked)
        if (!weight)
                return 0;
 
-       updates = kzalloc(weight * (sizeof(*updates)), GFP_KERNEL);
+       updates = kcalloc(weight, sizeof(*updates), GFP_KERNEL);
        if (!updates)
                return 0;
 
index a9636d8cba153a1fb43469c1b8070b59ae4ba210..5b061fc81df30a2c0d6065518b05d46ce568f290 100644 (file)
@@ -566,7 +566,7 @@ void bpf_jit_compile(struct bpf_prog *fp)
        if (!bpf_jit_enable)
                return;
 
-       addrs = kzalloc((flen+1) * sizeof(*addrs), GFP_KERNEL);
+       addrs = kcalloc(flen + 1, sizeof(*addrs), GFP_KERNEL);
        if (addrs == NULL)
                return;
 
index f1c95779843bcf3f603d22af7d1d1f50263b473d..380cbf9a40d98f76718f22d6e6b5ffa6c1cd25bc 100644 (file)
@@ -949,7 +949,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
                goto skip_init_ctx;
        }
 
-       addrs = kzalloc((flen+1) * sizeof(*addrs), GFP_KERNEL);
+       addrs = kcalloc(flen + 1, sizeof(*addrs), GFP_KERNEL);
        if (addrs == NULL) {
                fp = org_fp;
                goto out_addrs;
index 5182f2936af2c8c718ee06e65a837d174fa88d19..4e099e556645ad082de4c24e58ef07e108bf0947 100644 (file)
@@ -210,8 +210,8 @@ int start_spu_profiling_cycles(unsigned int cycles_reset)
        timer.function = profile_spus;
 
        /* Allocate arrays for collecting SPU PC samples */
-       samples = kzalloc(SPUS_PER_NODE *
-                         TRACE_ARRAY_SIZE * sizeof(u32), GFP_KERNEL);
+       samples = kcalloc(SPUS_PER_NODE * TRACE_ARRAY_SIZE, sizeof(u32),
+                         GFP_KERNEL);
 
        if (!samples)
                return -ENOMEM;
index 73e6b36bcd5125724a0c913d745e1a4bab9b1133..5aca523551aed01706cc125947fa6ac84216de7a 100644 (file)
@@ -1449,7 +1449,7 @@ static int __init ppc4xx_pciex_check_core_init(struct device_node *np)
        count = ppc4xx_pciex_hwops->core_init(np);
        if (count > 0) {
                ppc4xx_pciex_ports =
-                      kzalloc(count * sizeof(struct ppc4xx_pciex_port),
+                      kcalloc(count, sizeof(struct ppc4xx_pciex_port),
                               GFP_KERNEL);
                if (ppc4xx_pciex_ports) {
                        ppc4xx_pciex_port_count = count;
index 6fd4092798d5f5b415cd73e26211ddfc26e0359f..9aa87df114fd10782a432fd4aa37b993a7e88fd6 100644 (file)
@@ -198,21 +198,21 @@ void __init opal_sys_param_init(void)
                goto out_param_buf;
        }
 
-       id = kzalloc(sizeof(*id) * count, GFP_KERNEL);
+       id = kcalloc(count, sizeof(*id), GFP_KERNEL);
        if (!id) {
                pr_err("SYSPARAM: Failed to allocate memory to read parameter "
                                "id\n");
                goto out_param_buf;
        }
 
-       size = kzalloc(sizeof(*size) * count, GFP_KERNEL);
+       size = kcalloc(count, sizeof(*size), GFP_KERNEL);
        if (!size) {
                pr_err("SYSPARAM: Failed to allocate memory to read parameter "
                                "size\n");
                goto out_free_id;
        }
 
-       perm = kzalloc(sizeof(*perm) * count, GFP_KERNEL);
+       perm = kcalloc(count, sizeof(*perm), GFP_KERNEL);
        if (!perm) {
                pr_err("SYSPARAM: Failed to allocate memory to read supported "
                                "action on the parameter");
@@ -235,7 +235,7 @@ void __init opal_sys_param_init(void)
                goto out_free_perm;
        }
 
-       attr = kzalloc(sizeof(*attr) * count, GFP_KERNEL);
+       attr = kcalloc(count, sizeof(*attr), GFP_KERNEL);
        if (!attr) {
                pr_err("SYSPARAM: Failed to allocate memory for parameter "
                                "attributes\n");
index df062a154ca8816bf0812f5fd209c034e6dab954..353b43972bbffd122699700f16751e93b6748474 100644 (file)
@@ -544,7 +544,7 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
        printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n");
 
        /* Allocate fixups array */
-       mpic->fixups = kzalloc(128 * sizeof(*mpic->fixups), GFP_KERNEL);
+       mpic->fixups = kcalloc(128, sizeof(*mpic->fixups), GFP_KERNEL);
        BUG_ON(mpic->fixups == NULL);
 
        /* Init spinlock */
@@ -1324,7 +1324,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        if (psrc) {
                /* Allocate a bitmap with one bit per interrupt */
                unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1);
-               mpic->protected = kzalloc(mapsize*sizeof(long), GFP_KERNEL);
+               mpic->protected = kcalloc(mapsize, sizeof(long), GFP_KERNEL);
                BUG_ON(mpic->protected == NULL);
                for (i = 0; i < psize/sizeof(u32); i++) {
                        if (psrc[i] > intvec_top)
index 83bcd72b21cf7820a6da70698eb1c8e6bf49ae09..311185b9960a1b755d19313d6da55217c73d90c0 100644 (file)
@@ -489,7 +489,7 @@ static bool xive_parse_provisioning(struct device_node *np)
        if (rc == 0)
                return true;
 
-       xive_provision_chips = kzalloc(4 * xive_provision_chip_count,
+       xive_provision_chips = kcalloc(4, xive_provision_chip_count,
                                       GFP_KERNEL);
        if (WARN_ON(!xive_provision_chips))
                return false;
index cb6e8066b1ad64b1a65ee441e3c1fb53e5599a8b..ee6a9c387c8796cb8bc035c052d0806f6cec4dae 100644 (file)
@@ -391,7 +391,7 @@ int appldata_register_ops(struct appldata_ops *ops)
        if (ops->size > APPLDATA_MAX_REC_SIZE)
                return -EINVAL;
 
-       ops->ctl_table = kzalloc(4 * sizeof(struct ctl_table), GFP_KERNEL);
+       ops->ctl_table = kcalloc(4, sizeof(struct ctl_table), GFP_KERNEL);
        if (!ops->ctl_table)
                return -ENOMEM;
 
index f3a1c7c6824ef0da8933fbb64864fdf5b97bd99a..09abae40f9178a9d8789d9ef647fc85b74fcc82b 100644 (file)
@@ -285,7 +285,7 @@ static int __init vdso_init(void)
                         + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1;
 
        /* Make sure pages are in the correct state */
-       vdso32_pagelist = kzalloc(sizeof(struct page *) * (vdso32_pages + 1),
+       vdso32_pagelist = kcalloc(vdso32_pages + 1, sizeof(struct page *),
                                  GFP_KERNEL);
        BUG_ON(vdso32_pagelist == NULL);
        for (i = 0; i < vdso32_pages - 1; i++) {
@@ -303,7 +303,7 @@ static int __init vdso_init(void)
                         + PAGE_SIZE - 1) >> PAGE_SHIFT) + 1;
 
        /* Make sure pages are in the correct state */
-       vdso64_pagelist = kzalloc(sizeof(struct page *) * (vdso64_pages + 1),
+       vdso64_pagelist = kcalloc(vdso64_pages + 1, sizeof(struct page *),
                                  GFP_KERNEL);
        BUG_ON(vdso64_pagelist == NULL);
        for (i = 0; i < vdso64_pages - 1; i++) {
index c0dd904483c76ffb4d1d53a4f53ac29974b393cf..e5a57a109d6ce03cf2cabf628a595425fdf2ed8f 100644 (file)
@@ -154,7 +154,7 @@ static int __init dmabrg_init(void)
        unsigned long or;
        int ret;
 
-       dmabrg_handlers = kzalloc(10 * sizeof(struct dmabrg_handler),
+       dmabrg_handlers = kcalloc(10, sizeof(struct dmabrg_handler),
                                  GFP_KERNEL);
        if (!dmabrg_handlers)
                return -ENOMEM;
index 382e7ecf4c82d096a8ecd2fd807727f1132fb04e..3d81a8b809427907754053549caa7aff654c6dcd 100644 (file)
@@ -561,7 +561,7 @@ static int __init sh7786_pcie_init(void)
        if (unlikely(nr_ports == 0))
                return -ENODEV;
 
-       sh7786_pcie_ports = kzalloc(nr_ports * sizeof(struct sh7786_pcie_port),
+       sh7786_pcie_ports = kcalloc(nr_ports, sizeof(struct sh7786_pcie_port),
                                    GFP_KERNEL);
        if (unlikely(!sh7786_pcie_ports))
                return -ENOMEM;
index 33e351704f9ff91cb14749b2c1d150a5cc337207..63baa8aa94142b9da0a2cdf9022b7f54d0761a74 100644 (file)
@@ -565,7 +565,8 @@ SYSCALL_DEFINE5(utrap_install, utrap_entry_t, type,
        }
        if (!current_thread_info()->utraps) {
                current_thread_info()->utraps =
-                       kzalloc((UT_TRAP_INSTRUCTION_31+1)*sizeof(long), GFP_KERNEL);
+                       kcalloc(UT_TRAP_INSTRUCTION_31 + 1, sizeof(long),
+                               GFP_KERNEL);
                if (!current_thread_info()->utraps)
                        return -ENOMEM;
                current_thread_info()->utraps[0] = 1;
index 38b5d41b0c37d6d4b76237060bee30b7de2ff049..3210fee27e7f9ac55a844d9709dc31ff14907e9c 100644 (file)
@@ -387,7 +387,7 @@ static __init int _init_events_attrs(void)
        while (amd_iommu_v2_event_descs[i].attr.attr.name)
                i++;
 
-       attrs = kzalloc(sizeof(struct attribute **) * (i + 1), GFP_KERNEL);
+       attrs = kcalloc(i + 1, sizeof(struct attribute **), GFP_KERNEL);
        if (!attrs)
                return -ENOMEM;
 
index e15cfad4f89bf43ccc354668626a0e2976014134..27a461414b306851d70ca2438d054a43d8aa9fed 100644 (file)
@@ -868,7 +868,7 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
        size_t size;
        int i, j;
 
-       pmus = kzalloc(sizeof(*pmus) * type->num_boxes, GFP_KERNEL);
+       pmus = kcalloc(type->num_boxes, sizeof(*pmus), GFP_KERNEL);
        if (!pmus)
                return -ENOMEM;
 
index cd76380af79fbbdd2a17cf356f8fd5cd72968290..e4cf6ff1c2e1d341bb5ca890cd8dba266ce2aa18 100644 (file)
@@ -1457,7 +1457,7 @@ static int __mcheck_cpu_mce_banks_init(void)
        int i;
        u8 num_banks = mca_cfg.banks;
 
-       mce_banks = kzalloc(num_banks * sizeof(struct mce_bank), GFP_KERNEL);
+       mce_banks = kcalloc(num_banks, sizeof(struct mce_bank), GFP_KERNEL);
        if (!mce_banks)
                return -ENOMEM;
 
index f591b01930db4abf6740b41d588644e0facbd61e..dd33c357548f11c0ac21c367d0edc20b34671218 100644 (file)
@@ -1384,7 +1384,7 @@ int mce_threshold_create_device(unsigned int cpu)
        if (bp)
                return 0;
 
-       bp = kzalloc(sizeof(struct threshold_bank *) * mca_cfg.banks,
+       bp = kcalloc(mca_cfg.banks, sizeof(struct threshold_bank *),
                     GFP_KERNEL);
        if (!bp)
                return -ENOMEM;
index c610f47373e443ccd4b44441b5a631009e8f43a6..4021d3859499c77c14eaa1c40864c752547df68c 100644 (file)
@@ -43,7 +43,7 @@ mtrr_file_add(unsigned long base, unsigned long size,
 
        max = num_var_ranges;
        if (fcount == NULL) {
-               fcount = kzalloc(max * sizeof *fcount, GFP_KERNEL);
+               fcount = kcalloc(max, sizeof(*fcount), GFP_KERNEL);
                if (!fcount)
                        return -ENOMEM;
                FILE_FCOUNT(file) = fcount;
index ddccdea0b63b5b28c60b723069ad6938fa4f5bab..346b24883911dc2296b518653c03b15a81edfc52 100644 (file)
@@ -610,7 +610,7 @@ static void hpet_msi_capability_lookup(unsigned int start_timer)
        if (!hpet_domain)
                return;
 
-       hpet_devs = kzalloc(sizeof(struct hpet_dev) * num_timers, GFP_KERNEL);
+       hpet_devs = kcalloc(num_timers, sizeof(struct hpet_dev), GFP_KERNEL);
        if (!hpet_devs)
                return;
 
index 9542a746dc50ed62d1d34b98a368f5d85b5be6d5..9112d1cb397bb56faa637216f1e39815c50edd9d 100644 (file)
@@ -168,7 +168,7 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
        if (type == PCI_CAP_ID_MSI && nvec > 1)
                return 1;
 
-       v = kzalloc(sizeof(int) * max(1, nvec), GFP_KERNEL);
+       v = kcalloc(max(1, nvec), sizeof(int), GFP_KERNEL);
        if (!v)
                return -ENOMEM;
 
index b082d71b08eed6b486b1a9956adc71431dd7b7d8..a36b368eea0840b1a4765b8ac6e23191468ce5f9 100644 (file)
@@ -158,7 +158,7 @@ static __init int uv_rtc_allocate_timers(void)
 {
        int cpu;
 
-       blade_info = kzalloc(uv_possible_blades * sizeof(void *), GFP_KERNEL);
+       blade_info = kcalloc(uv_possible_blades, sizeof(void *), GFP_KERNEL);
        if (!blade_info)
                return -ENOMEM;
 
index db9a40e9a136b262f92b2bb13789e18dea3dcd85..9710e275f23079b8b7548ee935ab653036e82c5d 100644 (file)
@@ -2091,7 +2091,8 @@ static int __init init_bio(void)
 {
        bio_slab_max = 2;
        bio_slab_nr = 0;
-       bio_slabs = kzalloc(bio_slab_max * sizeof(struct bio_slab), GFP_KERNEL);
+       bio_slabs = kcalloc(bio_slab_max, sizeof(struct bio_slab),
+                           GFP_KERNEL);
        if (!bio_slabs)
                panic("bio: can't allocate bios\n");
 
index 09f19c6c52ceb209868485e7a824c282df2b6fe6..24b20d86bcbcb3f160498fdf3eb5409f9a8730f4 100644 (file)
@@ -99,12 +99,12 @@ init_tag_map(struct request_queue *q, struct blk_queue_tag *tags, int depth)
                       __func__, depth);
        }
 
-       tag_index = kzalloc(depth * sizeof(struct request *), GFP_ATOMIC);
+       tag_index = kcalloc(depth, sizeof(struct request *), GFP_ATOMIC);
        if (!tag_index)
                goto fail;
 
        nr_ulongs = ALIGN(depth, BITS_PER_LONG) / BITS_PER_LONG;
-       tag_map = kzalloc(nr_ulongs * sizeof(unsigned long), GFP_ATOMIC);
+       tag_map = kcalloc(nr_ulongs, sizeof(unsigned long), GFP_ATOMIC);
        if (!tag_map)
                goto fail;
 
index 88cd949003f3e397175579621b2513da257d7895..eaa60c94205a82f685190a5c0790d6ca91df69cb 100644 (file)
@@ -82,7 +82,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
        if (count < 0) {
                return NULL;
        } else if (count > 0) {
-               resources = kzalloc(count * sizeof(struct resource),
+               resources = kcalloc(count, sizeof(struct resource),
                                    GFP_KERNEL);
                if (!resources) {
                        dev_err(&adev->dev, "No memory for resources\n");
index 4fc59c3bc6734406831ef665aceb54205629ce96..41324f0b1bee26b73a55ddc027fb8f52928a31a5 100644 (file)
@@ -857,12 +857,12 @@ void acpi_irq_stats_init(void)
        num_gpes = acpi_current_gpe_count;
        num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA;
 
-       all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1),
+       all_attrs = kcalloc(num_counters + 1, sizeof(struct attribute *),
                            GFP_KERNEL);
        if (all_attrs == NULL)
                return;
 
-       all_counters = kzalloc(sizeof(struct event_counter) * (num_counters),
+       all_counters = kcalloc(num_counters, sizeof(struct event_counter),
                               GFP_KERNEL);
        if (all_counters == NULL)
                goto fail;
@@ -871,7 +871,7 @@ void acpi_irq_stats_init(void)
        if (ACPI_FAILURE(status))
                goto fail;
 
-       counter_attrs = kzalloc(sizeof(struct kobj_attribute) * (num_counters),
+       counter_attrs = kcalloc(num_counters, sizeof(struct kobj_attribute),
                                GFP_KERNEL);
        if (counter_attrs == NULL)
                goto fail;
index 4f382d51def11f4816694be6e7e02aa1598f720f..2628806c64a2265cead6a13cec928ba785267677 100644 (file)
@@ -692,8 +692,8 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc,
                }
        }
 #endif
-       alloc->pages = kzalloc(sizeof(alloc->pages[0]) *
-                                  ((vma->vm_end - vma->vm_start) / PAGE_SIZE),
+       alloc->pages = kcalloc((vma->vm_end - vma->vm_start) / PAGE_SIZE,
+                              sizeof(alloc->pages[0]),
                               GFP_KERNEL);
        if (alloc->pages == NULL) {
                ret = -ENOMEM;
index c41b9eeabe7c748d86bd4c64ba04f92f734e0e3c..27d15ed7fa3d03771f020cf064749f6f9fe38633 100644 (file)
@@ -6987,7 +6987,7 @@ static void __init ata_parse_force_param(void)
                if (*p == ',')
                        size++;
 
-       ata_force_tbl = kzalloc(sizeof(ata_force_tbl[0]) * size, GFP_KERNEL);
+       ata_force_tbl = kcalloc(size, sizeof(ata_force_tbl[0]), GFP_KERNEL);
        if (!ata_force_tbl) {
                printk(KERN_WARNING "ata: failed to extend force table, "
                       "libata.force ignored\n");
index 85aa76116a305eb50d77f2544c87f09914998bed..2ae1799f49927231f16cf49cbfb872607c128ea3 100644 (file)
@@ -340,7 +340,7 @@ static int sata_pmp_init_links (struct ata_port *ap, int nr_ports)
        int i, err;
 
        if (!pmp_link) {
-               pmp_link = kzalloc(sizeof(pmp_link[0]) * SATA_PMP_MAX_PORTS,
+               pmp_link = kcalloc(SATA_PMP_MAX_PORTS, sizeof(pmp_link[0]),
                                   GFP_NOIO);
                if (!pmp_link)
                        return -ENOMEM;
index 6ebc4e4820fc4b267351970047e29a7c700902cc..99a38115b0a8fcdf4fc3037802f050a89b9d8ee1 100644 (file)
@@ -2094,7 +2094,8 @@ static int fore200e_alloc_rx_buf(struct fore200e *fore200e)
            DPRINTK(2, "rx buffers %d / %d are being allocated\n", scheme, magn);
 
            /* allocate the array of receive buffers */
-           buffer = bsq->buffer = kzalloc(nbr * sizeof(struct buffer), GFP_KERNEL);
+           buffer = bsq->buffer = kcalloc(nbr, sizeof(struct buffer),
+                                           GFP_KERNEL);
 
            if (buffer == NULL)
                return -ENOMEM;
index be076606d30e09cb3b56fe779059cd892ef796b8..ff81a576347e5154c10c997717548be69e81bbab 100644 (file)
@@ -1618,7 +1618,7 @@ static int rx_init(struct atm_dev *dev)
        skb_queue_head_init(&iadev->rx_dma_q);  
        iadev->rx_free_desc_qhead = NULL;   
 
-       iadev->rx_open = kzalloc(4 * iadev->num_vc, GFP_KERNEL);
+       iadev->rx_open = kcalloc(4, iadev->num_vc, GFP_KERNEL);
        if (!iadev->rx_open) {
                printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n",
                dev->number);  
index 7655d6133139961a26e02df3de444a7950683436..a80809bd305715c92015292413ccd19ec2bb253b 100644 (file)
@@ -511,7 +511,8 @@ static void drbd_calc_cpu_mask(cpumask_var_t *cpu_mask)
 {
        unsigned int *resources_per_cpu, min_index = ~0;
 
-       resources_per_cpu = kzalloc(nr_cpu_ids * sizeof(*resources_per_cpu), GFP_KERNEL);
+       resources_per_cpu = kcalloc(nr_cpu_ids, sizeof(*resources_per_cpu),
+                                   GFP_KERNEL);
        if (resources_per_cpu) {
                struct drbd_resource *resource;
                unsigned int cpu, min = ~0;
index 2bdadd7f14542fab264c02b73534bbfbd7379edc..7948049f6c4321b02e1611383dae1be86a7748f1 100644 (file)
@@ -1575,12 +1575,12 @@ static int setup_commands(struct nullb_queue *nq)
        struct nullb_cmd *cmd;
        int i, tag_size;
 
-       nq->cmds = kzalloc(nq->queue_depth * sizeof(*cmd), GFP_KERNEL);
+       nq->cmds = kcalloc(nq->queue_depth, sizeof(*cmd), GFP_KERNEL);
        if (!nq->cmds)
                return -ENOMEM;
 
        tag_size = ALIGN(nq->queue_depth, BITS_PER_LONG) / BITS_PER_LONG;
-       nq->tag_map = kzalloc(tag_size * sizeof(unsigned long), GFP_KERNEL);
+       nq->tag_map = kcalloc(tag_size, sizeof(unsigned long), GFP_KERNEL);
        if (!nq->tag_map) {
                kfree(nq->cmds);
                return -ENOMEM;
@@ -1598,8 +1598,9 @@ static int setup_commands(struct nullb_queue *nq)
 
 static int setup_queues(struct nullb *nullb)
 {
-       nullb->queues = kzalloc(nullb->dev->submit_queues *
-               sizeof(struct nullb_queue), GFP_KERNEL);
+       nullb->queues = kcalloc(nullb->dev->submit_queues,
+                               sizeof(struct nullb_queue),
+                               GFP_KERNEL);
        if (!nullb->queues)
                return -ENOMEM;
 
index 8fa4533a1249a6d74825f3bac3088e213f5bd980..1e3d5de9d8387e16ed0735711328314380ca8873 100644 (file)
@@ -407,8 +407,9 @@ static int ps3vram_cache_init(struct ps3_system_bus_device *dev)
 
        priv->cache.page_count = CACHE_PAGE_COUNT;
        priv->cache.page_size = CACHE_PAGE_SIZE;
-       priv->cache.tags = kzalloc(sizeof(struct ps3vram_tag) *
-                                  CACHE_PAGE_COUNT, GFP_KERNEL);
+       priv->cache.tags = kcalloc(CACHE_PAGE_COUNT,
+                                  sizeof(struct ps3vram_tag),
+                                  GFP_KERNEL);
        if (!priv->cache.tags)
                return -ENOMEM;
 
index 09537bee387f85fcbaea962ecc960e5bcf4dccad..b7d71914a32a8b66541fb308a9cd4aa95056fdd2 100644 (file)
@@ -873,7 +873,8 @@ static int rsxx_pci_probe(struct pci_dev *dev,
                dev_info(CARD_TO_DEV(card),
                        "Failed reading the number of DMA targets\n");
 
-       card->ctrl = kzalloc(card->n_targets * sizeof(*card->ctrl), GFP_KERNEL);
+       card->ctrl = kcalloc(card->n_targets, sizeof(*card->ctrl),
+                            GFP_KERNEL);
        if (!card->ctrl) {
                st = -ENOMEM;
                goto failed_dma_setup;
index beaccf197a5a85f41eaf1798862f32ce3eb0cd06..8fbc1bf6db3d2cce92974b291f20c92fc90dc538 100644 (file)
@@ -1038,7 +1038,7 @@ int rsxx_eeh_save_issued_dmas(struct rsxx_cardinfo *card)
        struct rsxx_dma *dma;
        struct list_head *issued_dmas;
 
-       issued_dmas = kzalloc(sizeof(*issued_dmas) * card->n_targets,
+       issued_dmas = kcalloc(card->n_targets, sizeof(*issued_dmas),
                              GFP_KERNEL);
        if (!issued_dmas)
                return -ENOMEM;
index 66412eededda2b17dadcfaf8222d8c34edb58571..a4bc74e72c394965f31dcbe7b55c8e5cd0fc6cd5 100644 (file)
@@ -139,7 +139,8 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif)
 {
        unsigned int r;
 
-       blkif->rings = kzalloc(blkif->nr_rings * sizeof(struct xen_blkif_ring), GFP_KERNEL);
+       blkif->rings = kcalloc(blkif->nr_rings, sizeof(struct xen_blkif_ring),
+                              GFP_KERNEL);
        if (!blkif->rings)
                return -ENOMEM;
 
index ae00a82f350b55b4f38010ccd746146c2b7d6c44..b5cedccb5d7db10ec9d75632e221acd73308933b 100644 (file)
@@ -1906,7 +1906,9 @@ static int negotiate_mq(struct blkfront_info *info)
        if (!info->nr_rings)
                info->nr_rings = 1;
 
-       info->rinfo = kzalloc(sizeof(struct blkfront_ring_info) * info->nr_rings, GFP_KERNEL);
+       info->rinfo = kcalloc(info->nr_rings,
+                             sizeof(struct blkfront_ring_info),
+                             GFP_KERNEL);
        if (!info->rinfo) {
                xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure");
                return -ENOMEM;
@@ -2216,15 +2218,18 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo)
        }
 
        for (i = 0; i < BLK_RING_SIZE(info); i++) {
-               rinfo->shadow[i].grants_used = kzalloc(
-                       sizeof(rinfo->shadow[i].grants_used[0]) * grants,
-                       GFP_NOIO);
-               rinfo->shadow[i].sg = kzalloc(sizeof(rinfo->shadow[i].sg[0]) * psegs, GFP_NOIO);
-               if (info->max_indirect_segments)
-                       rinfo->shadow[i].indirect_grants = kzalloc(
-                               sizeof(rinfo->shadow[i].indirect_grants[0]) *
-                               INDIRECT_GREFS(grants),
+               rinfo->shadow[i].grants_used =
+                       kcalloc(grants,
+                               sizeof(rinfo->shadow[i].grants_used[0]),
                                GFP_NOIO);
+               rinfo->shadow[i].sg = kcalloc(psegs,
+                                             sizeof(rinfo->shadow[i].sg[0]),
+                                             GFP_NOIO);
+               if (info->max_indirect_segments)
+                       rinfo->shadow[i].indirect_grants =
+                               kcalloc(INDIRECT_GREFS(grants),
+                                       sizeof(rinfo->shadow[i].indirect_grants[0]),
+                                       GFP_NOIO);
                if ((rinfo->shadow[i].grants_used == NULL) ||
                        (rinfo->shadow[i].sg == NULL) ||
                     (info->max_indirect_segments &&
index b450544dcaf0fc3c188b3eabfea7319438709ed7..6914e4f0ce985d584ee06c23c7ffc83c7204214d 100644 (file)
@@ -85,7 +85,8 @@ static int amd_create_gatt_pages(int nr_tables)
        int retval = 0;
        int i;
 
-       tables = kzalloc((nr_tables + 1) * sizeof(struct amd_page_map *),GFP_KERNEL);
+       tables = kcalloc(nr_tables + 1, sizeof(struct amd_page_map *),
+                        GFP_KERNEL);
        if (tables == NULL)
                return -ENOMEM;
 
index 88b4cbee4dac1cf748aa8a5799e7c1654ef5929c..20bf5f78a362073e6068a2dd0bd7ddadcb8e32dd 100644 (file)
@@ -108,7 +108,8 @@ static int ati_create_gatt_pages(int nr_tables)
        int retval = 0;
        int i;
 
-       tables = kzalloc((nr_tables + 1) * sizeof(struct ati_page_map *),GFP_KERNEL);
+       tables = kcalloc(nr_tables + 1, sizeof(struct ati_page_map *),
+                        GFP_KERNEL);
        if (tables == NULL)
                return -ENOMEM;
 
index 4dbdd3bc9bb8855e6e557abaac0aefe5feb0eb5c..7729414100ffa5d33509f78c298dd7779186e01f 100644 (file)
@@ -96,7 +96,7 @@ static int serverworks_create_gatt_pages(int nr_tables)
        int retval = 0;
        int i;
 
-       tables = kzalloc((nr_tables + 1) * sizeof(struct serverworks_page_map *),
+       tables = kcalloc(nr_tables + 1, sizeof(struct serverworks_page_map *),
                         GFP_KERNEL);
        if (tables == NULL)
                return -ENOMEM;
index 22f634eb09fd5c523ec8fa12975a62de73d36924..18e4650c233b1de514ee836dfc28021f35953a5b 100644 (file)
@@ -1757,7 +1757,8 @@ static unsigned short *ssif_address_list(void)
        list_for_each_entry(info, &ssif_infos, link)
                count++;
 
-       address_list = kzalloc(sizeof(*address_list) * (count + 1), GFP_KERNEL);
+       address_list = kcalloc(count + 1, sizeof(*address_list),
+                              GFP_KERNEL);
        if (!address_list)
                return NULL;
 
index d074f8e982d0851cae185375f7548e6cebeb74c6..a7a30d2eca418f6e15febe5cf47aac91d426ec32 100644 (file)
@@ -161,7 +161,7 @@ static void __init r8a7740_cpg_clocks_init(struct device_node *np)
        }
 
        cpg = kzalloc(sizeof(*cpg), GFP_KERNEL);
-       clks = kzalloc(num_clks * sizeof(*clks), GFP_KERNEL);
+       clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL);
        if (cpg == NULL || clks == NULL) {
                /* We're leaking memory on purpose, there's no point in cleaning
                 * up as the system won't boot anyway.
index 27fbfafaf2cd035327ed50ea86479fae0f4a4c23..5adcca4656c33303e9630f6a3624b09b50242ddb 100644 (file)
@@ -138,7 +138,7 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np)
        }
 
        cpg = kzalloc(sizeof(*cpg), GFP_KERNEL);
-       clks = kzalloc(CPG_NUM_CLOCKS * sizeof(*clks), GFP_KERNEL);
+       clks = kcalloc(CPG_NUM_CLOCKS, sizeof(*clks), GFP_KERNEL);
        if (cpg == NULL || clks == NULL) {
                /* We're leaking memory on purpose, there's no point in cleaning
                 * up as the system won't boot anyway.
index ee32a022e6da9548bfd13e1b82b811332a9869ab..bccd62f2cb092fac27416764d4eba89d98e305ba 100644 (file)
@@ -417,7 +417,7 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)
        }
 
        cpg = kzalloc(sizeof(*cpg), GFP_KERNEL);
-       clks = kzalloc(num_clks * sizeof(*clks), GFP_KERNEL);
+       clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL);
        if (cpg == NULL || clks == NULL) {
                /* We're leaking memory on purpose, there's no point in cleaning
                 * up as the system won't boot anyway.
index 67dd712aa723c77c2ffab83c3913c78ac9abd439..ac2f86d626b694be3824c7465c7e7aae3897a9af 100644 (file)
@@ -97,7 +97,7 @@ static void __init rz_cpg_clocks_init(struct device_node *np)
                return;
 
        cpg = kzalloc(sizeof(*cpg), GFP_KERNEL);
-       clks = kzalloc(num_clks * sizeof(*clks), GFP_KERNEL);
+       clks = kcalloc(num_clks, sizeof(*clks), GFP_KERNEL);
        BUG_ON(!cpg || !clks);
 
        cpg->data.clks = clks;
index 14819d919df10d8871d8d6cb24700d06bbdb1671..a79d81985c4e0251a6049d5d09b89415d0354ba3 100644 (file)
@@ -874,7 +874,7 @@ static void __init st_of_create_quadfs_fsynths(
                return;
 
        clk_data->clk_num = QUADFS_MAX_CHAN;
-       clk_data->clks = kzalloc(QUADFS_MAX_CHAN * sizeof(struct clk *),
+       clk_data->clks = kcalloc(QUADFS_MAX_CHAN, sizeof(struct clk *),
                                 GFP_KERNEL);
 
        if (!clk_data->clks) {
index 25bda48a5d35b919f37eb74228a2710d78d4b0b5..7a7106dc80bf446c62038bdd006846662cd9ce8f 100644 (file)
@@ -738,7 +738,7 @@ static void __init clkgen_c32_pll_setup(struct device_node *np,
                return;
 
        clk_data->clk_num = num_odfs;
-       clk_data->clks = kzalloc(clk_data->clk_num * sizeof(struct clk *),
+       clk_data->clks = kcalloc(clk_data->clk_num, sizeof(struct clk *),
                                 GFP_KERNEL);
 
        if (!clk_data->clks)
index fe0c3d169377272bccde5f8464429a9ea5ef43de..917fc27a33ddccc6f79349d8bf083e6ff9d461d4 100644 (file)
@@ -122,7 +122,7 @@ static void __init sunxi_usb_clk_setup(struct device_node *node,
        if (!clk_data)
                return;
 
-       clk_data->clks = kzalloc((qty+1) * sizeof(struct clk *), GFP_KERNEL);
+       clk_data->clks = kcalloc(qty + 1, sizeof(struct clk *), GFP_KERNEL);
        if (!clk_data->clks) {
                kfree(clk_data);
                return;
index 593d76a114f991a0aa95289e89bb5f8bf6cc77ea..ffaf17f71860f98a198ebc33f31a4ccac6442931 100644 (file)
@@ -216,14 +216,15 @@ struct clk ** __init tegra_clk_init(void __iomem *regs, int num, int banks)
        if (WARN_ON(banks > ARRAY_SIZE(periph_regs)))
                return NULL;
 
-       periph_clk_enb_refcnt = kzalloc(32 * banks *
-                               sizeof(*periph_clk_enb_refcnt), GFP_KERNEL);
+       periph_clk_enb_refcnt = kcalloc(32 * banks,
+                                       sizeof(*periph_clk_enb_refcnt),
+                                       GFP_KERNEL);
        if (!periph_clk_enb_refcnt)
                return NULL;
 
        periph_banks = banks;
 
-       clks = kzalloc(num * sizeof(struct clk *), GFP_KERNEL);
+       clks = kcalloc(num, sizeof(struct clk *), GFP_KERNEL);
        if (!clks)
                kfree(periph_clk_enb_refcnt);
 
index 9498e9363b573c4675738b85f33621110beb03de..61c126a5d26ad88aacc4491c73f85248fe2d2f4f 100644 (file)
@@ -206,7 +206,7 @@ static void __init of_dra7_apll_setup(struct device_node *node)
                goto cleanup;
        }
 
-       parent_names = kzalloc(sizeof(char *) * init->num_parents, GFP_KERNEL);
+       parent_names = kcalloc(init->num_parents, sizeof(char *), GFP_KERNEL);
        if (!parent_names)
                goto cleanup;
 
index aaa277dd6d991e9de2cb7bc7f9087d7d131a9637..ccfb4d9a152aea55c3e414dc26d2ddd3ce792ee4 100644 (file)
@@ -366,7 +366,7 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
 
        num_dividers = i;
 
-       tmp = kzalloc(sizeof(*tmp) * (valid_div + 1), GFP_KERNEL);
+       tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL);
        if (!tmp)
                return -ENOMEM;
 
@@ -496,7 +496,7 @@ __init ti_clk_get_div_table(struct device_node *node)
                return ERR_PTR(-EINVAL);
        }
 
-       table = kzalloc(sizeof(*table) * (valid_div + 1), GFP_KERNEL);
+       table = kcalloc(valid_div + 1, sizeof(*table), GFP_KERNEL);
 
        if (!table)
                return ERR_PTR(-ENOMEM);
index 7d33ca9042cb816abeff4939ea0816a6ba6f6d17..dc86d07d09211e35a6b9bf9338381ac2f4ef9183 100644 (file)
@@ -309,7 +309,7 @@ static void __init of_ti_dpll_setup(struct device_node *node,
                goto cleanup;
        }
 
-       parent_names = kzalloc(sizeof(char *) * init->num_parents, GFP_KERNEL);
+       parent_names = kcalloc(init->num_parents, sizeof(char *), GFP_KERNEL);
        if (!parent_names)
                goto cleanup;
 
index 70b3cf8e23d01bd80caf92859171df39b3e171ff..bbbf37c471a3919f7fb177f0439cd15d020d8d08 100644 (file)
@@ -1000,7 +1000,7 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
 
        /* Allocate and setup the channels. */
        cmt->num_channels = hweight8(cmt->hw_channels);
-       cmt->channels = kzalloc(cmt->num_channels * sizeof(*cmt->channels),
+       cmt->channels = kcalloc(cmt->num_channels, sizeof(*cmt->channels),
                                GFP_KERNEL);
        if (cmt->channels == NULL) {
                ret = -ENOMEM;
index 53aa7e92a7d77b7efc052466e8904efc110cc2eb..6812e099b6a3851b27f619ee3476bf31129f978b 100644 (file)
@@ -418,7 +418,7 @@ static int sh_mtu2_setup(struct sh_mtu2_device *mtu,
        /* Allocate and setup the channels. */
        mtu->num_channels = 3;
 
-       mtu->channels = kzalloc(sizeof(*mtu->channels) * mtu->num_channels,
+       mtu->channels = kcalloc(mtu->num_channels, sizeof(*mtu->channels),
                                GFP_KERNEL);
        if (mtu->channels == NULL) {
                ret = -ENOMEM;
index 31d881621e41865ea01dc19728d30256045e55f1..c74a6c543ca2667d239c3bd7a1a0944d936f6cc1 100644 (file)
@@ -569,7 +569,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
        }
 
        /* Allocate and setup the channels. */
-       tmu->channels = kzalloc(sizeof(*tmu->channels) * tmu->num_channels,
+       tmu->channels = kcalloc(tmu->num_channels, sizeof(*tmu->channels),
                                GFP_KERNEL);
        if (tmu->channels == NULL) {
                ret = -ENOMEM;
index 9449657d72f0243b78e899efa25f716a12b9a2db..8ff1c9123834912ee1f90571e141f2daed8c27e0 100644 (file)
@@ -759,8 +759,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
                goto err_unreg;
        }
 
-       freq_table = kzalloc(sizeof(*freq_table) *
-                   (perf->state_count+1), GFP_KERNEL);
+       freq_table = kcalloc(perf->state_count + 1, sizeof(*freq_table),
+                            GFP_KERNEL);
        if (!freq_table) {
                result = -ENOMEM;
                goto err_unreg;
index 1d7ef5fc197728b6cad6844f3f6eda8de45dcf05..cf62a1f64dd71d457ae45e40e7ec84d1ec35e23a 100644 (file)
@@ -280,7 +280,7 @@ static int merge_cluster_tables(void)
        for (i = 0; i < MAX_CLUSTERS; i++)
                count += get_table_count(freq_table[i]);
 
-       table = kzalloc(sizeof(*table) * count, GFP_KERNEL);
+       table = kcalloc(count, sizeof(*table), GFP_KERNEL);
        if (!table)
                return -ENOMEM;
 
index 3464580ac3ca4d4284c704c81676a3fad9da93fb..a9d3eec327959d59cc6089716fe3df7c59f384bf 100644 (file)
@@ -313,7 +313,8 @@ static int __init cppc_cpufreq_init(void)
        if (acpi_disabled)
                return -ENODEV;
 
-       all_cpu_data = kzalloc(sizeof(void *) * num_possible_cpus(), GFP_KERNEL);
+       all_cpu_data = kcalloc(num_possible_cpus(), sizeof(void *),
+                              GFP_KERNEL);
        if (!all_cpu_data)
                return -ENOMEM;
 
index 7974a2fdb760391c3aa3aa784bf77e254d1b99e9..dd5440d3372d21528f0df5715fcc03e656863b1f 100644 (file)
@@ -241,8 +241,8 @@ acpi_cpufreq_cpu_init (
        }
 
        /* alloc freq_table */
-       freq_table = kzalloc(sizeof(*freq_table) *
-                                  (data->acpi_data.state_count + 1),
+       freq_table = kcalloc(data->acpi_data.state_count + 1,
+                                  sizeof(*freq_table),
                                   GFP_KERNEL);
        if (!freq_table) {
                result = -ENOMEM;
index 61a4c5b0821971d0dfab329d2a56ed541a7fc551..279bd9e9fa95f6a8fabae628c3829f6f4746f29c 100644 (file)
@@ -474,8 +474,8 @@ static int longhaul_get_ranges(void)
                return -EINVAL;
        }
 
-       longhaul_table = kzalloc((numscales + 1) * sizeof(*longhaul_table),
-                       GFP_KERNEL);
+       longhaul_table = kcalloc(numscales + 1, sizeof(*longhaul_table),
+                                GFP_KERNEL);
        if (!longhaul_table)
                return -ENOMEM;
 
index 7acc7fa4536dbb58c3b7588b28a1cc9d648da103..9daa2cc318bbfadfa23d8493304d0dd170235166 100644 (file)
@@ -93,7 +93,7 @@ static int setup_freqs_table(struct cpufreq_policy *policy,
        struct cpufreq_frequency_table *table;
        int i;
 
-       table = kzalloc((num + 1) * sizeof(*table), GFP_KERNEL);
+       table = kcalloc(num + 1, sizeof(*table), GFP_KERNEL);
        if (table == NULL)
                return -ENOMEM;
 
index 909bd6e2763933587da7fea5c918e586a76dc807..3b291a2b0cb3414ab0178adde205203d57c2b2b6 100644 (file)
@@ -562,7 +562,7 @@ static int s3c_cpufreq_build_freq(void)
        size = cpu_cur.info->calc_freqtable(&cpu_cur, NULL, 0);
        size++;
 
-       ftab = kzalloc(sizeof(*ftab) * size, GFP_KERNEL);
+       ftab = kcalloc(size, sizeof(*ftab), GFP_KERNEL);
        if (!ftab)
                return -ENOMEM;
 
index 9767afe05da21780017ff19f05869bf5b7423e7c..978770432b13545030c7396da590082c04ac713d 100644 (file)
@@ -95,8 +95,8 @@ static int __init sfi_cpufreq_init(void)
        if (ret)
                return ret;
 
-       freq_table = kzalloc(sizeof(*freq_table) *
-                       (num_freq_table_entries + 1), GFP_KERNEL);
+       freq_table = kcalloc(num_freq_table_entries + 1, sizeof(*freq_table),
+                            GFP_KERNEL);
        if (!freq_table) {
                ret = -ENOMEM;
                goto err_free_array;
index 195f27f9c1cbe45b623089fa2a43612fb0034ee6..4074e261552238ccbcdad859944f85a3effac1be 100644 (file)
@@ -195,7 +195,7 @@ static int spear_cpufreq_probe(struct platform_device *pdev)
        cnt = prop->length / sizeof(u32);
        val = prop->value;
 
-       freq_tbl = kzalloc(sizeof(*freq_tbl) * (cnt + 1), GFP_KERNEL);
+       freq_tbl = kcalloc(cnt + 1, sizeof(*freq_tbl), GFP_KERNEL);
        if (!freq_tbl) {
                ret = -ENOMEM;
                goto out_put_node;
index 9cb234c72549faa902b1aa94a7c9446be492aac8..05981ccd9901a90ec5e216e2ce01a1ba41e0a51e 100644 (file)
@@ -141,11 +141,11 @@ static void crypto4xx_hw_init(struct crypto4xx_device *dev)
 
 int crypto4xx_alloc_sa(struct crypto4xx_ctx *ctx, u32 size)
 {
-       ctx->sa_in = kzalloc(size * 4, GFP_ATOMIC);
+       ctx->sa_in = kcalloc(size, 4, GFP_ATOMIC);
        if (ctx->sa_in == NULL)
                return -ENOMEM;
 
-       ctx->sa_out = kzalloc(size * 4, GFP_ATOMIC);
+       ctx->sa_out = kcalloc(size, 4, GFP_ATOMIC);
        if (ctx->sa_out == NULL) {
                kfree(ctx->sa_in);
                ctx->sa_in = NULL;
@@ -180,8 +180,8 @@ static u32 crypto4xx_build_pdr(struct crypto4xx_device *dev)
        if (!dev->pdr)
                return -ENOMEM;
 
-       dev->pdr_uinfo = kzalloc(sizeof(struct pd_uinfo) * PPC4XX_NUM_PD,
-                               GFP_KERNEL);
+       dev->pdr_uinfo = kcalloc(PPC4XX_NUM_PD, sizeof(struct pd_uinfo),
+                                GFP_KERNEL);
        if (!dev->pdr_uinfo) {
                dma_free_coherent(dev->core_dev->device,
                                  sizeof(struct ce_pd) * PPC4XX_NUM_PD,
index d138d6b8fec5946333d50a7d73fc58020adad2ec..c77b0e1655a8357f100bc820dde88afdb82570a4 100644 (file)
@@ -922,7 +922,7 @@ int safexcel_hmac_setkey(const char *alg, const u8 *key, unsigned int keylen,
        crypto_ahash_clear_flags(tfm, ~0);
        blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
 
-       ipad = kzalloc(2 * blocksize, GFP_KERNEL);
+       ipad = kcalloc(2, blocksize, GFP_KERNEL);
        if (!ipad) {
                ret = -ENOMEM;
                goto free_request;
index e61b08566093277b01987e21181ffc39fb3ed20d..e34d80b6b7e58b38fc1a8a036809cec35f4d6153 100644 (file)
@@ -1198,7 +1198,7 @@ static int mv_cesa_ahmac_setkey(const char *hash_alg_name,
 
        blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
 
-       ipad = kzalloc(2 * blocksize, GFP_KERNEL);
+       ipad = kcalloc(2, blocksize, GFP_KERNEL);
        if (!ipad) {
                ret = -ENOMEM;
                goto free_req;
index 80e9c842aad463d0ece3b48862c202564488f8ec..ab6235b7ff227f59ea7401deb9e62a16d7c64823 100644 (file)
@@ -1919,12 +1919,12 @@ static int grab_global_resources(void)
                goto out_hvapi_release;
 
        err = -ENOMEM;
-       cpu_to_cwq = kzalloc(sizeof(struct spu_queue *) * NR_CPUS,
+       cpu_to_cwq = kcalloc(NR_CPUS, sizeof(struct spu_queue *),
                             GFP_KERNEL);
        if (!cpu_to_cwq)
                goto out_queue_cache_destroy;
 
-       cpu_to_mau = kzalloc(sizeof(struct spu_queue *) * NR_CPUS,
+       cpu_to_mau = kcalloc(NR_CPUS, sizeof(struct spu_queue *),
                             GFP_KERNEL);
        if (!cpu_to_mau)
                goto out_free_cwq_table;
index 98d22c2096e375bed1200885a9daf5bb1f10d40d..6bd8f6a2a24fa390acf98f5815fe4e5d86e073a5 100644 (file)
@@ -1162,8 +1162,9 @@ static int qat_uclo_map_suof(struct icp_qat_fw_loader_handle *handle,
        suof_handle->img_table.num_simgs = suof_ptr->num_chunks - 1;
 
        if (suof_handle->img_table.num_simgs != 0) {
-               suof_img_hdr = kzalloc(suof_handle->img_table.num_simgs *
-                                      sizeof(img_header), GFP_KERNEL);
+               suof_img_hdr = kcalloc(suof_handle->img_table.num_simgs,
+                                      sizeof(img_header),
+                                      GFP_KERNEL);
                if (!suof_img_hdr)
                        return -ENOMEM;
                suof_handle->img_table.simg_hdr = suof_img_hdr;
index 7792a9186f9cf35bae71792e5e0783cf53364b05..4fa4c06c9edb9809675ea98a2d058e3c8b5dfa35 100644 (file)
@@ -322,10 +322,10 @@ static int ioat_dma_self_test(struct ioatdma_device *ioat_dma)
        unsigned long tmo;
        unsigned long flags;
 
-       src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL);
+       src = kzalloc(IOAT_TEST_SIZE, GFP_KERNEL);
        if (!src)
                return -ENOMEM;
-       dest = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL);
+       dest = kzalloc(IOAT_TEST_SIZE, GFP_KERNEL);
        if (!dest) {
                kfree(src);
                return -ENOMEM;
index 4528b560dc4c3db0457a05ec957f21f65d432bb4..969534c1a6c63339b1b5c48ae3568d275f3bb518 100644 (file)
@@ -781,7 +781,7 @@ static int mv_chan_memcpy_self_test(struct mv_xor_chan *mv_chan)
        if (!src)
                return -ENOMEM;
 
-       dest = kzalloc(sizeof(u8) * PAGE_SIZE, GFP_KERNEL);
+       dest = kzalloc(PAGE_SIZE, GFP_KERNEL);
        if (!dest) {
                kfree(src);
                return -ENOMEM;
index 6237069001c4fea463d73f943d18b22ed5f9fba3..defcdde4d358b19cc5430de95fb5e9f16ec538ca 100644 (file)
@@ -1866,7 +1866,7 @@ static int dmac_alloc_threads(struct pl330_dmac *pl330)
        int i;
 
        /* Allocate 1 Manager and 'chans' Channel threads */
-       pl330->channels = kzalloc((1 + chans) * sizeof(*thrd),
+       pl330->channels = kcalloc(1 + chans, sizeof(*thrd),
                                        GFP_KERNEL);
        if (!pl330->channels)
                return -ENOMEM;
@@ -2990,7 +2990,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
 
        pl330->num_peripherals = num_chan;
 
-       pl330->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL);
+       pl330->peripherals = kcalloc(num_chan, sizeof(*pch), GFP_KERNEL);
        if (!pl330->peripherals) {
                ret = -ENOMEM;
                goto probe_err2;
index 12fa48e380cf5daa16f15b24b636349047732f30..6b5626e299b22373fcba4e68f37862f73b9fc627 100644 (file)
@@ -1045,8 +1045,9 @@ EXPORT_SYMBOL(shdma_cleanup);
 
 static int __init shdma_enter(void)
 {
-       shdma_slave_used = kzalloc(DIV_ROUND_UP(slave_num, BITS_PER_LONG) *
-                                   sizeof(long), GFP_KERNEL);
+       shdma_slave_used = kcalloc(DIV_ROUND_UP(slave_num, BITS_PER_LONG),
+                                  sizeof(long),
+                                  GFP_KERNEL);
        if (!shdma_slave_used)
                return -ENOMEM;
        return 0;
index f14645817ed8026f997eded8ea42d85189447307..c74a88b650396e34cb713e069ffb4640060d94f8 100644 (file)
@@ -471,7 +471,7 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
        if (ret < 0)
                return ret;
 
-       chan->sw_desc_pool = kzalloc(sizeof(*desc) * ZYNQMP_DMA_NUM_DESCS,
+       chan->sw_desc_pool = kcalloc(ZYNQMP_DMA_NUM_DESCS, sizeof(*desc),
                                     GFP_KERNEL);
        if (!chan->sw_desc_pool)
                return -ENOMEM;
index 329cb96f886fd136062707324680327a3083b763..18aeabb1d5ee4afdb14051d42adad6121d83cc43 100644 (file)
@@ -3451,7 +3451,7 @@ static int __init amd64_edac_init(void)
        opstate_init();
 
        err = -ENOMEM;
-       ecc_stngs = kzalloc(amd_nb_num() * sizeof(ecc_stngs[0]), GFP_KERNEL);
+       ecc_stngs = kcalloc(amd_nb_num(), sizeof(ecc_stngs[0]), GFP_KERNEL);
        if (!ecc_stngs)
                goto err_free;
 
index 4d0ea3563d47df8b1409d6643bec7b0fa52c7560..8ed4dd9c571bb5294e79cca52e57059d502f1337 100644 (file)
@@ -461,7 +461,7 @@ static struct i7core_dev *alloc_i7core_dev(u8 socket,
        if (!i7core_dev)
                return NULL;
 
-       i7core_dev->pdev = kzalloc(sizeof(*i7core_dev->pdev) * table->n_devs,
+       i7core_dev->pdev = kcalloc(table->n_devs, sizeof(*i7core_dev->pdev),
                                   GFP_KERNEL);
        if (!i7core_dev->pdev) {
                kfree(i7core_dev);
index 8bff5fd1818516d6b4bc81a239136d926aa4ba47..af83ad58819ca3cf7fb37f4d0cb24260c83cb6cb 100644 (file)
@@ -1126,8 +1126,9 @@ int extcon_dev_register(struct extcon_dev *edev)
                char *str;
                struct extcon_cable *cable;
 
-               edev->cables = kzalloc(sizeof(struct extcon_cable) *
-                                      edev->max_supported, GFP_KERNEL);
+               edev->cables = kcalloc(edev->max_supported,
+                                      sizeof(struct extcon_cable),
+                                      GFP_KERNEL);
                if (!edev->cables) {
                        ret = -ENOMEM;
                        goto err_sysfs_alloc;
@@ -1136,7 +1137,7 @@ int extcon_dev_register(struct extcon_dev *edev)
                        cable = &edev->cables[index];
 
                        snprintf(buf, 10, "cable.%d", index);
-                       str = kzalloc(sizeof(char) * (strlen(buf) + 1),
+                       str = kzalloc(strlen(buf) + 1,
                                      GFP_KERNEL);
                        if (!str) {
                                for (index--; index >= 0; index--) {
@@ -1177,15 +1178,17 @@ int extcon_dev_register(struct extcon_dev *edev)
                for (index = 0; edev->mutually_exclusive[index]; index++)
                        ;
 
-               edev->attrs_muex = kzalloc(sizeof(struct attribute *) *
-                                          (index + 1), GFP_KERNEL);
+               edev->attrs_muex = kcalloc(index + 1,
+                                          sizeof(struct attribute *),
+                                          GFP_KERNEL);
                if (!edev->attrs_muex) {
                        ret = -ENOMEM;
                        goto err_muex;
                }
 
-               edev->d_attrs_muex = kzalloc(sizeof(struct device_attribute) *
-                                            index, GFP_KERNEL);
+               edev->d_attrs_muex = kcalloc(index,
+                                            sizeof(struct device_attribute),
+                                            GFP_KERNEL);
                if (!edev->d_attrs_muex) {
                        ret = -ENOMEM;
                        kfree(edev->attrs_muex);
@@ -1194,7 +1197,7 @@ int extcon_dev_register(struct extcon_dev *edev)
 
                for (index = 0; edev->mutually_exclusive[index]; index++) {
                        sprintf(buf, "0x%x", edev->mutually_exclusive[index]);
-                       name = kzalloc(sizeof(char) * (strlen(buf) + 1),
+                       name = kzalloc(strlen(buf) + 1,
                                       GFP_KERNEL);
                        if (!name) {
                                for (index--; index >= 0; index--) {
@@ -1220,8 +1223,9 @@ int extcon_dev_register(struct extcon_dev *edev)
 
        if (edev->max_supported) {
                edev->extcon_dev_type.groups =
-                       kzalloc(sizeof(struct attribute_group *) *
-                               (edev->max_supported + 2), GFP_KERNEL);
+                       kcalloc(edev->max_supported + 2,
+                               sizeof(struct attribute_group *),
+                               GFP_KERNEL);
                if (!edev->extcon_dev_type.groups) {
                        ret = -ENOMEM;
                        goto err_alloc_groups;
index 2f452f1f7c8a09c2f5cd1cdfcf07aa3751b808e0..fb8af5cb7c9bffef3f4446baf2e94045685e6f3e 100644 (file)
@@ -146,7 +146,7 @@ static int create_packet(void *data, size_t length)
        packet_array_size = max(
                        (unsigned int)(allocation_floor / rbu_data.packetsize),
                        (unsigned int)1);
-       invalid_addr_packet_array = kzalloc(packet_array_size * sizeof(void*),
+       invalid_addr_packet_array = kcalloc(packet_array_size, sizeof(void *),
                                                GFP_KERNEL);
 
        if (!invalid_addr_packet_array) {
index 901b9306bf94a1195e35ccc2d869467327009e7d..4938c29b7c5dced7538763a4b1063355ed748deb 100644 (file)
@@ -231,7 +231,7 @@ int efi_capsule_update(efi_capsule_header_t *capsule, phys_addr_t *pages)
        count = DIV_ROUND_UP(imagesize, PAGE_SIZE);
        sg_count = sg_pages_num(count);
 
-       sg_pages = kzalloc(sg_count * sizeof(*sg_pages), GFP_KERNEL);
+       sg_pages = kcalloc(sg_count, sizeof(*sg_pages), GFP_KERNEL);
        if (!sg_pages)
                return -ENOMEM;
 
index f377609ff141bca733bf498babc25f9d215aefad..84a11d0a8023c28fe38de99671ee9142c89f7d30 100644 (file)
@@ -166,7 +166,7 @@ int __init efi_runtime_map_init(struct kobject *efi_kobj)
        if (!efi_enabled(EFI_MEMMAP))
                return 0;
 
-       map_entries = kzalloc(efi.memmap.nr_map * sizeof(entry), GFP_KERNEL);
+       map_entries = kcalloc(efi.memmap.nr_map, sizeof(entry), GFP_KERNEL);
        if (!map_entries) {
                ret = -ENOMEM;
                goto out;
index ffdc1762b580cdd5dcdff5af12372c247abae8fc..d0e65b86dc22fd364403fa45bf8804ddf94f9323 100644 (file)
@@ -48,8 +48,8 @@ static struct sdb_array *__fmc_scan_sdb_tree(struct fmc_device *fmc,
        arr = kzalloc(sizeof(*arr), GFP_KERNEL);
        if (!arr)
                return ERR_PTR(-ENOMEM);
-       arr->record = kzalloc(sizeof(arr->record[0]) * n, GFP_KERNEL);
-       arr->subtree = kzalloc(sizeof(arr->subtree[0]) * n, GFP_KERNEL);
+       arr->record = kcalloc(n, sizeof(arr->record[0]), GFP_KERNEL);
+       arr->subtree = kcalloc(n, sizeof(arr->subtree[0]), GFP_KERNEL);
        if (!arr->record || !arr->subtree) {
                kfree(arr->record);
                kfree(arr->subtree);
index e2bee27eb526d172be23be709a36be84604d7eac..b23d9a36be1f40e2296a5c9131539e47eeab5bc3 100644 (file)
@@ -443,7 +443,7 @@ static int ioh_gpio_probe(struct pci_dev *pdev,
                goto err_iomap;
        }
 
-       chip_save = kzalloc(sizeof(*chip) * 8, GFP_KERNEL);
+       chip_save = kcalloc(8, sizeof(*chip), GFP_KERNEL);
        if (chip_save == NULL) {
                ret = -ENOMEM;
                goto err_kzalloc;
index 428e5eb3444f0a6c6679802ed1666c23d6fb35b1..f4c474a9587510ed844ae7ec275b8b73c7695572 100644 (file)
@@ -310,20 +310,20 @@ static int acp_hw_init(void *handle)
                pm_genpd_init(&adev->acp.acp_genpd->gpd, NULL, false);
        }
 
-       adev->acp.acp_cell = kzalloc(sizeof(struct mfd_cell) * ACP_DEVS,
+       adev->acp.acp_cell = kcalloc(ACP_DEVS, sizeof(struct mfd_cell),
                                                        GFP_KERNEL);
 
        if (adev->acp.acp_cell == NULL)
                return -ENOMEM;
 
-       adev->acp.acp_res = kzalloc(sizeof(struct resource) * 4, GFP_KERNEL);
+       adev->acp.acp_res = kcalloc(4, sizeof(struct resource), GFP_KERNEL);
 
        if (adev->acp.acp_res == NULL) {
                kfree(adev->acp.acp_cell);
                return -ENOMEM;
        }
 
-       i2s_pdata = kzalloc(sizeof(struct i2s_platform_data) * 2, GFP_KERNEL);
+       i2s_pdata = kcalloc(2, sizeof(struct i2s_platform_data), GFP_KERNEL);
        if (i2s_pdata == NULL) {
                kfree(adev->acp.acp_res);
                kfree(adev->acp.acp_cell);
index def1010ac05e43ea8bcf6739310e66b4e6490ec8..77ad59ade85ca79b56d352608e96fde4395ece99 100644 (file)
@@ -452,7 +452,7 @@ int amdgpu_parse_extended_power_table(struct amdgpu_device *adev)
                        ATOM_PPLIB_PhaseSheddingLimits_Record *entry;
 
                        adev->pm.dpm.dyn_state.phase_shedding_limits_table.entries =
-                               kzalloc(psl->ucNumEntries *
+                               kcalloc(psl->ucNumEntries,
                                        sizeof(struct amdgpu_phase_shedding_limits_entry),
                                        GFP_KERNEL);
                        if (!adev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) {
index d167e8ab76d305e0878d2b6ac31357d4ba18520c..e3878256743a22281a7d11b9b9ec21369aeaea09 100644 (file)
@@ -53,7 +53,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev)
                n -= adev->irq.ih.ring_size;
        n /= size;
 
-       gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL);
+       gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);
        if (!gtt_obj) {
                DRM_ERROR("Failed to allocate %d pointers\n", n);
                r = 1;
index 69500a8b4e2df89004d0280abb47e186ee4fd72b..e9934de1b9cf8127eb2b770e4301d6ee90c98223 100644 (file)
@@ -1221,7 +1221,7 @@ static int amdgpu_atom_execute_table_locked(struct atom_context *ctx, int index,
        ectx.abort = false;
        ectx.last_jump = 0;
        if (ws)
-               ectx.ws = kzalloc(4 * ws, GFP_KERNEL);
+               ectx.ws = kcalloc(4, ws, GFP_KERNEL);
        else
                ectx.ws = NULL;
 
index a266dcf5daed2f7d7b335d9c7108623eead51886..7fbad2f5f0bd7bbe76a7518b0c49bbed6e010602 100644 (file)
@@ -5679,8 +5679,9 @@ static int ci_parse_power_table(struct amdgpu_device *adev)
                (mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
-       adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) *
-                                 state_array->ucNumEntries, GFP_KERNEL);
+       adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
+                                 sizeof(struct amdgpu_ps),
+                                 GFP_KERNEL);
        if (!adev->pm.dpm.ps)
                return -ENOMEM;
        power_state_offset = (u8 *)state_array->states;
@@ -5927,7 +5928,9 @@ static int ci_dpm_init(struct amdgpu_device *adev)
        ci_set_private_data_variables_based_on_pptable(adev);
 
        adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
-               kzalloc(4 * sizeof(struct amdgpu_clock_voltage_dependency_entry), GFP_KERNEL);
+               kcalloc(4,
+                       sizeof(struct amdgpu_clock_voltage_dependency_entry),
+                       GFP_KERNEL);
        if (!adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
                ci_dpm_fini(adev);
                return -ENOMEM;
index 17f7f074cedcc32b39e75c132ccc98932221b51b..7a1e77c93bf1be75b8e25ca96911eb4b59a2a812 100644 (file)
@@ -2727,8 +2727,9 @@ static int kv_parse_power_table(struct amdgpu_device *adev)
                (mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
-       adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) *
-                                 state_array->ucNumEntries, GFP_KERNEL);
+       adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
+                                 sizeof(struct amdgpu_ps),
+                                 GFP_KERNEL);
        if (!adev->pm.dpm.ps)
                return -ENOMEM;
        power_state_offset = (u8 *)state_array->states;
index b12d7c9d42a058fae99fce9cd3679caf15e71961..5c97a36717264f5ca9bf3924927cd934b2f6d963 100644 (file)
@@ -7242,8 +7242,9 @@ static int si_parse_power_table(struct amdgpu_device *adev)
                (mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
-       adev->pm.dpm.ps = kzalloc(sizeof(struct amdgpu_ps) *
-                                 state_array->ucNumEntries, GFP_KERNEL);
+       adev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
+                                 sizeof(struct amdgpu_ps),
+                                 GFP_KERNEL);
        if (!adev->pm.dpm.ps)
                return -ENOMEM;
        power_state_offset = (u8 *)state_array->states;
@@ -7346,7 +7347,9 @@ static int si_dpm_init(struct amdgpu_device *adev)
                return ret;
 
        adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
-               kzalloc(4 * sizeof(struct amdgpu_clock_voltage_dependency_entry), GFP_KERNEL);
+               kcalloc(4,
+                       sizeof(struct amdgpu_clock_voltage_dependency_entry),
+                       GFP_KERNEL);
        if (!adev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
                amdgpu_free_extended_power_table(adev);
                return -ENOMEM;
index bd449351803fb27dffd4fbbf2ad52e56bc458651..ec304b1a5973d39ed859a8e4a4fbfa5dde414eb3 100644 (file)
@@ -435,7 +435,7 @@ bool dm_helpers_submit_i2c(
                return false;
        }
 
-       msgs = kzalloc(num * sizeof(struct i2c_msg), GFP_KERNEL);
+       msgs = kcalloc(num, sizeof(struct i2c_msg), GFP_KERNEL);
 
        if (!msgs)
                return false;
index 738a818d58d1c5defba2ee3007cb9ee6688b3ee9..0866874ae8c6e325f8744549460f201a9d87e5ca 100644 (file)
@@ -364,7 +364,7 @@ void dm_logger_open(
        entry->type = log_type;
        entry->logger = logger;
 
-       entry->buf = kzalloc(DAL_LOGGER_BUFFER_MAX_SIZE * sizeof(char),
+       entry->buf = kzalloc(DAL_LOGGER_BUFFER_MAX_SIZE,
                             GFP_KERNEL);
 
        entry->buf_offset = 0;
index 217b8f1f7bf62253624219ce10ca36fa7fb1f093..d28e9cf0e961df9c4ea8089a54d21df50c0bb6f1 100644 (file)
@@ -40,7 +40,7 @@ bool dal_vector_construct(
                return false;
        }
 
-       vector->container = kzalloc(struct_size * capacity, GFP_KERNEL);
+       vector->container = kcalloc(capacity, struct_size, GFP_KERNEL);
        if (vector->container == NULL)
                return false;
        vector->capacity = capacity;
@@ -67,7 +67,7 @@ bool dal_vector_presized_costruct(
                return false;
        }
 
-       vector->container = kzalloc(struct_size * count, GFP_KERNEL);
+       vector->container = kcalloc(count, struct_size, GFP_KERNEL);
 
        if (vector->container == NULL)
                return false;
index 599c7ab6befef229c6ae0f63bce8f1ae8b91d34b..88b09dd758baad980f2c6fdd37d5d152c909227a 100644 (file)
@@ -1079,13 +1079,15 @@ static void get_ss_info_from_atombios(
        if (*ss_entries_num == 0)
                return;
 
-       ss_info = kzalloc(sizeof(struct spread_spectrum_info) * (*ss_entries_num),
+       ss_info = kcalloc(*ss_entries_num,
+                         sizeof(struct spread_spectrum_info),
                          GFP_KERNEL);
        ss_info_cur = ss_info;
        if (ss_info == NULL)
                return;
 
-       ss_data = kzalloc(sizeof(struct spread_spectrum_data) * (*ss_entries_num),
+       ss_data = kcalloc(*ss_entries_num,
+                         sizeof(struct spread_spectrum_data),
                          GFP_KERNEL);
        if (ss_data == NULL)
                goto out_free_info;
index 80038e0e610f4e093502bb1364cac0d7495d8d33..ab5483c0c502cedbe04e83375a04da6799a5c12a 100644 (file)
@@ -98,7 +98,8 @@ struct gpio_service *dal_gpio_service_create(
                        if (number_of_bits) {
                                uint32_t index_of_uint = 0;
 
-                               slot = kzalloc(number_of_uints * sizeof(uint32_t),
+                               slot = kcalloc(number_of_uints,
+                                              sizeof(uint32_t),
                                               GFP_KERNEL);
 
                                if (!slot) {
index 0cd111d5901837cda056f70775febd3f534376d4..2533274e9cef23230d78724e5284be8c21b97046 100644 (file)
@@ -1413,13 +1413,15 @@ bool calculate_user_regamma_ramp(struct dc_transfer_func *output_tf,
 
        output_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
 
-       rgb_user = kzalloc(sizeof(*rgb_user) * (GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS),
-                       GFP_KERNEL);
+       rgb_user = kcalloc(GAMMA_RGB_256_ENTRIES + _EXTRA_POINTS,
+                          sizeof(*rgb_user),
+                          GFP_KERNEL);
        if (!rgb_user)
                goto rgb_user_alloc_fail;
 
-       rgb_regamma = kzalloc(sizeof(*rgb_regamma) * (MAX_HW_POINTS + _EXTRA_POINTS),
-                       GFP_KERNEL);
+       rgb_regamma = kcalloc(MAX_HW_POINTS + _EXTRA_POINTS,
+                             sizeof(*rgb_regamma),
+                             GFP_KERNEL);
        if (!rgb_regamma)
                goto rgb_regamma_alloc_fail;
 
index 27d4003aa2c7689e7e6d33163bbd633dc33aecc6..fa344ceafc17168cfa414264dd8a4c449d268734 100644 (file)
@@ -155,7 +155,8 @@ struct mod_freesync *mod_freesync_create(struct dc *dc)
        if (core_freesync == NULL)
                goto fail_alloc_context;
 
-       core_freesync->map = kzalloc(sizeof(struct freesync_entity) * MOD_FREESYNC_MAX_CONCURRENT_STREAMS,
+       core_freesync->map = kcalloc(MOD_FREESYNC_MAX_CONCURRENT_STREAMS,
+                                       sizeof(struct freesync_entity),
                                        GFP_KERNEL);
 
        if (core_freesync->map == NULL)
index 3f7d47fdc3679ddc1bd9ace2181f165380cd65b9..710852ad03f36d9f3bbeff0edff1278fc5a338e6 100644 (file)
@@ -141,19 +141,17 @@ struct mod_stats *mod_stats_create(struct dc *dc)
                        else
                                core_stats->entries = reg_data;
                }
-               core_stats->time = kzalloc(
-                       sizeof(struct stats_time_cache) *
-                               core_stats->entries,
+               core_stats->time = kcalloc(core_stats->entries,
+                                               sizeof(struct stats_time_cache),
                                                GFP_KERNEL);
 
                if (core_stats->time == NULL)
                        goto fail_construct_time;
 
                core_stats->event_entries = DAL_STATS_EVENT_ENTRIES_DEFAULT;
-               core_stats->events = kzalloc(
-                       sizeof(struct stats_event_cache) *
-                               core_stats->event_entries,
-                                               GFP_KERNEL);
+               core_stats->events = kcalloc(core_stats->event_entries,
+                                            sizeof(struct stats_event_cache),
+                                            GFP_KERNEL);
 
                if (core_stats->events == NULL)
                        goto fail_construct_events;
index 0af13c154328731638a2cc671b08269e5b3596c9..e45a1fcc7f086e4e949668ac2b264652f809b591 100644 (file)
@@ -50,7 +50,7 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr)
                return 0;
        }
 
-       hwmgr->ps = kzalloc(size * table_entries, GFP_KERNEL);
+       hwmgr->ps = kcalloc(table_entries, size, GFP_KERNEL);
        if (hwmgr->ps == NULL)
                return -ENOMEM;
 
index 2e0a02a80fe4d2b2473fcd060329086dc620bd05..572a18c2bfb509a4bbf6dc62056c5fece4b147a0 100644 (file)
@@ -121,7 +121,7 @@ int intel_gvt_init_vgpu_types(struct intel_gvt *gvt)
        high_avail = gvt_hidden_sz(gvt) - HOST_HIGH_GM_SIZE;
        num_types = sizeof(vgpu_types) / sizeof(vgpu_types[0]);
 
-       gvt->types = kzalloc(num_types * sizeof(struct intel_vgpu_type),
+       gvt->types = kcalloc(num_types, sizeof(struct intel_vgpu_type),
                             GFP_KERNEL);
        if (!gvt->types)
                return -ENOMEM;
index 2db5da550a1c1686d98e9d6c2895f1f7dbf6f0e4..0cc6a861bcf83ece9f4a317dd9581dd9741ecf81 100644 (file)
@@ -429,7 +429,7 @@ int intel_hdcp_auth_downstream(struct intel_digital_port *intel_dig_port,
        if (num_downstream == 0)
                return -EINVAL;
 
-       ksv_fifo = kzalloc(num_downstream * DRM_HDCP_KSV_LEN, GFP_KERNEL);
+       ksv_fifo = kcalloc(DRM_HDCP_KSV_LEN, num_downstream, GFP_KERNEL);
        if (!ksv_fifo)
                return -ENOMEM;
 
index f76f2597df5c95b6bc6c9797c52a8246ec6269c0..47bc5b2ddb5602633b86fcb1c2f391b545d597b4 100644 (file)
@@ -137,7 +137,7 @@ static int intel_uncore_check_forcewake_domains(struct drm_i915_private *dev_pri
        if (!IS_ENABLED(CONFIG_DRM_I915_SELFTEST_BROKEN))
                return 0;
 
-       valid = kzalloc(BITS_TO_LONGS(FW_RANGE) * sizeof(*valid),
+       valid = kcalloc(BITS_TO_LONGS(FW_RANGE), sizeof(*valid),
                        GFP_KERNEL);
        if (!valid)
                return -ENOMEM;
index 99d4fd17543c4791b797d31963a1d4950802234d..e84a2e2ff043152b058c519eadfceee4741286e5 100644 (file)
@@ -50,8 +50,8 @@ nvif_fifo_runlists(struct nvif_device *device)
                goto done;
 
        device->runlists = fls64(a->v.runlists.data);
-       device->runlist = kzalloc(sizeof(*device->runlist) *
-                                 device->runlists, GFP_KERNEL);
+       device->runlist = kcalloc(device->runlists, sizeof(*device->runlist),
+                                 GFP_KERNEL);
        if (!device->runlist) {
                ret = -ENOMEM;
                goto done;
index 40adfe9b334b3c45f899f543d161b2a2ee6cdf51..ef3f62840e835d6e64d81c41cbd8d7d44b967abc 100644 (file)
@@ -83,7 +83,7 @@ nvif_object_sclass_get(struct nvif_object *object, struct nvif_sclass **psclass)
                        return ret;
        }
 
-       *psclass = kzalloc(sizeof(**psclass) * args->sclass.count, GFP_KERNEL);
+       *psclass = kcalloc(args->sclass.count, sizeof(**psclass), GFP_KERNEL);
        if (*psclass) {
                for (i = 0; i < args->sclass.count; i++) {
                        (*psclass)[i].oclass = args->sclass.oclass[i].oclass;
index 4e8d3fa042df8e383fd5aee7e99ae3b33242927b..006618d77aa46dd6424d1acfeda43ebd28fb5cb9 100644 (file)
@@ -84,7 +84,8 @@ int
 nvkm_event_init(const struct nvkm_event_func *func, int types_nr, int index_nr,
                struct nvkm_event *event)
 {
-       event->refs = kzalloc(sizeof(*event->refs) * index_nr * types_nr,
+       event->refs = kzalloc(array3_size(index_nr, types_nr,
+                                         sizeof(*event->refs)),
                              GFP_KERNEL);
        if (!event->refs)
                return -ENOMEM;
index a99046414a18e3445dc828e61d6c870218272bb9..afccf9721cf0af3c7759cba6d406ac37c6c96d33 100644 (file)
@@ -910,7 +910,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base)
        nvkm_debug(subdev, "%d PBDMA(s)\n", fifo->pbdma_nr);
 
        /* Read PBDMA->runlist(s) mapping from HW. */
-       if (!(map = kzalloc(sizeof(*map) * fifo->pbdma_nr, GFP_KERNEL)))
+       if (!(map = kcalloc(fifo->pbdma_nr, sizeof(*map), GFP_KERNEL)))
                return -ENOMEM;
 
        for (i = 0; i < fifo->pbdma_nr; i++)
index 3ea716875151c17cb07256c5bf03a439af7e2104..17a53d2079781c00ad743a3c0da9ac271024d589 100644 (file)
@@ -268,7 +268,7 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)
                        }
                }
        } else {
-               addrs = kzalloc(npages * sizeof(*addrs), GFP_KERNEL);
+               addrs = kcalloc(npages, sizeof(*addrs), GFP_KERNEL);
                if (!addrs) {
                        ret = -ENOMEM;
                        goto free_pages;
index 6a2e091aa7b637c2ba19a779e2b7d59e00f7d41b..e55cbeee7a5376bb8008042dd53a160bc6e06f95 100644 (file)
@@ -1176,7 +1176,7 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32
        ectx.abort = false;
        ectx.last_jump = 0;
        if (ws)
-               ectx.ws = kzalloc(4 * ws, GFP_KERNEL);
+               ectx.ws = kcalloc(4, ws, GFP_KERNEL);
        else
                ectx.ws = NULL;
 
index 95652e643da13237cdd471f0c2ed5f47c39db9e3..0aef4937c901a2502133a2c22e2f74735f87ba04 100644 (file)
@@ -2581,7 +2581,9 @@ int btc_dpm_init(struct radeon_device *rdev)
                return ret;
 
        rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
-               kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL);
+               kcalloc(4,
+                       sizeof(struct radeon_clock_voltage_dependency_entry),
+                       GFP_KERNEL);
        if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
                r600_free_extended_power_table(rdev);
                return -ENOMEM;
index 7e1b04dc55937fbd450b46bdbfcc383af043a180..b9302c91827100398591bd0852ca8e0ada7854ed 100644 (file)
@@ -5568,8 +5568,9 @@ static int ci_parse_power_table(struct radeon_device *rdev)
                (mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 state_array->ucNumEntries, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
        power_state_offset = (u8 *)state_array->states;
@@ -5770,7 +5771,9 @@ int ci_dpm_init(struct radeon_device *rdev)
        ci_set_private_data_variables_based_on_pptable(rdev);
 
        rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
-               kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL);
+               kcalloc(4,
+                       sizeof(struct radeon_clock_voltage_dependency_entry),
+                       GFP_KERNEL);
        if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
                ci_dpm_fini(rdev);
                return -ENOMEM;
index ae1529b0ef6f41b52ddee28b659f3ea6f2fe85be..f055d6ea3522c6ed94825c5b44de86c2b0446397 100644 (file)
@@ -2660,8 +2660,9 @@ static int kv_parse_power_table(struct radeon_device *rdev)
                (mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 state_array->ucNumEntries, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
        power_state_offset = (u8 *)state_array->states;
index 9416e72f86aafcc2bcb8cb126e05641f9fe52f39..0fd8d6ba98287ed55acda0b01dc71222ad491c37 100644 (file)
@@ -3998,8 +3998,9 @@ static int ni_parse_power_table(struct radeon_device *rdev)
                return -EINVAL;
        power_info = (union power_info *)(mode_info->atom_context->bios + data_offset);
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 power_info->pplib.ucNumStates, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
 
@@ -4075,7 +4076,9 @@ int ni_dpm_init(struct radeon_device *rdev)
                return ret;
 
        rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
-               kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL);
+               kcalloc(4,
+                       sizeof(struct radeon_clock_voltage_dependency_entry),
+                       GFP_KERNEL);
        if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
                r600_free_extended_power_table(rdev);
                return -ENOMEM;
index 31d1b471084468f945d0c8738bf1a47488ebee50..73d4c53481168b1681aa43df7bc85059b22b7397 100644 (file)
@@ -991,7 +991,7 @@ int r600_parse_extended_power_table(struct radeon_device *rdev)
                        ATOM_PPLIB_PhaseSheddingLimits_Record *entry;
 
                        rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries =
-                               kzalloc(psl->ucNumEntries *
+                               kcalloc(psl->ucNumEntries,
                                        sizeof(struct radeon_phase_shedding_limits_entry),
                                        GFP_KERNEL);
                        if (!rdev->pm.dpm.dyn_state.phase_shedding_limits_table.entries) {
index 4134759a682315c9518b67e29951c7f177dadb1c..f422a8d6aec408d6c7a6568fd7e9d401131c41bb 100644 (file)
@@ -2126,13 +2126,16 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev)
                num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK;
        if (num_modes == 0)
                return state_index;
-       rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * num_modes, GFP_KERNEL);
+       rdev->pm.power_state = kcalloc(num_modes,
+                                      sizeof(struct radeon_power_state),
+                                      GFP_KERNEL);
        if (!rdev->pm.power_state)
                return state_index;
        /* last mode is usually default, array is low to high */
        for (i = 0; i < num_modes; i++) {
                rdev->pm.power_state[state_index].clock_info =
-                       kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL);
+                       kcalloc(1, sizeof(struct radeon_pm_clock_info),
+                               GFP_KERNEL);
                if (!rdev->pm.power_state[state_index].clock_info)
                        return state_index;
                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)
        radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController);
        if (power_info->pplib.ucNumStates == 0)
                return state_index;
-       rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) *
-                                      power_info->pplib.ucNumStates, GFP_KERNEL);
+       rdev->pm.power_state = kcalloc(power_info->pplib.ucNumStates,
+                                      sizeof(struct radeon_power_state),
+                                      GFP_KERNEL);
        if (!rdev->pm.power_state)
                return state_index;
        /* 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)
                         le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset) +
                         (power_state->v1.ucNonClockStateIndex *
                          power_info->pplib.ucNonClockSize));
-               rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) *
-                                                            ((power_info->pplib.ucStateEntrySize - 1) ?
-                                                             (power_info->pplib.ucStateEntrySize - 1) : 1),
-                                                            GFP_KERNEL);
+               rdev->pm.power_state[i].clock_info =
+                       kcalloc((power_info->pplib.ucStateEntrySize - 1) ?
+                               (power_info->pplib.ucStateEntrySize - 1) : 1,
+                               sizeof(struct radeon_pm_clock_info),
+                               GFP_KERNEL);
                if (!rdev->pm.power_state[i].clock_info)
                        return state_index;
                if (power_info->pplib.ucStateEntrySize - 1) {
@@ -2688,8 +2693,9 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev)
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
        if (state_array->ucNumEntries == 0)
                return state_index;
-       rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) *
-                                      state_array->ucNumEntries, GFP_KERNEL);
+       rdev->pm.power_state = kcalloc(state_array->ucNumEntries,
+                                      sizeof(struct radeon_power_state),
+                                      GFP_KERNEL);
        if (!rdev->pm.power_state)
                return state_index;
        power_state_offset = (u8 *)state_array->states;
@@ -2699,10 +2705,11 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev)
                non_clock_array_index = power_state->v2.nonClockInfoIndex;
                non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *)
                        &non_clock_info_array->nonClockInfo[non_clock_array_index];
-               rdev->pm.power_state[i].clock_info = kzalloc(sizeof(struct radeon_pm_clock_info) *
-                                                            (power_state->v2.ucNumDPMLevels ?
-                                                             power_state->v2.ucNumDPMLevels : 1),
-                                                            GFP_KERNEL);
+               rdev->pm.power_state[i].clock_info =
+                       kcalloc(power_state->v2.ucNumDPMLevels ?
+                               power_state->v2.ucNumDPMLevels : 1,
+                               sizeof(struct radeon_pm_clock_info),
+                               GFP_KERNEL);
                if (!rdev->pm.power_state[i].clock_info)
                        return state_index;
                if (power_state->v2.ucNumDPMLevels) {
@@ -2782,7 +2789,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL);
                if (rdev->pm.power_state) {
                        rdev->pm.power_state[0].clock_info =
-                               kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL);
+                               kcalloc(1,
+                                       sizeof(struct radeon_pm_clock_info),
+                                       GFP_KERNEL);
                        if (rdev->pm.power_state[0].clock_info) {
                                /* add the default mode */
                                rdev->pm.power_state[state_index].type =
index 3178ba0c537c1915af3b857aad83efd6371f17ad..60a61d33f6076e6bd81223173495613ec0c0950f 100644 (file)
@@ -2642,13 +2642,16 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
        rdev->pm.default_power_state_index = -1;
 
        /* allocate 2 power states */
-       rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2, GFP_KERNEL);
+       rdev->pm.power_state = kcalloc(2, sizeof(struct radeon_power_state),
+                                      GFP_KERNEL);
        if (rdev->pm.power_state) {
                /* allocate 1 clock mode per state */
                rdev->pm.power_state[0].clock_info =
-                       kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL);
+                       kcalloc(1, sizeof(struct radeon_pm_clock_info),
+                               GFP_KERNEL);
                rdev->pm.power_state[1].clock_info =
-                       kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL);
+                       kcalloc(1, sizeof(struct radeon_pm_clock_info),
+                               GFP_KERNEL);
                if (!rdev->pm.power_state[0].clock_info ||
                    !rdev->pm.power_state[1].clock_info)
                        goto pm_failed;
index f5e9abfadb560879ad98e889987e031ac9f1379b..48f4b273e31611f2b026b64bd555e67ff7fc14a4 100644 (file)
@@ -59,7 +59,7 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag)
        n = rdev->mc.gtt_size - rdev->gart_pin_size;
        n /= size;
 
-       gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL);
+       gtt_obj = kcalloc(n, sizeof(*gtt_obj), GFP_KERNEL);
        if (!gtt_obj) {
                DRM_ERROR("Failed to allocate %d pointers\n", n);
                r = 1;
index b5e4e09a89961629e8de3ab7c9ed3c03af05545f..694b7b3e97992ac3b88dfeefa186b875e91cae85 100644 (file)
@@ -804,8 +804,9 @@ static int rs780_parse_power_table(struct radeon_device *rdev)
                return -EINVAL;
        power_info = (union power_info *)(mode_info->atom_context->bios + data_offset);
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 power_info->pplib.ucNumStates, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
 
index d91aa3944593311dbbfa1b3f8cdc06055334b994..6986051fbb892af4f67d2369023213e9d1ea61ab 100644 (file)
@@ -1888,8 +1888,9 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev)
                return -EINVAL;
        power_info = (union power_info *)(mode_info->atom_context->bios + data_offset);
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 power_info->pplib.ucNumStates, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
 
index cb2a7ec4e2176fa36f5c546eb36bc9eacaa6525e..c765ae7ea8063682b7f40d603769735ee9fb78e5 100644 (file)
@@ -2282,8 +2282,9 @@ int rv7xx_parse_power_table(struct radeon_device *rdev)
                return -EINVAL;
        power_info = (union power_info *)(mode_info->atom_context->bios + data_offset);
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 power_info->pplib.ucNumStates, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(power_info->pplib.ucNumStates,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
 
index 90d5b41007bfd295eb531faa96da3fd99dde2693..fea88078cf8ea1f415394f09ec20fcc882c870fa 100644 (file)
@@ -6832,8 +6832,9 @@ static int si_parse_power_table(struct radeon_device *rdev)
                (mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 state_array->ucNumEntries, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
        power_state_offset = (u8 *)state_array->states;
@@ -6941,7 +6942,9 @@ int si_dpm_init(struct radeon_device *rdev)
                return ret;
 
        rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries =
-               kzalloc(4 * sizeof(struct radeon_clock_voltage_dependency_entry), GFP_KERNEL);
+               kcalloc(4,
+                       sizeof(struct radeon_clock_voltage_dependency_entry),
+                       GFP_KERNEL);
        if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) {
                r600_free_extended_power_table(rdev);
                return -ENOMEM;
index fd4804829e46a8f38ffae1a23dd7b674cedb090b..1e4975f3374ce8ba24df5a3f25320b1709dfba47 100644 (file)
@@ -1482,8 +1482,9 @@ static int sumo_parse_power_table(struct radeon_device *rdev)
                (mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 state_array->ucNumEntries, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
        power_state_offset = (u8 *)state_array->states;
index 2ef7c4e5e4950805f146bfe614510aa742b817a3..5d317f763eeaa7e813008882a42cc1ca58dc247f 100644 (file)
@@ -1757,8 +1757,9 @@ static int trinity_parse_power_table(struct radeon_device *rdev)
                (mode_info->atom_context->bios + data_offset +
                 le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset));
 
-       rdev->pm.dpm.ps = kzalloc(sizeof(struct radeon_ps) *
-                                 state_array->ucNumEntries, GFP_KERNEL);
+       rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries,
+                                 sizeof(struct radeon_ps),
+                                 GFP_KERNEL);
        if (!rdev->pm.dpm.ps)
                return -ENOMEM;
        power_state_offset = (u8 *)state_array->states;
index 7cc935d7b7aaaa36c3767a9c4ae01685037cc1fa..ab6c6c9c5b5c196d83708ffc572f736d89122c42 100644 (file)
@@ -1631,7 +1631,7 @@ static int igt_topdown(void *ignored)
        if (!nodes)
                goto err;
 
-       bitmap = kzalloc(count / BITS_PER_LONG * sizeof(unsigned long),
+       bitmap = kcalloc(count / BITS_PER_LONG, sizeof(unsigned long),
                         GFP_KERNEL);
        if (!bitmap)
                goto err_nodes;
@@ -1745,7 +1745,7 @@ static int igt_bottomup(void *ignored)
        if (!nodes)
                goto err;
 
-       bitmap = kzalloc(count / BITS_PER_LONG * sizeof(unsigned long),
+       bitmap = kcalloc(count / BITS_PER_LONG, sizeof(unsigned long),
                         GFP_KERNEL);
        if (!bitmap)
                goto err_nodes;
index 6d99534ac691bb8b09b4cbf399325b2cc932bbc6..8469b6964ff64e45f7807641ef8eda8197f8f81f 100644 (file)
@@ -457,7 +457,7 @@ static char *resolv_usage_page(unsigned page, struct seq_file *f) {
        char *buf = NULL;
 
        if (!f) {
-               buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_ATOMIC);
+               buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_ATOMIC);
                if (!buf)
                        return ERR_PTR(-ENOMEM);
        }
@@ -1088,7 +1088,7 @@ static int hid_debug_events_open(struct inode *inode, struct file *file)
                goto out;
        }
 
-       if (!(list->hid_debug_buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_KERNEL))) {
+       if (!(list->hid_debug_buf = kzalloc(HID_DEBUG_BUFSIZE, GFP_KERNEL))) {
                err = -ENOMEM;
                kfree(list);
                goto out;
index 9b82549cbbc8e6937c02c289c7f5e5b5d1de2b79..658dc765753bf569a725970690d45260db41df80 100644 (file)
@@ -190,7 +190,7 @@ int hv_synic_alloc(void)
 {
        int cpu;
 
-       hv_context.hv_numa_map = kzalloc(sizeof(struct cpumask) * nr_node_ids,
+       hv_context.hv_numa_map = kcalloc(nr_node_ids, sizeof(struct cpumask),
                                         GFP_KERNEL);
        if (hv_context.hv_numa_map == NULL) {
                pr_err("Unable to allocate NUMA map\n");
index 3c836c099a8f35e865feae4207a5f8c6d13888bc..be3c8b10b84a9f970f4b582ce9dd1bb2a223143e 100644 (file)
@@ -202,7 +202,7 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
         * First page holds struct hv_ring_buffer, do wraparound mapping for
         * the rest.
         */
-       pages_wraparound = kzalloc(sizeof(struct page *) * (page_cnt * 2 - 1),
+       pages_wraparound = kcalloc(page_cnt * 2 - 1, sizeof(struct page *),
                                   GFP_KERNEL);
        if (!pages_wraparound)
                return -ENOMEM;
index 14a94d90c028a0f77c22e6b0a3f9c3e48da070a4..34e45b97629ed73869baf28edf3acef0376290c5 100644 (file)
@@ -575,8 +575,9 @@ static int read_domain_devices(struct acpi_power_meter_resource *resource)
        if (!pss->package.count)
                goto end;
 
-       resource->domain_devices = kzalloc(sizeof(struct acpi_device *) *
-                                          pss->package.count, GFP_KERNEL);
+       resource->domain_devices = kcalloc(pss->package.count,
+                                          sizeof(struct acpi_device *),
+                                          GFP_KERNEL);
        if (!resource->domain_devices) {
                res = -ENOMEM;
                goto end;
@@ -796,7 +797,7 @@ static int read_capabilities(struct acpi_power_meter_resource *resource)
                        goto error;
                }
 
-               *str = kzalloc(sizeof(u8) * (element->string.length + 1),
+               *str = kcalloc(element->string.length + 1, sizeof(u8),
                               GFP_KERNEL);
                if (!*str) {
                        res = -ENOMEM;
index 72c338eb5fae5a94c5558ebe5aae4530bb649763..10645c9bb7be14abd077bb73418503067eb21157 100644 (file)
@@ -742,7 +742,7 @@ static int __init coretemp_init(void)
                return -ENODEV;
 
        max_packages = topology_max_packages();
-       pkg_devices = kzalloc(max_packages * sizeof(struct platform_device *),
+       pkg_devices = kcalloc(max_packages, sizeof(struct platform_device *),
                              GFP_KERNEL);
        if (!pkg_devices)
                return -ENOMEM;
index 9397d2f0e79ac0710feb06e6f15e3673b9a0fc5f..a4edc43dd0608cf9e529c224033c687b59645a43 100644 (file)
@@ -274,8 +274,9 @@ static int i5k_amb_hwmon_init(struct platform_device *pdev)
                num_ambs += hweight16(data->amb_present[i] & 0x7fff);
 
        /* Set up sysfs stuff */
-       data->attrs = kzalloc(sizeof(*data->attrs) * num_ambs * KNOBS_PER_AMB,
-                               GFP_KERNEL);
+       data->attrs = kzalloc(array3_size(num_ambs, KNOBS_PER_AMB,
+                                         sizeof(*data->attrs)),
+                             GFP_KERNEL);
        if (!data->attrs)
                return -ENOMEM;
        data->num_attrs = 0;
index 21b9c72f16bd7423dda3870b7e6eaf1ee047a6b5..ab72cabf5a9556cf38025683dd5a2bc28112e028 100644 (file)
@@ -387,7 +387,7 @@ static int ibmpex_find_sensors(struct ibmpex_bmc_data *data)
                return -ENOENT;
        data->num_sensors = err;
 
-       data->sensors = kzalloc(data->num_sensors * sizeof(*data->sensors),
+       data->sensors = kcalloc(data->num_sensors, sizeof(*data->sensors),
                                GFP_KERNEL);
        if (!data->sensors)
                return -ENOMEM;
index 65e324054970b51aded8091d8f8b5a212fd49bc4..a2f5f992af7aa7e21d70294d302891c08054f4da 100644 (file)
@@ -169,12 +169,12 @@ static int __init amd756_s4882_init(void)
 
        printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4882\n");
        /* Define the 5 virtual adapters and algorithms structures */
-       if (!(s4882_adapter = kzalloc(5 * sizeof(struct i2c_adapter),
+       if (!(s4882_adapter = kcalloc(5, sizeof(struct i2c_adapter),
                                      GFP_KERNEL))) {
                error = -ENOMEM;
                goto ERROR1;
        }
-       if (!(s4882_algo = kzalloc(5 * sizeof(struct i2c_algorithm),
+       if (!(s4882_algo = kcalloc(5, sizeof(struct i2c_algorithm),
                                   GFP_KERNEL))) {
                error = -ENOMEM;
                goto ERROR2;
index 88eda09e73c0b31509427a784c5219655a49c2fb..58a0fbf0e0740dd700fd6b494f7235d6d6522950 100644 (file)
@@ -164,12 +164,12 @@ static int __init nforce2_s4985_init(void)
 
        printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4985\n");
        /* Define the 5 virtual adapters and algorithms structures */
-       s4985_adapter = kzalloc(5 * sizeof(struct i2c_adapter), GFP_KERNEL);
+       s4985_adapter = kcalloc(5, sizeof(struct i2c_adapter), GFP_KERNEL);
        if (!s4985_adapter) {
                error = -ENOMEM;
                goto ERROR1;
        }
-       s4985_algo = kzalloc(5 * sizeof(struct i2c_algorithm), GFP_KERNEL);
+       s4985_algo = kcalloc(5, sizeof(struct i2c_algorithm), GFP_KERNEL);
        if (!s4985_algo) {
                error = -ENOMEM;
                goto ERROR2;
index 3241bb9d6c186985ae11d38c1e7511b6d4aaea1d..f6a1272c58544159ca1402bc173bc04b334b65b9 100644 (file)
@@ -381,7 +381,7 @@ static int nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id)
        int res1, res2;
 
        /* we support 2 SMBus adapters */
-       smbuses = kzalloc(2 * sizeof(struct nforce2_smbus), GFP_KERNEL);
+       smbuses = kcalloc(2, sizeof(struct nforce2_smbus), GFP_KERNEL);
        if (!smbuses)
                return -ENOMEM;
        pci_set_drvdata(dev, smbuses);
index 4a9ad91c5ba3eaf2d2e396d69e6076c0cdc1ec17..f31ec0861979c89264d5d38e9ebcfe219d66b502 100644 (file)
@@ -338,8 +338,9 @@ static int __init i2c_stub_allocate_banks(int i)
                chip->bank_mask >>= 1;
        }
 
-       chip->bank_words = kzalloc(chip->bank_mask * chip->bank_size *
-                                  sizeof(u16), GFP_KERNEL);
+       chip->bank_words = kcalloc(chip->bank_mask * chip->bank_size,
+                                  sizeof(u16),
+                                  GFP_KERNEL);
        if (!chip->bank_words)
                return -ENOMEM;
 
index 4b5dc0162e67418ab2cb20b67b12f96554a3acec..e52c58c29d9a71fc43818bdef99de45c194e8764 100644 (file)
@@ -1455,7 +1455,7 @@ static int hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id)
        if (info == &hpt36x || info == &hpt374)
                dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
 
-       dyn_info = kzalloc(sizeof(*dyn_info) * (dev2 ? 2 : 1), GFP_KERNEL);
+       dyn_info = kcalloc(dev2 ? 2 : 1, sizeof(*dyn_info), GFP_KERNEL);
        if (dyn_info == NULL) {
                printk(KERN_ERR "%s %s: out of memory!\n",
                        d.name, pci_name(dev));
index 04029d18a6966b131e3621f3f82ce4fdde1d6309..36a64c8ea575dc33bcfe2b300a3c7d8eab165899 100644 (file)
@@ -652,7 +652,7 @@ static int it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
        struct it821x_dev *itdevs;
        int rc;
 
-       itdevs = kzalloc(2 * sizeof(*itdevs), GFP_KERNEL);
+       itdevs = kcalloc(2, sizeof(*itdevs), GFP_KERNEL);
        if (itdevs == NULL) {
                printk(KERN_ERR DRV_NAME " %s: out of memory\n", pci_name(dev));
                return -ENOMEM;
index 36607d52fee065f9e2aa82f14215897e2c5b44b1..76643c5571aa87286bef0eeee0a557f04326ac6b 100644 (file)
@@ -38,7 +38,7 @@ int adis_update_scan_mode(struct iio_dev *indio_dev,
        if (!adis->xfer)
                return -ENOMEM;
 
-       adis->buffer = kzalloc(indio_dev->scan_bytes * 2, GFP_KERNEL);
+       adis->buffer = kcalloc(indio_dev->scan_bytes, 2, GFP_KERNEL);
        if (!adis->buffer)
                return -ENOMEM;
 
index ec98790e2a2839a167e2805f2b1eddd389098375..06ca3f7fcc4455ccc6732304356c53920d43fbc4 100644 (file)
@@ -436,7 +436,7 @@ struct iio_channel *iio_channel_get_all(struct device *dev)
        }
 
        /* NULL terminated array to save passing size */
-       chans = kzalloc(sizeof(*chans)*(nummaps + 1), GFP_KERNEL);
+       chans = kcalloc(nummaps + 1, sizeof(*chans), GFP_KERNEL);
        if (chans == NULL) {
                ret = -ENOMEM;
                goto error_ret;
index 71a34bee453d8fa4b3f75748e6589cc8f3763633..81d66f56e38f6c407d4ce321192c30db2269ae8a 100644 (file)
@@ -1245,8 +1245,9 @@ int ib_cache_setup_one(struct ib_device *device)
        rwlock_init(&device->cache.lock);
 
        device->cache.ports =
-               kzalloc(sizeof(*device->cache.ports) *
-                       (rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL);
+               kcalloc(rdma_end_port(device) - rdma_start_port(device) + 1,
+                       sizeof(*device->cache.ports),
+                       GFP_KERNEL);
        if (!device->cache.ports)
                return -ENOMEM;
 
index 84f51386e1e30be7558adeb7e93b4eb1deceba9e..6fa4c59dc7a732de600c8ebabd9430d44d9b4dc0 100644 (file)
@@ -336,8 +336,8 @@ static int read_port_immutable(struct ib_device *device)
         * Therefore port_immutable is declared as a 1 based array with
         * potential empty slots at the beginning.
         */
-       device->port_immutable = kzalloc(sizeof(*device->port_immutable)
-                                        * (end_port + 1),
+       device->port_immutable = kcalloc(end_port + 1,
+                                        sizeof(*device->port_immutable),
                                         GFP_KERNEL);
        if (!device->port_immutable)
                return -ENOMEM;
index da12da1c36f60836fdb287920e7d7e9e582fc2a2..cdb63f3f4de70ac57c0eb761a3bbef42b017f6f4 100644 (file)
@@ -56,14 +56,16 @@ int iwpm_init(u8 nl_client)
        int ret = 0;
        mutex_lock(&iwpm_admin_lock);
        if (atomic_read(&iwpm_admin.refcount) == 0) {
-               iwpm_hash_bucket = kzalloc(IWPM_MAPINFO_HASH_SIZE *
-                                       sizeof(struct hlist_head), GFP_KERNEL);
+               iwpm_hash_bucket = kcalloc(IWPM_MAPINFO_HASH_SIZE,
+                                          sizeof(struct hlist_head),
+                                          GFP_KERNEL);
                if (!iwpm_hash_bucket) {
                        ret = -ENOMEM;
                        goto init_exit;
                }
-               iwpm_reminfo_bucket = kzalloc(IWPM_REMINFO_HASH_SIZE *
-                                       sizeof(struct hlist_head), GFP_KERNEL);
+               iwpm_reminfo_bucket = kcalloc(IWPM_REMINFO_HASH_SIZE,
+                                             sizeof(struct hlist_head),
+                                             GFP_KERNEL);
                if (!iwpm_reminfo_bucket) {
                        kfree(iwpm_hash_bucket);
                        ret = -ENOMEM;
index 3328acc53c2aeaf892fa4e293e00b26dd96fd998..dcb4bba522ba001acb2e632bd8b184a8193193ea 100644 (file)
@@ -279,7 +279,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain,
        if (!wq->qpid)
                return -ENOMEM;
 
-       wq->rq = kzalloc(depth * sizeof(struct t3_swrq), GFP_KERNEL);
+       wq->rq = kcalloc(depth, sizeof(struct t3_swrq), GFP_KERNEL);
        if (!wq->rq)
                goto err1;
 
@@ -287,7 +287,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain,
        if (!wq->rq_addr)
                goto err2;
 
-       wq->sq = kzalloc(depth * sizeof(struct t3_swsq), GFP_KERNEL);
+       wq->sq = kcalloc(depth, sizeof(struct t3_swsq), GFP_KERNEL);
        if (!wq->sq)
                goto err3;
 
index 44161ca4d2a86d6dd3cdb96404877ef23cb4cb38..a3c3418afd737bae7a97126e23b77539024b8dd8 100644 (file)
@@ -859,8 +859,9 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
        rdev->status_page->cq_size = rdev->lldi.vr->cq.size;
 
        if (c4iw_wr_log) {
-               rdev->wr_log = kzalloc((1 << c4iw_wr_log_size_order) *
-                                      sizeof(*rdev->wr_log), GFP_KERNEL);
+               rdev->wr_log = kcalloc(1 << c4iw_wr_log_size_order,
+                                      sizeof(*rdev->wr_log),
+                                      GFP_KERNEL);
                if (rdev->wr_log) {
                        rdev->wr_log_size = 1 << c4iw_wr_log_size_order;
                        atomic_set(&rdev->wr_log_idx, 0);
@@ -1445,7 +1446,7 @@ static void recover_queues(struct uld_ctx *ctx)
        ctx->dev->db_state = RECOVERY;
        idr_for_each(&ctx->dev->qpidr, count_qps, &count);
 
-       qp_list.qps = kzalloc(count * sizeof *qp_list.qps, GFP_ATOMIC);
+       qp_list.qps = kcalloc(count, sizeof(*qp_list.qps), GFP_ATOMIC);
        if (!qp_list.qps) {
                spin_unlock_irq(&ctx->dev->lock);
                return;
index 4106eed1b8fbde8f438875e1502a91b98b37b6a1..aef53305f1c37f2dba46704866d18f799cc7c323 100644 (file)
@@ -216,15 +216,15 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
        }
 
        if (!user) {
-               wq->sq.sw_sq = kzalloc(wq->sq.size * sizeof *wq->sq.sw_sq,
-                                GFP_KERNEL);
+               wq->sq.sw_sq = kcalloc(wq->sq.size, sizeof(*wq->sq.sw_sq),
+                                      GFP_KERNEL);
                if (!wq->sq.sw_sq) {
                        ret = -ENOMEM;
                        goto free_rq_qid;
                }
 
-               wq->rq.sw_rq = kzalloc(wq->rq.size * sizeof *wq->rq.sw_rq,
-                                GFP_KERNEL);
+               wq->rq.sw_rq = kcalloc(wq->rq.size, sizeof(*wq->rq.sw_rq),
+                                      GFP_KERNEL);
                if (!wq->rq.sw_rq) {
                        ret = -ENOMEM;
                        goto free_sw_sq;
index 0e8dad68910ab47a4952b384faa9c501bcf4c48b..a6e11be0ea0fbee763fdf59186efe8e8be019cd5 100644 (file)
@@ -3177,7 +3177,7 @@ static int hns_roce_v2_modify_qp(struct ib_qp *ibqp,
        struct device *dev = hr_dev->dev;
        int ret = -EINVAL;
 
-       context = kzalloc(2 * sizeof(*context), GFP_KERNEL);
+       context = kcalloc(2, sizeof(*context), GFP_KERNEL);
        if (!context)
                return -ENOMEM;
 
index d604b3d5aa3e4a7d21fc22a9a669b6fd299ec8f7..90a3e2642c2e11bd3f54e3d0e874c212aa3bb401 100644 (file)
@@ -1613,7 +1613,8 @@ static int mlx4_ib_alloc_pv_bufs(struct mlx4_ib_demux_pv_ctx *ctx,
 
        tun_qp = &ctx->qp[qp_type];
 
-       tun_qp->ring = kzalloc(sizeof (struct mlx4_ib_buf) * MLX4_NUM_TUNNEL_BUFS,
+       tun_qp->ring = kcalloc(MLX4_NUM_TUNNEL_BUFS,
+                              sizeof(struct mlx4_ib_buf),
                               GFP_KERNEL);
        if (!tun_qp->ring)
                return -ENOMEM;
index dc3c2346045c205e2a8acd0ff4844a924fb161c4..6686042aafb4065de1372526766ffd9871349e60 100644 (file)
@@ -144,7 +144,7 @@ static int mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
        buddy->max_order = max_order;
        spin_lock_init(&buddy->lock);
 
-       buddy->bits = kzalloc((buddy->max_order + 1) * sizeof (long *),
+       buddy->bits = kcalloc(buddy->max_order + 1, sizeof(long *),
                              GFP_KERNEL);
        buddy->num_free = kcalloc((buddy->max_order + 1), sizeof *buddy->num_free,
                                  GFP_KERNEL);
index 15d064479ef6c5347f48ef804aa380a0c5eadb0f..7ea970774839a52e39de4eae89bcc06261012e9c 100644 (file)
@@ -79,7 +79,7 @@ s64 mthca_make_profile(struct mthca_dev *dev,
        struct mthca_resource *profile;
        int i, j;
 
-       profile = kzalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL);
+       profile = kcalloc(MTHCA_RES_NUM, sizeof(*profile), GFP_KERNEL);
        if (!profile)
                return -ENOMEM;
 
index 21e0ebd39a0555e3114360163d9fd53b84ab2dce..9bdb84dc225cfe9763541f271ccfdabd42e77716 100644 (file)
@@ -878,7 +878,8 @@ int nes_init_mgt_qp(struct nes_device *nesdev, struct net_device *netdev, struct
        int ret;
 
        /* Allocate space the all mgt QPs once */
-       mgtvnic = kzalloc(NES_MGT_QP_COUNT * sizeof(struct nes_vnic_mgt), GFP_KERNEL);
+       mgtvnic = kcalloc(NES_MGT_QP_COUNT, sizeof(struct nes_vnic_mgt),
+                         GFP_KERNEL);
        if (!mgtvnic)
                return -ENOMEM;
 
index 1040a6e34230d4cf2a4be130e25ef6c808f0c8fd..32f26556c808016f2d6f68f975a502724b714084 100644 (file)
@@ -2254,8 +2254,9 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
                                                                ibmr = ERR_PTR(-ENOMEM);
                                                                goto reg_user_mr_err;
                                                        }
-                                                       root_vpbl.leaf_vpbl = kzalloc(sizeof(*root_vpbl.leaf_vpbl)*1024,
-                                                                       GFP_KERNEL);
+                                                       root_vpbl.leaf_vpbl = kcalloc(1024,
+                                                                                     sizeof(*root_vpbl.leaf_vpbl),
+                                                                                     GFP_KERNEL);
                                                        if (!root_vpbl.leaf_vpbl) {
                                                                ib_umem_release(region);
                                                                pci_free_consistent(nesdev->pcidev, 8192, root_vpbl.pbl_vbase,
index 2c260e1c29d16f425cf2b9d654ff17bc73460e5e..6c136e5017fe7eeebfbc2e7a013cbdcf12978623 100644 (file)
@@ -3096,7 +3096,7 @@ static int ocrdma_create_eqs(struct ocrdma_dev *dev)
        if (!num_eq)
                return -EINVAL;
 
-       dev->eq_tbl = kzalloc(sizeof(struct ocrdma_eq) * num_eq, GFP_KERNEL);
+       dev->eq_tbl = kcalloc(num_eq, sizeof(struct ocrdma_eq), GFP_KERNEL);
        if (!dev->eq_tbl)
                return -ENOMEM;
 
index eb8b6a935016e4bfd8fac97c8bad28ef8a7fa8ce..5962c0ed984781d3a4c023b27adbe5fbb036d7e0 100644 (file)
@@ -221,19 +221,20 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 static int ocrdma_alloc_resources(struct ocrdma_dev *dev)
 {
        mutex_init(&dev->dev_lock);
-       dev->cq_tbl = kzalloc(sizeof(struct ocrdma_cq *) *
-                             OCRDMA_MAX_CQ, GFP_KERNEL);
+       dev->cq_tbl = kcalloc(OCRDMA_MAX_CQ, sizeof(struct ocrdma_cq *),
+                             GFP_KERNEL);
        if (!dev->cq_tbl)
                goto alloc_err;
 
        if (dev->attr.max_qp) {
-               dev->qp_tbl = kzalloc(sizeof(struct ocrdma_qp *) *
-                                     OCRDMA_MAX_QP, GFP_KERNEL);
+               dev->qp_tbl = kcalloc(OCRDMA_MAX_QP,
+                                     sizeof(struct ocrdma_qp *),
+                                     GFP_KERNEL);
                if (!dev->qp_tbl)
                        goto alloc_err;
        }
 
-       dev->stag_arr = kzalloc(sizeof(u64) * OCRDMA_MAX_STAG, GFP_KERNEL);
+       dev->stag_arr = kcalloc(OCRDMA_MAX_STAG, sizeof(u64), GFP_KERNEL);
        if (dev->stag_arr == NULL)
                goto alloc_err;
 
index eb9f9e9e213bf879a1b857feec3169d34198b69d..82e20fc32890eca3fcc25729f6887fee9399fbad 100644 (file)
@@ -843,8 +843,8 @@ static int ocrdma_build_pbl_tbl(struct ocrdma_dev *dev, struct ocrdma_hw_mr *mr)
        void *va;
        dma_addr_t pa;
 
-       mr->pbl_table = kzalloc(sizeof(struct ocrdma_pbl) *
-                               mr->num_pbls, GFP_KERNEL);
+       mr->pbl_table = kcalloc(mr->num_pbls, sizeof(struct ocrdma_pbl),
+                               GFP_KERNEL);
 
        if (!mr->pbl_table)
                return -ENOMEM;
@@ -1323,12 +1323,12 @@ static void ocrdma_set_qp_db(struct ocrdma_dev *dev, struct ocrdma_qp *qp,
 static int ocrdma_alloc_wr_id_tbl(struct ocrdma_qp *qp)
 {
        qp->wqe_wr_id_tbl =
-           kzalloc(sizeof(*(qp->wqe_wr_id_tbl)) * qp->sq.max_cnt,
+           kcalloc(qp->sq.max_cnt, sizeof(*(qp->wqe_wr_id_tbl)),
                    GFP_KERNEL);
        if (qp->wqe_wr_id_tbl == NULL)
                return -ENOMEM;
        qp->rqe_wr_id_tbl =
-           kzalloc(sizeof(u64) * qp->rq.max_cnt, GFP_KERNEL);
+           kcalloc(qp->rq.max_cnt, sizeof(u64), GFP_KERNEL);
        if (qp->rqe_wr_id_tbl == NULL)
                return -ENOMEM;
 
@@ -1865,8 +1865,8 @@ struct ib_srq *ocrdma_create_srq(struct ib_pd *ibpd,
 
        if (udata == NULL) {
                status = -ENOMEM;
-               srq->rqe_wr_id_tbl = kzalloc(sizeof(u64) * srq->rq.max_cnt,
-                           GFP_KERNEL);
+               srq->rqe_wr_id_tbl = kcalloc(srq->rq.max_cnt, sizeof(u64),
+                                            GFP_KERNEL);
                if (srq->rqe_wr_id_tbl == NULL)
                        goto arm_err;
 
index f4cb60b658ea7712592fc1e704cce84d50286630..ad22b32bbd9ce92a9769fecc049c0138f2c10fde 100644 (file)
@@ -317,8 +317,8 @@ static int qedr_alloc_resources(struct qedr_dev *dev)
        u16 n_entries;
        int i, rc;
 
-       dev->sgid_tbl = kzalloc(sizeof(union ib_gid) *
-                               QEDR_MAX_SGID, GFP_KERNEL);
+       dev->sgid_tbl = kcalloc(QEDR_MAX_SGID, sizeof(union ib_gid),
+                               GFP_KERNEL);
        if (!dev->sgid_tbl)
                return -ENOMEM;
 
index 710032f1fad7ece2714b271808e50de2c5930c29..f7ac8fc9b531d7550fb0b41233b55e0bec51b4ff 100644 (file)
@@ -1614,7 +1614,7 @@ static int qedr_create_kernel_qp(struct qedr_dev *dev,
        qp->sq.max_wr = min_t(u32, attrs->cap.max_send_wr * dev->wq_multiplier,
                              dev->attr.max_sqe);
 
-       qp->wqe_wr_id = kzalloc(qp->sq.max_wr * sizeof(*qp->wqe_wr_id),
+       qp->wqe_wr_id = kcalloc(qp->sq.max_wr, sizeof(*qp->wqe_wr_id),
                                GFP_KERNEL);
        if (!qp->wqe_wr_id) {
                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,
        qp->rq.max_wr = (u16) max_t(u32, attrs->cap.max_recv_wr, 1);
 
        /* Allocate driver internal RQ array */
-       qp->rqe_wr_id = kzalloc(qp->rq.max_wr * sizeof(*qp->rqe_wr_id),
+       qp->rqe_wr_id = kcalloc(qp->rq.max_wr, sizeof(*qp->rqe_wr_id),
                                GFP_KERNEL);
        if (!qp->rqe_wr_id) {
                DP_ERR(dev,
index 27155d92f81030ed4b49fa37b0596bb9eba40eaf..bf5e222eed8e61fcc66a7d59e9aed89e603f1c17 100644 (file)
@@ -7295,8 +7295,9 @@ struct qib_devdata *qib_init_iba7322_funcs(struct pci_dev *pdev,
                actual_cnt -= dd->num_pports;
 
        tabsize = actual_cnt;
-       dd->cspec->msix_entries = kzalloc(tabsize *
-                       sizeof(struct qib_msix_entry), GFP_KERNEL);
+       dd->cspec->msix_entries = kcalloc(tabsize,
+                                         sizeof(struct qib_msix_entry),
+                                         GFP_KERNEL);
        if (!dd->cspec->msix_entries)
                tabsize = 0;
 
index 0155202897352e4eb52d93883e9806218e9f972f..dd4547f537f77d85a996a88bd021e2920a3b5541 100644 (file)
@@ -1134,8 +1134,8 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
        if (!qib_cpulist_count) {
                u32 count = num_online_cpus();
 
-               qib_cpulist = kzalloc(BITS_TO_LONGS(count) *
-                                     sizeof(long), GFP_KERNEL);
+               qib_cpulist = kcalloc(BITS_TO_LONGS(count), sizeof(long),
+                                     GFP_KERNEL);
                if (qib_cpulist)
                        qib_cpulist_count = count;
        }
index 912d8ef043521fadd38a50ffbf4a1c5763cc69fd..bf5136533d4972684e2db3556fa89d355bd6ba0b 100644 (file)
@@ -543,7 +543,7 @@ alloc_res_chunk_list(struct usnic_vnic *vnic,
                /* Do Nothing */
        }
 
-       res_chunk_list = kzalloc(sizeof(*res_chunk_list)*(res_lst_sz+1),
+       res_chunk_list = kcalloc(res_lst_sz + 1, sizeof(*res_chunk_list),
                                        GFP_ATOMIC);
        if (!res_chunk_list)
                return ERR_PTR(-ENOMEM);
index e7b0030254da61930a433b553676a0bf46feef6b..ebe08f348453d57046097fe1b28e20370431ce1d 100644 (file)
@@ -312,7 +312,7 @@ static int usnic_vnic_alloc_res_chunk(struct usnic_vnic *vnic,
        }
 
        chunk->cnt = chunk->free_cnt = cnt;
-       chunk->res = kzalloc(sizeof(*(chunk->res))*cnt, GFP_KERNEL);
+       chunk->res = kcalloc(cnt, sizeof(*(chunk->res)), GFP_KERNEL);
        if (!chunk->res)
                return -ENOMEM;
 
index 2ce40a7ff6040b7c2fc73466361a8fdc75f119b9..0d74c807110eaedf90dca2904c63a85d815a09d2 100644 (file)
@@ -1526,7 +1526,7 @@ static int ipoib_neigh_hash_init(struct ipoib_dev_priv *priv)
                return -ENOMEM;
        set_bit(IPOIB_STOP_NEIGH_GC, &priv->flags);
        size = roundup_pow_of_two(arp_tbl.gc_thresh3);
-       buckets = kzalloc(size * sizeof(*buckets), GFP_KERNEL);
+       buckets = kcalloc(size, sizeof(*buckets), GFP_KERNEL);
        if (!buckets) {
                kfree(htbl);
                return -ENOMEM;
@@ -1704,8 +1704,9 @@ static int ipoib_dev_init_default(struct net_device *dev)
        ipoib_napi_add(dev);
 
        /* Allocate RX/TX "rings" to hold queued skbs */
-       priv->rx_ring = kzalloc(ipoib_recvq_size * sizeof *priv->rx_ring,
-                               GFP_KERNEL);
+       priv->rx_ring = kcalloc(ipoib_recvq_size,
+                                      sizeof(*priv->rx_ring),
+                                      GFP_KERNEL);
        if (!priv->rx_ring)
                goto out;
 
index f2f9318e1f498db33cd47e45fc591a1274c9a4dc..cccbcf0eb035a31124066c21ae4de7e525055aaf 100644 (file)
@@ -181,8 +181,9 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn)
        u64 dma_addr;
        int i, j;
 
-       isert_conn->rx_descs = kzalloc(ISERT_QP_MAX_RECV_DTOS *
-                               sizeof(struct iser_rx_desc), GFP_KERNEL);
+       isert_conn->rx_descs = kcalloc(ISERT_QP_MAX_RECV_DTOS,
+                                      sizeof(struct iser_rx_desc),
+                                      GFP_KERNEL);
        if (!isert_conn->rx_descs)
                return -ENOMEM;
 
index 940d38b08e6b5675c8c5763836b832f0714d4f2a..46406345742b97c06595ab7e3b785ee2a6daca1b 100644 (file)
@@ -337,7 +337,8 @@ static int omap4_keypad_probe(struct platform_device *pdev)
 
        keypad_data->row_shift = get_count_order(keypad_data->cols);
        max_keys = keypad_data->rows << keypad_data->row_shift;
-       keypad_data->keymap = kzalloc(max_keys * sizeof(keypad_data->keymap[0]),
+       keypad_data->keymap = kcalloc(max_keys,
+                                     sizeof(keypad_data->keymap[0]),
                                      GFP_KERNEL);
        if (!keypad_data->keymap) {
                dev_err(&pdev->dev, "Not enough memory for keymap\n");
index 4321f7704b239cbdd29560d64d756dd022a8b6d6..75456b5aa825fac7a5f81c8fe366d47618acc1cc 100644 (file)
@@ -1458,7 +1458,7 @@ int dmar_enable_qi(struct intel_iommu *iommu)
 
        qi->desc = page_address(desc_page);
 
-       qi->desc_status = kzalloc(QI_LENGTH * sizeof(int), GFP_ATOMIC);
+       qi->desc_status = kcalloc(QI_LENGTH, sizeof(int), GFP_ATOMIC);
        if (!qi->desc_status) {
                free_page((unsigned long) qi->desc);
                kfree(qi);
index 89e49a429c571d1b5c3eb042dc511500b1527b25..14e4b37224284976a1cb8890e5d13ae5337350cc 100644 (file)
@@ -3189,7 +3189,7 @@ static int copy_translation_tables(struct intel_iommu *iommu)
        /* This is too big for the stack - allocate it from slab */
        ctxt_table_entries = ext ? 512 : 256;
        ret = -ENOMEM;
-       ctxt_tbls = kzalloc(ctxt_table_entries * sizeof(void *), GFP_KERNEL);
+       ctxt_tbls = kcalloc(ctxt_table_entries, sizeof(void *), GFP_KERNEL);
        if (!ctxt_tbls)
                goto out_unmap;
 
@@ -4032,7 +4032,7 @@ static int iommu_suspend(void)
        unsigned long flag;
 
        for_each_active_iommu(iommu, drhd) {
-               iommu->iommu_state = kzalloc(sizeof(u32) * MAX_SR_DMAR_REGS,
+               iommu->iommu_state = kcalloc(MAX_SR_DMAR_REGS, sizeof(u32),
                                                 GFP_ATOMIC);
                if (!iommu->iommu_state)
                        goto nomem;
index c33b7b104e72a85dc0355a3c2d996cddeed29218..af4a8e7fcd27453f160788c93c660f7cf39ff3ab 100644 (file)
@@ -1455,7 +1455,7 @@ static int omap_iommu_add_device(struct device *dev)
        if (num_iommus < 0)
                return 0;
 
-       arch_data = kzalloc((num_iommus + 1) * sizeof(*arch_data), GFP_KERNEL);
+       arch_data = kcalloc(num_iommus + 1, sizeof(*arch_data), GFP_KERNEL);
        if (!arch_data)
                return -ENOMEM;
 
index 9b23843dcad4d7bb24851f30f663da84b503310e..a16b320739b4be0feed888eaf962b90a4b9b2690 100644 (file)
@@ -457,8 +457,8 @@ static int tpci200_install(struct tpci200_board *tpci200)
 {
        int res;
 
-       tpci200->slots = kzalloc(
-               TPCI200_NB_SLOT * sizeof(struct tpci200_slot), GFP_KERNEL);
+       tpci200->slots = kcalloc(TPCI200_NB_SLOT, sizeof(struct tpci200_slot),
+                                GFP_KERNEL);
        if (tpci200->slots == NULL)
                return -ENOMEM;
 
index 63d980995d17d0751194f4c64fdbfeaab78be3db..23a3b877f7f1dfe350ef70f26c78efeefdae0060 100644 (file)
@@ -268,7 +268,8 @@ static int alpine_msix_init(struct device_node *node,
                goto err_priv;
        }
 
-       priv->msi_map = kzalloc(sizeof(*priv->msi_map) * BITS_TO_LONGS(priv->num_spis),
+       priv->msi_map = kcalloc(BITS_TO_LONGS(priv->num_spis),
+                               sizeof(*priv->msi_map),
                                GFP_KERNEL);
        if (!priv->msi_map) {
                ret = -ENOMEM;
index 1ff38aff9f29f32f895bc9a1975404a0f0e2ce3f..0f52d44b3f6997c8c9e4e6f6f1a7da7b43d3e7c5 100644 (file)
@@ -361,7 +361,7 @@ static int __init gicv2m_init_one(struct fwnode_handle *fwnode,
                break;
        }
 
-       v2m->bm = kzalloc(sizeof(long) * BITS_TO_LONGS(v2m->nr_spis),
+       v2m->bm = kcalloc(BITS_TO_LONGS(v2m->nr_spis), sizeof(long),
                          GFP_KERNEL);
        if (!v2m->bm) {
                ret = -ENOMEM;
index 4e7ce74e558d66bd2bc689b6eea144a6ce19f6f7..5377d7e2afba62b518671267b5d29c4963c2e5e6 100644 (file)
@@ -1239,7 +1239,7 @@ static int its_vlpi_map(struct irq_data *d, struct its_cmd_info *info)
        if (!its_dev->event_map.vm) {
                struct its_vlpi_map *maps;
 
-               maps = kzalloc(sizeof(*maps) * its_dev->event_map.nr_lpis,
+               maps = kcalloc(its_dev->event_map.nr_lpis, sizeof(*maps),
                               GFP_KERNEL);
                if (!maps) {
                        ret = -ENOMEM;
@@ -1437,7 +1437,7 @@ static int __init its_lpi_init(u32 id_bits)
 {
        lpi_chunks = its_lpi_to_chunk(1UL << id_bits);
 
-       lpi_bitmap = kzalloc(BITS_TO_LONGS(lpi_chunks) * sizeof(long),
+       lpi_bitmap = kcalloc(BITS_TO_LONGS(lpi_chunks), sizeof(long),
                             GFP_KERNEL);
        if (!lpi_bitmap) {
                lpi_chunks = 0;
@@ -1471,7 +1471,8 @@ static unsigned long *its_lpi_alloc_chunks(int nr_irqs, int *base, int *nr_ids)
        if (!nr_chunks)
                goto out;
 
-       bitmap = kzalloc(BITS_TO_LONGS(nr_chunks * IRQS_PER_CHUNK) * sizeof (long),
+       bitmap = kcalloc(BITS_TO_LONGS(nr_chunks * IRQS_PER_CHUNK),
+                        sizeof(long),
                         GFP_ATOMIC);
        if (!bitmap)
                goto out;
@@ -1823,7 +1824,7 @@ static int its_alloc_tables(struct its_node *its)
 
 static int its_alloc_collections(struct its_node *its)
 {
-       its->collections = kzalloc(nr_cpu_ids * sizeof(*its->collections),
+       its->collections = kcalloc(nr_cpu_ids, sizeof(*its->collections),
                                   GFP_KERNEL);
        if (!its->collections)
                return -ENOMEM;
@@ -2124,10 +2125,10 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
        if (alloc_lpis) {
                lpi_map = its_lpi_alloc_chunks(nvecs, &lpi_base, &nr_lpis);
                if (lpi_map)
-                       col_map = kzalloc(sizeof(*col_map) * nr_lpis,
+                       col_map = kcalloc(nr_lpis, sizeof(*col_map),
                                          GFP_KERNEL);
        } else {
-               col_map = kzalloc(sizeof(*col_map) * nr_ites, GFP_KERNEL);
+               col_map = kcalloc(nr_ites, sizeof(*col_map), GFP_KERNEL);
                nr_lpis = 0;
                lpi_base = 0;
        }
@@ -3183,7 +3184,7 @@ static int its_init_vpe_domain(void)
        its = list_first_entry(&its_nodes, struct its_node, entry);
 
        entries = roundup_pow_of_two(nr_cpu_ids);
-       vpe_proxy.vpes = kzalloc(sizeof(*vpe_proxy.vpes) * entries,
+       vpe_proxy.vpes = kcalloc(entries, sizeof(*vpe_proxy.vpes),
                                 GFP_KERNEL);
        if (!vpe_proxy.vpes) {
                pr_err("ITS: Can't allocate GICv4 proxy device array\n");
index 5a67ec084588711c850bce2e5ae6a2c8c9b9f60a..76ea56d779a15825654cdf13573ac263fc14d717 100644 (file)
@@ -1167,7 +1167,7 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)
        if (!nr_parts)
                goto out_put_node;
 
-       parts = kzalloc(sizeof(*parts) * nr_parts, GFP_KERNEL);
+       parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
        if (WARN_ON(!parts))
                goto out_put_node;
 
@@ -1289,7 +1289,8 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
        if (of_property_read_u32(node, "#redistributor-regions", &nr_redist_regions))
                nr_redist_regions = 1;
 
-       rdist_regs = kzalloc(sizeof(*rdist_regs) * nr_redist_regions, GFP_KERNEL);
+       rdist_regs = kcalloc(nr_redist_regions, sizeof(*rdist_regs),
+                            GFP_KERNEL);
        if (!rdist_regs) {
                err = -ENOMEM;
                goto out_unmap_dist;
index ccd72c2cbc2301a2216952f5b1a3321ff5eedfb6..1f7cc5933cd5edaeb15b94b6e6793b749f050563 100644 (file)
@@ -229,7 +229,7 @@ struct partition_desc *partition_create_desc(struct fwnode_handle *fwnode,
                goto out;
        desc->domain = d;
 
-       desc->bitmap = kzalloc(sizeof(long) * BITS_TO_LONGS(nr_parts),
+       desc->bitmap = kcalloc(BITS_TO_LONGS(nr_parts), sizeof(long),
                               GFP_KERNEL);
        if (WARN_ON(!desc->bitmap))
                goto out;
index ec0e6a8cdb7558433d933868520d8d72e7b28b2b..f6fd57ebe6e6468f3ce98ec90cb1b7de5b9e6bfc 100644 (file)
@@ -1261,7 +1261,7 @@ static int __init s3c_init_intc_of(struct device_node *np,
                        return -ENOMEM;
 
                intc->domain = domain;
-               intc->irqs = kzalloc(sizeof(struct s3c_irq_data) * 32,
+               intc->irqs = kcalloc(32, sizeof(struct s3c_irq_data),
                                     GFP_KERNEL);
                if (!intc->irqs) {
                        kfree(intc);
index baa1ee2bc2ac026ab6d6f950ef5e4c77e1475a24..6e0c2814d0329ace7b109915d58c9805ce2b1e6a 100644 (file)
@@ -1260,7 +1260,7 @@ static int __init capinc_tty_init(void)
        if (capi_ttyminors <= 0)
                capi_ttyminors = CAPINC_NR_PORTS;
 
-       capiminors = kzalloc(sizeof(struct capiminor *) * capi_ttyminors,
+       capiminors = kcalloc(capi_ttyminors, sizeof(struct capiminor *),
                             GFP_KERNEL);
        if (!capiminors)
                return -ENOMEM;
index fd13ed44a54ec0c126f10b8c927a15aba6d2e35f..9cb2ab57fa4af962a4c39cd9300bd352fe6f7043 100644 (file)
@@ -1370,7 +1370,7 @@ static void do_connect_req(struct gigaset_capi_ctr *iif,
        cmsg->adr.adrPLCI |= (bcs->channel + 1) << 8;
 
        /* build command table */
-       commands = kzalloc(AT_NUM * (sizeof *commands), GFP_KERNEL);
+       commands = kcalloc(AT_NUM, sizeof(*commands), GFP_KERNEL);
        if (!commands)
                goto oom;
 
index 2d75329007f158e31975a1d745e147a75ef8e7e6..b5b389e95edd2681ca6448cc116db2c9faba531a 100644 (file)
@@ -243,7 +243,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
                dev_kfree_skb(bcs->rx_skb);
                gigaset_new_rx_skb(bcs);
 
-               commands = kzalloc(AT_NUM * (sizeof *commands), GFP_ATOMIC);
+               commands = kcalloc(AT_NUM, sizeof(*commands), GFP_ATOMIC);
                if (!commands) {
                        gigaset_free_channel(bcs);
                        dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n");
index 5ee5489d3f15bfbf569eccfc3680f2a0fe251d0d..4ac378e489023f19b42eaf95eff35d6a8ef1913d 100644 (file)
@@ -72,7 +72,7 @@ avmcard *b1_alloc_card(int nr_controllers)
        if (!card)
                return NULL;
 
-       cinfo = kzalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL);
+       cinfo = kcalloc(nr_controllers, sizeof(*cinfo), GFP_KERNEL);
        if (!cinfo) {
                kfree(card);
                return NULL;
index 3e020ec0f65e075809848790ec535cc615a86065..80ba82f77c63d02c0395fdbb17ed0a5b039100bc 100644 (file)
@@ -27,7 +27,9 @@ FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount)
        int i;
 
        fsm->jumpmatrix =
-               kzalloc(sizeof(FSMFNPTR) * fsm->state_count * fsm->event_count, GFP_KERNEL);
+               kzalloc(array3_size(sizeof(FSMFNPTR), fsm->state_count,
+                                   fsm->event_count),
+                       GFP_KERNEL);
        if (!fsm->jumpmatrix)
                return -ENOMEM;
 
index 1644ac52548bd32410a544f79ce7f586ec0028b1..7a501dbe7123ea78a56be5b3a6321c46e661294c 100644 (file)
@@ -2070,14 +2070,14 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
 
        if ((adding) && (d->rcverr))
                kfree(d->rcverr);
-       if (!(d->rcverr = kzalloc(sizeof(int) * m, GFP_ATOMIC))) {
+       if (!(d->rcverr = kcalloc(m, sizeof(int), GFP_ATOMIC))) {
                printk(KERN_WARNING "register_isdn: Could not alloc rcverr\n");
                return -1;
        }
 
        if ((adding) && (d->rcvcount))
                kfree(d->rcvcount);
-       if (!(d->rcvcount = kzalloc(sizeof(int) * m, GFP_ATOMIC))) {
+       if (!(d->rcvcount = kcalloc(m, sizeof(int), GFP_ATOMIC))) {
                printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
                if (!adding)
                        kfree(d->rcverr);
index cabcb906e0b564a014d4be7941f40acc7792e131..9a8d08d677a4c2700a583179824028a459481cf0 100644 (file)
@@ -32,8 +32,10 @@ mISDN_FsmNew(struct Fsm *fsm,
 {
        int i;
 
-       fsm->jumpmatrix = kzalloc(sizeof(FSMFNPTR) * fsm->state_count *
-                                 fsm->event_count, GFP_KERNEL);
+       fsm->jumpmatrix =
+               kzalloc(array3_size(sizeof(FSMFNPTR), fsm->state_count,
+                                   fsm->event_count),
+                       GFP_KERNEL);
        if (fsm->jumpmatrix == NULL)
                return -ENOMEM;
 
index f497a77423a2b7c65dbc2150555b9658e6e8d863..c7a7c2de0672930cb62c30bf2fcb62e409536f17 100644 (file)
@@ -379,7 +379,7 @@ static int pblk_core_init(struct pblk *pblk)
                return -EINVAL;
        }
 
-       pblk->pad_dist = kzalloc((pblk->min_write_pgs - 1) * sizeof(atomic64_t),
+       pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t),
                                                                GFP_KERNEL);
        if (!pblk->pad_dist)
                return -ENOMEM;
index fc3c237daef24ec6e96ec30319361a9385a4a891..311e91b1a14f3f24ac2f861d882d38a026281b7b 100644 (file)
@@ -466,7 +466,8 @@ static int __init acpi_pcc_probe(void)
                return -EINVAL;
        }
 
-       pcc_mbox_channels = kzalloc(sizeof(struct mbox_chan) * count, GFP_KERNEL);
+       pcc_mbox_channels = kcalloc(count, sizeof(struct mbox_chan),
+                                   GFP_KERNEL);
        if (!pcc_mbox_channels) {
                pr_err("Could not allocate space for PCC mbox channels\n");
                return -ENOMEM;
index a31e55bcc4e565263a285febd0b8ebf7a569f05f..ec5f70d021dee92d8609f7023f42c31cc53ba018 100644 (file)
@@ -1715,7 +1715,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb)
        iter_size = (sb->bucket_size / sb->block_size + 1) *
                sizeof(struct btree_iter_set);
 
-       if (!(c->devices = kzalloc(c->nr_uuids * sizeof(void *), GFP_KERNEL)) ||
+       if (!(c->devices = kcalloc(c->nr_uuids, sizeof(void *), GFP_KERNEL)) ||
            mempool_init_slab_pool(&c->search, 32, bch_search_cache) ||
            mempool_init_kmalloc_pool(&c->bio_meta, 2,
                                      sizeof(struct bbio) + sizeof(struct bio_vec) *
@@ -2043,8 +2043,9 @@ static int cache_alloc(struct cache *ca)
            !init_heap(&ca->heap,       free << 3, GFP_KERNEL) ||
            !(ca->buckets       = vzalloc(sizeof(struct bucket) *
                                          ca->sb.nbuckets)) ||
-           !(ca->prio_buckets  = kzalloc(sizeof(uint64_t) * prio_buckets(ca) *
-                                         2, GFP_KERNEL)) ||
+           !(ca->prio_buckets  = kzalloc(array3_size(sizeof(uint64_t),
+                                                     prio_buckets(ca), 2),
+                                         GFP_KERNEL)) ||
            !(ca->disk_buckets  = alloc_bucket_pages(GFP_KERNEL, ca)))
                return -ENOMEM;
 
index da02f4d8e4b95b4eefa7c7146ce28e65653e974e..57ca92dc0c3ea1cb42254f5541f10bf5e45e86c8 100644 (file)
@@ -1878,8 +1878,9 @@ static int crypt_alloc_tfms_skcipher(struct crypt_config *cc, char *ciphermode)
        unsigned i;
        int err;
 
-       cc->cipher_tfm.tfms = kzalloc(cc->tfms_count *
-                                     sizeof(struct crypto_skcipher *), GFP_KERNEL);
+       cc->cipher_tfm.tfms = kcalloc(cc->tfms_count,
+                                     sizeof(struct crypto_skcipher *),
+                                     GFP_KERNEL);
        if (!cc->cipher_tfm.tfms)
                return -ENOMEM;
 
index 01c8329b512d2ca8ce119a0b835edb738f22d9e7..f983c3fdf204169564ad64ee789e9961e3b47bec 100644 (file)
@@ -2117,7 +2117,7 @@ int bitmap_resize(struct bitmap *bitmap, sector_t blocks,
 
        pages = DIV_ROUND_UP(chunks, PAGE_COUNTER_RATIO);
 
-       new_bp = kzalloc(pages * sizeof(*new_bp), GFP_KERNEL);
+       new_bp = kcalloc(pages, sizeof(*new_bp), GFP_KERNEL);
        ret = -ENOMEM;
        if (!new_bp) {
                bitmap_file_unmap(&store);
index 79bfbc840385b65ae2a2b23f7c25d8a5f7460171..021cbf9ef1bf9af7c8e805f443862918f38e9162 100644 (file)
@@ -1380,9 +1380,9 @@ static int lock_all_bitmaps(struct mddev *mddev)
        char str[64];
        struct md_cluster_info *cinfo = mddev->cluster_info;
 
-       cinfo->other_bitmap_lockres = kzalloc((mddev->bitmap_info.nodes - 1) *
-                                            sizeof(struct dlm_lock_resource *),
-                                            GFP_KERNEL);
+       cinfo->other_bitmap_lockres =
+               kcalloc(mddev->bitmap_info.nodes - 1,
+                       sizeof(struct dlm_lock_resource *), GFP_KERNEL);
        if (!cinfo->other_bitmap_lockres) {
                pr_err("md: can't alloc mem for other bitmap locks\n");
                return 0;
index f71fcdb9b39c50052b8747a976ce89e0df33a6a1..881487de1e25af5e994c8770e255b74b3864f513 100644 (file)
@@ -399,7 +399,8 @@ static int multipath_run (struct mddev *mddev)
        if (!conf)
                goto out;
 
-       conf->multipaths = kzalloc(sizeof(struct multipath_info)*mddev->raid_disks,
+       conf->multipaths = kcalloc(mddev->raid_disks,
+                                  sizeof(struct multipath_info),
                                   GFP_KERNEL);
        if (!conf->multipaths)
                goto out_free_conf;
index 65ae47a02218744fc99d057b6fba301dd0f83e07..ac1cffd2a09b05f5f5217e579c9e87ea80efce84 100644 (file)
@@ -159,12 +159,14 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
        }
 
        err = -ENOMEM;
-       conf->strip_zone = kzalloc(sizeof(struct strip_zone)*
-                               conf->nr_strip_zones, GFP_KERNEL);
+       conf->strip_zone = kcalloc(conf->nr_strip_zones,
+                                  sizeof(struct strip_zone),
+                                  GFP_KERNEL);
        if (!conf->strip_zone)
                goto abort;
-       conf->devlist = kzalloc(sizeof(struct md_rdev*)*
-                               conf->nr_strip_zones*mddev->raid_disks,
+       conf->devlist = kzalloc(array3_size(sizeof(struct md_rdev *),
+                                           conf->nr_strip_zones,
+                                           mddev->raid_disks),
                                GFP_KERNEL);
        if (!conf->devlist)
                goto abort;
index e7c0ecd1923450524dad48fede345cfcb455eb57..8e05c1092aef4bb066a62d8f1781c203940291eb 100644 (file)
@@ -2936,9 +2936,9 @@ static struct r1conf *setup_conf(struct mddev *mddev)
        if (!conf->barrier)
                goto abort;
 
-       conf->mirrors = kzalloc(sizeof(struct raid1_info)
-                               * mddev->raid_disks * 2,
-                                GFP_KERNEL);
+       conf->mirrors = kzalloc(array3_size(sizeof(struct raid1_info),
+                                           mddev->raid_disks, 2),
+                               GFP_KERNEL);
        if (!conf->mirrors)
                goto abort;
 
@@ -3241,7 +3241,8 @@ static int raid1_reshape(struct mddev *mddev)
                kfree(newpoolinfo);
                return ret;
        }
-       newmirrors = kzalloc(sizeof(struct raid1_info) * raid_disks * 2,
+       newmirrors = kzalloc(array3_size(sizeof(struct raid1_info),
+                                        raid_disks, 2),
                             GFP_KERNEL);
        if (!newmirrors) {
                kfree(newpoolinfo);
index e35db73b9b9e92d14c91c520deeb8cc1a6f76024..478cf446827f469c1d02d6f2918fcb8dd870f893 100644 (file)
@@ -3688,8 +3688,8 @@ static struct r10conf *setup_conf(struct mddev *mddev)
                goto out;
 
        /* FIXME calc properly */
-       conf->mirrors = kzalloc(sizeof(struct raid10_info)*(mddev->raid_disks +
-                                                           max(0,-mddev->delta_disks)),
+       conf->mirrors = kcalloc(mddev->raid_disks + max(0, -mddev->delta_disks),
+                               sizeof(struct raid10_info),
                                GFP_KERNEL);
        if (!conf->mirrors)
                goto out;
@@ -4129,11 +4129,10 @@ static int raid10_check_reshape(struct mddev *mddev)
        conf->mirrors_new = NULL;
        if (mddev->delta_disks > 0) {
                /* allocate new 'mirrors' list */
-               conf->mirrors_new = kzalloc(
-                       sizeof(struct raid10_info)
-                       *(mddev->raid_disks +
-                         mddev->delta_disks),
-                       GFP_KERNEL);
+               conf->mirrors_new =
+                       kcalloc(mddev->raid_disks + mddev->delta_disks,
+                               sizeof(struct raid10_info),
+                               GFP_KERNEL);
                if (!conf->mirrors_new)
                        return -ENOMEM;
        }
index 73489446bbcb2e1753268d7589130eb59e5760e5..2031506a0ecd766112330ca5c8e08a7b01f84dfe 100644 (file)
@@ -2396,7 +2396,7 @@ static int resize_stripes(struct r5conf *conf, int newsize)
         * is completely stalled, so now is a good time to resize
         * conf->disks and the scribble region
         */
-       ndisks = kzalloc(newsize * sizeof(struct disk_info), GFP_NOIO);
+       ndisks = kcalloc(newsize, sizeof(struct disk_info), GFP_NOIO);
        if (ndisks) {
                for (i = 0; i < conf->pool_size; i++)
                        ndisks[i] = conf->disks[i];
@@ -6664,9 +6664,9 @@ static int alloc_thread_groups(struct r5conf *conf, int cnt,
        }
        *group_cnt = num_possible_nodes();
        size = sizeof(struct r5worker) * cnt;
-       workers = kzalloc(size * *group_cnt, GFP_NOIO);
-       *worker_groups = kzalloc(sizeof(struct r5worker_group) *
-                               *group_cnt, GFP_NOIO);
+       workers = kcalloc(size, *group_cnt, GFP_NOIO);
+       *worker_groups = kcalloc(*group_cnt, sizeof(struct r5worker_group),
+                                GFP_NOIO);
        if (!*worker_groups || !workers) {
                kfree(workers);
                kfree(*worker_groups);
@@ -6894,8 +6894,9 @@ static struct r5conf *setup_conf(struct mddev *mddev)
                goto abort;
        INIT_LIST_HEAD(&conf->free_list);
        INIT_LIST_HEAD(&conf->pending_list);
-       conf->pending_data = kzalloc(sizeof(struct r5pending_data) *
-               PENDING_IO_MAX, GFP_KERNEL);
+       conf->pending_data = kcalloc(PENDING_IO_MAX,
+                                    sizeof(struct r5pending_data),
+                                    GFP_KERNEL);
        if (!conf->pending_data)
                goto abort;
        for (i = 0; i < PENDING_IO_MAX; i++)
@@ -6944,7 +6945,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
                conf->previous_raid_disks = mddev->raid_disks - mddev->delta_disks;
        max_disks = max(conf->raid_disks, conf->previous_raid_disks);
 
-       conf->disks = kzalloc(max_disks * sizeof(struct disk_info),
+       conf->disks = kcalloc(max_disks, sizeof(struct disk_info),
                              GFP_KERNEL);
 
        if (!conf->disks)
index 902af482448ea5d2c6a552ae6065369f8f61af47..5a8dbc0b25fb23cba73491565aa7bcb28aa54a09 100644 (file)
@@ -2018,10 +2018,10 @@ static int dib7000pc_detection(struct i2c_adapter *i2c_adap)
        };
        int ret = 0;
 
-       tx = kzalloc(2*sizeof(u8), GFP_KERNEL);
+       tx = kzalloc(2, GFP_KERNEL);
        if (!tx)
                return -ENOMEM;
-       rx = kzalloc(2*sizeof(u8), GFP_KERNEL);
+       rx = kzalloc(2, GFP_KERNEL);
        if (!rx) {
                ret = -ENOMEM;
                goto rx_memory_error;
index 6f35173d2968d9e820badbf6be7f4246441202aa..22eec8f654858e3da776c40cbcafff15a09bae8b 100644 (file)
@@ -4271,12 +4271,12 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods,
        u8 new_addr = 0;
        struct i2c_device client = {.adap = host };
 
-       client.i2c_write_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL);
+       client.i2c_write_buffer = kzalloc(4, GFP_KERNEL);
        if (!client.i2c_write_buffer) {
                dprintk("%s: not enough memory\n", __func__);
                return -ENOMEM;
        }
-       client.i2c_read_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL);
+       client.i2c_read_buffer = kzalloc(4, GFP_KERNEL);
        if (!client.i2c_read_buffer) {
                dprintk("%s: not enough memory\n", __func__);
                ret = -ENOMEM;
index f9289f488de7db22a1806f44aedd0cc627e00edd..b8edb55696bb8c4caa9a718adae392673e59fe5d 100644 (file)
@@ -2381,12 +2381,12 @@ int dib9000_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defaul
        u8 new_addr = 0;
        struct i2c_device client = {.i2c_adap = i2c };
 
-       client.i2c_write_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL);
+       client.i2c_write_buffer = kzalloc(4, GFP_KERNEL);
        if (!client.i2c_write_buffer) {
                dprintk("%s: not enough memory\n", __func__);
                return -ENOMEM;
        }
-       client.i2c_read_buffer = kzalloc(4 * sizeof(u8), GFP_KERNEL);
+       client.i2c_read_buffer = kzalloc(4, GFP_KERNEL);
        if (!client.i2c_read_buffer) {
                dprintk("%s: not enough memory\n", __func__);
                ret = -ENOMEM;
index 964cd7bcdd2c67c102a62feeacdc5b3abccc1a1c..70e1879715901e03e47a36e1710b3675ea31e7b8 100644 (file)
@@ -217,14 +217,14 @@ static int au0828_init_isoc(struct au0828_dev *dev, int max_packets,
        dev->isoc_ctl.isoc_copy = isoc_copy;
        dev->isoc_ctl.num_bufs = num_bufs;
 
-       dev->isoc_ctl.urb = kzalloc(sizeof(void *)*num_bufs,  GFP_KERNEL);
+       dev->isoc_ctl.urb = kcalloc(num_bufs, sizeof(void *),  GFP_KERNEL);
        if (!dev->isoc_ctl.urb) {
                au0828_isocdbg("cannot alloc memory for usb buffers\n");
                return -ENOMEM;
        }
 
-       dev->isoc_ctl.transfer_buffer = kzalloc(sizeof(void *)*num_bufs,
-                                             GFP_KERNEL);
+       dev->isoc_ctl.transfer_buffer = kcalloc(num_bufs, sizeof(void *),
+                                               GFP_KERNEL);
        if (!dev->isoc_ctl.transfer_buffer) {
                au0828_isocdbg("cannot allocate memory for usb transfer\n");
                kfree(dev->isoc_ctl.urb);
index 4f43668df15df29275db3c296a747c0cc43fcdb7..53d846dea3d2a3c55a8b058ad4bd7bd283ce8fb3 100644 (file)
@@ -1034,7 +1034,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
                dma_q->partial_buf[i] = 0;
 
        dev->video_mode.isoc_ctl.urb =
-           kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
+           kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
        if (!dev->video_mode.isoc_ctl.urb) {
                dev_err(dev->dev,
                        "cannot alloc memory for usb buffers\n");
@@ -1042,7 +1042,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets,
        }
 
        dev->video_mode.isoc_ctl.transfer_buffer =
-           kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
+           kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
        if (!dev->video_mode.isoc_ctl.transfer_buffer) {
                dev_err(dev->dev,
                        "cannot allocate memory for usbtransfer\n");
@@ -1169,7 +1169,7 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
                dma_q->partial_buf[i] = 0;
 
        dev->video_mode.bulk_ctl.urb =
-           kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
+           kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
        if (!dev->video_mode.bulk_ctl.urb) {
                dev_err(dev->dev,
                        "cannot alloc memory for usb buffers\n");
@@ -1177,7 +1177,7 @@ int cx231xx_init_bulk(struct cx231xx *dev, int max_packets,
        }
 
        dev->video_mode.bulk_ctl.transfer_buffer =
-           kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
+           kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
        if (!dev->video_mode.bulk_ctl.transfer_buffer) {
                dev_err(dev->dev,
                        "cannot allocate memory for usbtransfer\n");
index d3bfe8e23b1ffdf656e7a9a582f591a5e458d63e..b621cf1aa96b9606ad933b9cc31ca2ca95567789 100644 (file)
@@ -415,7 +415,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
        for (i = 0; i < 8; i++)
                dma_q->partial_buf[i] = 0;
 
-       dev->vbi_mode.bulk_ctl.urb = kzalloc(sizeof(void *) * num_bufs,
+       dev->vbi_mode.bulk_ctl.urb = kcalloc(num_bufs, sizeof(void *),
                                             GFP_KERNEL);
        if (!dev->vbi_mode.bulk_ctl.urb) {
                dev_err(dev->dev,
@@ -424,7 +424,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
        }
 
        dev->vbi_mode.bulk_ctl.transfer_buffer =
-           kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL);
+           kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
        if (!dev->vbi_mode.bulk_ctl.transfer_buffer) {
                dev_err(dev->dev,
                        "cannot allocate memory for usbtransfer\n");
index 87b4fc48ef09ada7881dd39b1047fc52231f6ec0..24f5b615dc7af78d65b3b41e94bec96633d93145 100644 (file)
@@ -1579,7 +1579,7 @@ int go7007_construct_fw_image(struct go7007 *go, u8 **fw, int *fwlen)
                        GO7007_FW_NAME);
                return -1;
        }
-       code = kzalloc(codespace * 2, GFP_KERNEL);
+       code = kcalloc(codespace, 2, GFP_KERNEL);
        if (code == NULL)
                goto fw_failed;
 
index e0353161ccd6ce9743adcf34f5cb6ecaabeacc2e..a8519da0020bf82e9e15cfd5295cd9b6c02b5405 100644 (file)
@@ -2413,7 +2413,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
 
        hdw->control_cnt = CTRLDEF_COUNT;
        hdw->control_cnt += MPEGDEF_COUNT;
-       hdw->controls = kzalloc(sizeof(struct pvr2_ctrl) * hdw->control_cnt,
+       hdw->controls = kcalloc(hdw->control_cnt, sizeof(struct pvr2_ctrl),
                                GFP_KERNEL);
        if (!hdw->controls) goto fail;
        hdw->hdw_desc = hdw_desc;
index 21bb20dba82c8df5fbc3ccd42c905c220de602eb..6b651f8b54df0f7a713d34959b08c7bcac0cec39 100644 (file)
@@ -361,7 +361,7 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr,
                   std_cnt);
        if (!std_cnt) return NULL; // paranoia
 
-       stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt,
+       stddefs = kcalloc(std_cnt, sizeof(struct v4l2_standard),
                          GFP_KERNEL);
        if (!stddefs)
                return NULL;
index 423c03a0638dfbc6bbd69b567b8ebded117cf89d..2811f612820fc1b2c1f6db64fa744daf165f2083 100644 (file)
@@ -439,14 +439,14 @@ int stk1160_alloc_isoc(struct stk1160 *dev)
 
        dev->isoc_ctl.buf = NULL;
        dev->isoc_ctl.max_pkt_size = dev->max_pkt_size;
-       dev->isoc_ctl.urb = kzalloc(sizeof(void *)*num_bufs, GFP_KERNEL);
+       dev->isoc_ctl.urb = kcalloc(num_bufs, sizeof(void *), GFP_KERNEL);
        if (!dev->isoc_ctl.urb) {
                stk1160_err("out of memory for urb array\n");
                return -ENOMEM;
        }
 
-       dev->isoc_ctl.transfer_buffer = kzalloc(sizeof(void *)*num_bufs,
-                                             GFP_KERNEL);
+       dev->isoc_ctl.transfer_buffer = kcalloc(num_bufs, sizeof(void *),
+                                               GFP_KERNEL);
        if (!dev->isoc_ctl.transfer_buffer) {
                stk1160_err("out of memory for usb transfers\n");
                kfree(dev->isoc_ctl.urb);
index 22389b56ec24664e2df6e3ed412348941f4035c5..5accb52410720196b24181e18ee0620e68dbc223 100644 (file)
@@ -567,8 +567,9 @@ static int stk_prepare_sio_buffers(struct stk_camera *dev, unsigned n_sbufs)
        if (dev->sio_bufs != NULL)
                pr_err("sio_bufs already allocated\n");
        else {
-               dev->sio_bufs = kzalloc(n_sbufs * sizeof(struct stk_sio_buffer),
-                               GFP_KERNEL);
+               dev->sio_bufs = kcalloc(n_sbufs,
+                                       sizeof(struct stk_sio_buffer),
+                                       GFP_KERNEL);
                if (dev->sio_bufs == NULL)
                        return -ENOMEM;
                for (i = 0; i < n_sbufs; i++) {
index ce79df643c7e01e881e7a90bda6faa26df040cfc..36a9a401718574fc7c8809934e035cc30b4eb546 100644 (file)
@@ -507,7 +507,7 @@ static struct urb *usbtv_setup_iso_transfer(struct usbtv *usbtv)
        ip->pipe = usb_rcvisocpipe(usbtv->udev, USBTV_VIDEO_ENDP);
        ip->interval = 1;
        ip->transfer_flags = URB_ISO_ASAP;
-       ip->transfer_buffer = kzalloc(size * USBTV_ISOC_PACKETS,
+       ip->transfer_buffer = kcalloc(USBTV_ISOC_PACKETS, size,
                                                GFP_KERNEL);
        if (!ip->transfer_buffer) {
                usb_free_urb(ip);
index 4199cdd4ff89e9b82782bb78bfb4e6b08825a1f8..306e1fd109bdd8d3724e4ff2070d7c457aef20bb 100644 (file)
@@ -299,13 +299,14 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec)
        resp = (struct ec_response_motion_sense *)msg->data;
        sensor_num = resp->dump.sensor_count;
        /* Allocate 1 extra sensors in FIFO are needed */
-       sensor_cells = kzalloc(sizeof(struct mfd_cell) * (sensor_num + 1),
+       sensor_cells = kcalloc(sensor_num + 1, sizeof(struct mfd_cell),
                               GFP_KERNEL);
        if (sensor_cells == NULL)
                goto error;
 
-       sensor_platforms = kzalloc(sizeof(struct cros_ec_sensor_platform) *
-                 (sensor_num + 1), GFP_KERNEL);
+       sensor_platforms = kcalloc(sensor_num + 1,
+                                  sizeof(struct cros_ec_sensor_platform),
+                                  GFP_KERNEL);
        if (sensor_platforms == NULL)
                goto error_platforms;
 
index c57e407020f11dd19aff3a9dd4b9ba7ce9c7b351..94e3f32ce935717e97f2e938b433f3673c38f22d 100644 (file)
@@ -158,7 +158,7 @@ static int mfd_add_device(struct device *parent, int id,
        if (!pdev)
                goto fail_alloc;
 
-       res = kzalloc(sizeof(*res) * cell->num_resources, GFP_KERNEL);
+       res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL);
        if (!res)
                goto fail_device;
 
index 7c13d2e7061c4e5bd13ae655df0396652bfe7ea1..05ecf828b2ab241331a926186747a2c1005567b0 100644 (file)
@@ -707,8 +707,8 @@ static int timb_probe(struct pci_dev *dev,
                goto err_config;
        }
 
-       msix_entries = kzalloc(TIMBERDALE_NR_IRQS * sizeof(*msix_entries),
-               GFP_KERNEL);
+       msix_entries = kcalloc(TIMBERDALE_NR_IRQS, sizeof(*msix_entries),
+                              GFP_KERNEL);
        if (!msix_entries)
                goto err_config;
 
index f53e217e963f57acdc6d707d9893da7729c5bad0..ef83a9078646fb5177f2a1da4b28eb03fdae4327 100644 (file)
@@ -304,13 +304,13 @@ static int altera_execute(struct altera_state *astate,
        if (sym_count <= 0)
                goto exit_done;
 
-       vars = kzalloc(sym_count * sizeof(long), GFP_KERNEL);
+       vars = kcalloc(sym_count, sizeof(long), GFP_KERNEL);
 
        if (vars == NULL)
                status = -ENOMEM;
 
        if (status == 0) {
-               var_size = kzalloc(sym_count * sizeof(s32), GFP_KERNEL);
+               var_size = kcalloc(sym_count, sizeof(s32), GFP_KERNEL);
 
                if (var_size == NULL)
                        status = -ENOMEM;
@@ -1136,7 +1136,7 @@ exit_done:
                                /* Allocate a writable buffer for this array */
                                count = var_size[variable_id];
                                long_tmp = vars[variable_id];
-                               longptr_tmp = kzalloc(count * sizeof(long),
+                               longptr_tmp = kcalloc(count, sizeof(long),
                                                                GFP_KERNEL);
                                vars[variable_id] = (long)longptr_tmp;
 
index f58b4b6c79f22b42e9ab3fefd23c3eca3a7b07df..4644f16606a3bf7c6ce735cb3a587a073299ea15 100644 (file)
@@ -89,7 +89,7 @@ static ssize_t guest_collect_vpd(struct cxl *adapter, struct cxl_afu *afu,
                mod = 0;
        }
 
-       vpd_buf = kzalloc(entries * sizeof(unsigned long *), GFP_KERNEL);
+       vpd_buf = kcalloc(entries, sizeof(unsigned long *), GFP_KERNEL);
        if (!vpd_buf)
                return -ENOMEM;
 
index ec175ea5dfba1d6b16add78ba27f7116c08c7f30..aff181cd0bf26c7c0644aeeab2cde59664002387 100644 (file)
@@ -302,7 +302,7 @@ static int read_adapter_irq_config(struct cxl *adapter, struct device_node *np)
        if (nranges == 0 || (nranges * 2 * sizeof(int)) != len)
                return -EINVAL;
 
-       adapter->guest->irq_avail = kzalloc(nranges * sizeof(struct irq_avail),
+       adapter->guest->irq_avail = kcalloc(nranges, sizeof(struct irq_avail),
                                            GFP_KERNEL);
        if (adapter->guest->irq_avail == NULL)
                return -ENOMEM;
index b7f8d35c17a93e5b4245f49c63e53d98aac6ea06..656449cb4476beb1acae3783c4cde265657ae8b1 100644 (file)
@@ -1048,15 +1048,16 @@ static int setup_ddcb_queue(struct genwqe_dev *cd, struct ddcb_queue *queue)
                        "[%s] **err: could not allocate DDCB **\n", __func__);
                return -ENOMEM;
        }
-       queue->ddcb_req = kzalloc(sizeof(struct ddcb_requ *) *
-                                 queue->ddcb_max, GFP_KERNEL);
+       queue->ddcb_req = kcalloc(queue->ddcb_max, sizeof(struct ddcb_requ *),
+                                 GFP_KERNEL);
        if (!queue->ddcb_req) {
                rc = -ENOMEM;
                goto free_ddcbs;
        }
 
-       queue->ddcb_waitqs = kzalloc(sizeof(wait_queue_head_t) *
-                                    queue->ddcb_max, GFP_KERNEL);
+       queue->ddcb_waitqs = kcalloc(queue->ddcb_max,
+                                    sizeof(wait_queue_head_t),
+                                    GFP_KERNEL);
        if (!queue->ddcb_waitqs) {
                rc = -ENOMEM;
                goto free_requs;
index 0c775d6fcf590d1b1691926d144237ff02c960e1..83fc748a91a70d7e71f9f315a703d31ef49d47ea 100644 (file)
@@ -416,7 +416,8 @@ xpc_setup_ch_structures(struct xpc_partition *part)
         * memory.
         */
        DBUG_ON(part->channels != NULL);
-       part->channels = kzalloc(sizeof(struct xpc_channel) * XPC_MAX_NCHANNELS,
+       part->channels = kcalloc(XPC_MAX_NCHANNELS,
+                                sizeof(struct xpc_channel),
                                 GFP_KERNEL);
        if (part->channels == NULL) {
                dev_err(xpc_chan, "can't get memory for channels\n");
@@ -905,8 +906,9 @@ xpc_setup_partitions(void)
        short partid;
        struct xpc_partition *part;
 
-       xpc_partitions = kzalloc(sizeof(struct xpc_partition) *
-                                xp_max_npartitions, GFP_KERNEL);
+       xpc_partitions = kcalloc(xp_max_npartitions,
+                                sizeof(struct xpc_partition),
+                                GFP_KERNEL);
        if (xpc_partitions == NULL) {
                dev_err(xpc_part, "can't get memory for partition structure\n");
                return -ENOMEM;
index 6956f7e7d43921ec80f5e450a471429bc21f55fc..7284413dabfd54af9c4fe3a5cb89ec00380b3918 100644 (file)
@@ -425,7 +425,7 @@ xpc_discovery(void)
        if (remote_rp == NULL)
                return;
 
-       discovered_nasids = kzalloc(sizeof(long) * xpc_nasid_mask_nlongs,
+       discovered_nasids = kcalloc(xpc_nasid_mask_nlongs, sizeof(long),
                                    GFP_KERNEL);
        if (discovered_nasids == NULL) {
                kfree(remote_rp_base);
index 216d5c756236cd43f42c2abc8b731f976f2f6b92..44d750d98bc8ca4e7b67ace83785c4006d95816e 100644 (file)
@@ -520,8 +520,9 @@ xpnet_init(void)
 
        dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME);
 
-       xpnet_broadcast_partitions = kzalloc(BITS_TO_LONGS(xp_max_npartitions) *
-                                            sizeof(long), GFP_KERNEL);
+       xpnet_broadcast_partitions = kcalloc(BITS_TO_LONGS(xp_max_npartitions),
+                                            sizeof(long),
+                                            GFP_KERNEL);
        if (xpnet_broadcast_partitions == NULL)
                return -ENOMEM;
 
index fc0415771c0087264436d1ba434eccae8ef78dff..e2e31b65bc5ab0256c9deab9498cbebd53981df2 100644 (file)
@@ -185,7 +185,7 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
         * after the reserved blocks from the dt are processed.
         */
        nblocks = (np) ? of_get_available_child_count(np) + 1 : 1;
-       rblocks = kzalloc((nblocks) * sizeof(*rblocks), GFP_KERNEL);
+       rblocks = kcalloc(nblocks, sizeof(*rblocks), GFP_KERNEL);
        if (!rblocks)
                return -ENOMEM;
 
index 90575deff0ae5d3c699ba65558c69650cc1d652a..fc15ec58230a0d8fdfa6a0ad8d34206ee2c95ec3 100644 (file)
@@ -55,7 +55,7 @@ static int create_mtd_partitions(struct mtd_info *master,
        int retries = 10;
        struct mtd_partition *ar7_parts;
 
-       ar7_parts = kzalloc(sizeof(*ar7_parts) * AR7_PARTS, GFP_KERNEL);
+       ar7_parts = kcalloc(AR7_PARTS, sizeof(*ar7_parts), GFP_KERNEL);
        if (!ar7_parts)
                return -ENOMEM;
        ar7_parts[0].name = "loader";
index 0f93d223935295c760506acc895f6a77ab7865b8..fc424b185b083de74fe354b27775137e51094e45 100644 (file)
@@ -110,7 +110,7 @@ static int bcm47xxpart_parse(struct mtd_info *master,
                blocksize = 0x1000;
 
        /* Alloc */
-       parts = kzalloc(sizeof(struct mtd_partition) * BCM47XXPART_MAX_PARTS,
+       parts = kcalloc(BCM47XXPART_MAX_PARTS, sizeof(struct mtd_partition),
                        GFP_KERNEL);
        if (!parts)
                return -ENOMEM;
index 5a81bd8073bcf553002e4f748511a829e65961a1..6e8e7b1bb34b65a4196c7979aa8d1ca10a9f2f07 100644 (file)
@@ -608,8 +608,9 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
        mtd->size = devsize * cfi->numchips;
 
        mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
-       mtd->eraseregions = kzalloc(sizeof(struct mtd_erase_region_info)
-                       * mtd->numeraseregions, GFP_KERNEL);
+       mtd->eraseregions = kcalloc(mtd->numeraseregions,
+                                   sizeof(struct mtd_erase_region_info),
+                                   GFP_KERNEL);
        if (!mtd->eraseregions)
                goto setup_err;
 
index 22506d22194e17404171b6aebd0d123e4649cfff..a0c655628d6d5283fd9b5cd8234b8b09857d9c75 100644 (file)
@@ -2636,7 +2636,7 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
         * first check the locking status of all sectors and save
         * it for future use.
         */
-       sect = kzalloc(MAX_SECTORS * sizeof(struct ppb_lock), GFP_KERNEL);
+       sect = kcalloc(MAX_SECTORS, sizeof(struct ppb_lock), GFP_KERNEL);
        if (!sect)
                return -ENOMEM;
 
index 802d8f159e9020e325c0d61026243a0a8d634e0c..a0d485f52cbe563aaa323f55ff732bee0fca8576 100644 (file)
@@ -1827,7 +1827,7 @@ doc_probe_device(struct docg3_cascade *cascade, int floor, struct device *dev)
        mtd->dev.parent = dev;
        bbt_nbpages = DIV_ROUND_UP(docg3->max_block + 1,
                                   8 * DOC_LAYOUT_PAGE_SIZE);
-       docg3->bbt = kzalloc(bbt_nbpages * DOC_LAYOUT_PAGE_SIZE, GFP_KERNEL);
+       docg3->bbt = kcalloc(DOC_LAYOUT_PAGE_SIZE, bbt_nbpages, GFP_KERNEL);
        if (!docg3->bbt)
                goto nomem3;
 
index 527b1682381f4ed68714f8a2f5694884f3332acc..4129535b8e46f34e8891c3d86f0c6fb5160f6095 100644 (file)
@@ -124,7 +124,7 @@ static const char * const *of_get_probes(struct device_node *dp)
        if (count < 0)
                return part_probe_types_def;
 
-       res = kzalloc((count + 1) * sizeof(*res), GFP_KERNEL);
+       res = kcalloc(count + 1, sizeof(*res), GFP_KERNEL);
        if (!res)
                return NULL;
 
@@ -197,7 +197,7 @@ static int of_flash_probe(struct platform_device *dev)
 
        dev_set_drvdata(&dev->dev, info);
 
-       mtd_list = kzalloc(sizeof(*mtd_list) * count, GFP_KERNEL);
+       mtd_list = kcalloc(count, sizeof(*mtd_list), GFP_KERNEL);
        if (!mtd_list)
                goto err_flash_remove;
 
index b7105192cb12cb475970314ed6b375ab6e5cc4c0..4ca4b194e7d724411de9ad2fbc43fbb7a338cb39 100644 (file)
@@ -3721,8 +3721,10 @@ static int onenand_probe(struct mtd_info *mtd)
                this->dies = ONENAND_IS_DDP(this) ? 2 : 1;
                /* Maximum possible erase regions */
                mtd->numeraseregions = this->dies << 1;
-               mtd->eraseregions = kzalloc(sizeof(struct mtd_erase_region_info)
-                                       * (this->dies << 1), GFP_KERNEL);
+               mtd->eraseregions =
+                       kcalloc(this->dies << 1,
+                               sizeof(struct mtd_erase_region_info),
+                               GFP_KERNEL);
                if (!mtd->eraseregions)
                        return -ENOMEM;
        }
index 615f8c173162cb2a7e48301f365fbbfc667db81c..6b21a92d3622a10da833b6357b58d9e5b0c2e668 100644 (file)
@@ -71,7 +71,7 @@ static int parse_fixed_partitions(struct mtd_info *master,
        if (nr_parts == 0)
                return 0;
 
-       parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL);
+       parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
        if (!parts)
                return -ENOMEM;
 
@@ -177,7 +177,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
 
        nr_parts = plen / sizeof(part[0]);
 
-       parts = kzalloc(nr_parts * sizeof(*parts), GFP_KERNEL);
+       parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
        if (!parts)
                return -ENOMEM;
 
index df360a75e1eb1ac20d258465dab88cd51a8571d4..17ac33599783d0c943a902fe7e69d3a94f2444e1 100644 (file)
@@ -62,7 +62,7 @@ static int parser_trx_parse(struct mtd_info *mtd,
        uint8_t curr_part = 0, i = 0;
        int err;
 
-       parts = kzalloc(sizeof(struct mtd_partition) * TRX_PARSER_MAX_PARTS,
+       parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition),
                        GFP_KERNEL);
        if (!parts)
                return -ENOMEM;
index 8893dc82a5c85b2d0711c58b65faf98a301e334a..e5ea6127ab5a58f6ebfea5ad2278a67bd068977c 100644 (file)
@@ -362,8 +362,9 @@ static int sharpsl_parse_mtd_partitions(struct mtd_info *master,
                return err;
        }
 
-       sharpsl_nand_parts = kzalloc(sizeof(*sharpsl_nand_parts) *
-                                    SHARPSL_NAND_PARTS, GFP_KERNEL);
+       sharpsl_nand_parts = kcalloc(SHARPSL_NAND_PARTS,
+                                    sizeof(*sharpsl_nand_parts),
+                                    GFP_KERNEL);
        if (!sharpsl_nand_parts)
                return -ENOMEM;
 
index 9d019ce1589eee317c95b351ed588f294da4d817..f3bd86e136033d80e791fc996f0d9516d5e54d48 100644 (file)
@@ -82,7 +82,7 @@ static struct attribute_group *sm_create_sysfs_attributes(struct sm_ftl *ftl)
 
 
        /* Create array of pointers to the attributes */
-       attributes = kzalloc(sizeof(struct attribute *) * (NUM_ATTRIBUTES + 1),
+       attributes = kcalloc(NUM_ATTRIBUTES + 1, sizeof(struct attribute *),
                                                                GFP_KERNEL);
        if (!attributes)
                goto error3;
@@ -1137,7 +1137,7 @@ static void sm_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
                goto error2;
 
        /* Allocate zone array, it will be initialized on demand */
-       ftl->zones = kzalloc(sizeof(struct ftl_zone) * ftl->zone_count,
+       ftl->zones = kcalloc(ftl->zone_count, sizeof(struct ftl_zone),
                                                                GFP_KERNEL);
        if (!ftl->zones)
                goto error3;
index bc303cac9f437e557a71f71d716f90f49d496c48..75687369bc20c9112e5579bb89366b37ed50e76b 100644 (file)
@@ -127,7 +127,7 @@ static int crosstest(void)
        unsigned char *pp1, *pp2, *pp3, *pp4;
 
        pr_info("crosstest\n");
-       pp1 = kzalloc(pgsize * 4, GFP_KERNEL);
+       pp1 = kcalloc(pgsize, 4, GFP_KERNEL);
        if (!pp1)
                return -ENOMEM;
        pp2 = pp1 + pgsize;
index f66b3b22f32870ca1e70d9097d89c77af7cc6a33..6f2ac865ff05e78391a59725a86a2643a0019a23 100644 (file)
@@ -1592,7 +1592,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
        sprintf(ubi->bgt_name, UBI_BGT_NAME_PATTERN, ubi->ubi_num);
 
        err = -ENOMEM;
-       ubi->lookuptbl = kzalloc(ubi->peb_count * sizeof(void *), GFP_KERNEL);
+       ubi->lookuptbl = kcalloc(ubi->peb_count, sizeof(void *), GFP_KERNEL);
        if (!ubi->lookuptbl)
                return err;
 
index bd53a71f6b000802f352d42a586466cb498c91b2..63e3844c5becf5e973e10fa2aa533f668ac8e30b 100644 (file)
@@ -2418,7 +2418,7 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev,
        struct list_head  *iter;
 
        if (start_dev == end_dev) {
-               tags = kzalloc(sizeof(*tags) * (level + 1), GFP_ATOMIC);
+               tags = kcalloc(level + 1, sizeof(*tags), GFP_ATOMIC);
                if (!tags)
                        return ERR_PTR(-ENOMEM);
                tags[level].vlan_proto = VLAN_N_VID;
index 2d3046afa80dc87b98037b4c97e9cc85933bde79..7eec1d9f86a0538f737df0bddce7bfd0b039e362 100644 (file)
@@ -1057,7 +1057,7 @@ static int grcan_open(struct net_device *dev)
                return err;
        }
 
-       priv->echo_skb = kzalloc(dma->tx.size * sizeof(*priv->echo_skb),
+       priv->echo_skb = kcalloc(dma->tx.size, sizeof(*priv->echo_skb),
                                 GFP_KERNEL);
        if (!priv->echo_skb) {
                err = -ENOMEM;
@@ -1066,7 +1066,7 @@ static int grcan_open(struct net_device *dev)
        priv->can.echo_skb_max = dma->tx.size;
        priv->can.echo_skb = priv->echo_skb;
 
-       priv->txdlc = kzalloc(dma->tx.size * sizeof(*priv->txdlc), GFP_KERNEL);
+       priv->txdlc = kcalloc(dma->tx.size, sizeof(*priv->txdlc), GFP_KERNEL);
        if (!priv->txdlc) {
                err = -ENOMEM;
                goto exit_free_echo_skb;
index 89d60d8e467c955b56e739b6075702c90b12b470..aa97dbc797b6be339e911a9c34d55778040fdad4 100644 (file)
@@ -703,7 +703,7 @@ static int __init slcan_init(void)
        pr_info("slcan: serial line CAN interface driver\n");
        pr_info("slcan: %d dynamic interface channels.\n", maxdev);
 
-       slcan_devs = kzalloc(sizeof(struct net_device *)*maxdev, GFP_KERNEL);
+       slcan_devs = kcalloc(maxdev, sizeof(struct net_device *), GFP_KERNEL);
        if (!slcan_devs)
                return -ENOMEM;
 
index 14a59e51db675cbac20854408aac30ff09397b25..897302adc38ec16869609cccf6ddc8ee9941a3c7 100644 (file)
@@ -2150,7 +2150,7 @@ static int bcm_enetsw_open(struct net_device *dev)
        priv->tx_desc_alloc_size = size;
        priv->tx_desc_cpu = p;
 
-       priv->tx_skb = kzalloc(sizeof(struct sk_buff *) * priv->tx_ring_size,
+       priv->tx_skb = kcalloc(priv->tx_ring_size, sizeof(struct sk_buff *),
                               GFP_KERNEL);
        if (!priv->tx_skb) {
                dev_err(kdev, "cannot allocate rx skb queue\n");
@@ -2164,7 +2164,7 @@ static int bcm_enetsw_open(struct net_device *dev)
        spin_lock_init(&priv->tx_lock);
 
        /* init & fill rx ring with skbs */
-       priv->rx_skb = kzalloc(sizeof(struct sk_buff *) * priv->rx_ring_size,
+       priv->rx_skb = kcalloc(priv->rx_ring_size, sizeof(struct sk_buff *),
                               GFP_KERNEL);
        if (!priv->rx_skb) {
                dev_err(kdev, "cannot allocate rx skb queue\n");
index ffa7959f6b31e3c3b691fadb7ae05ad3b1f2a270..dc77bfded8652d7d200a123838cf8e07b5201ff8 100644 (file)
@@ -571,7 +571,7 @@ int bnx2x_vf_mcast(struct bnx2x *bp, struct bnx2x_virtf *vf,
        else
                set_bit(RAMROD_COMP_WAIT, &mcast.ramrod_flags);
        if (mc_num) {
-               mc = kzalloc(mc_num * sizeof(struct bnx2x_mcast_list_elem),
+               mc = kcalloc(mc_num, sizeof(struct bnx2x_mcast_list_elem),
                             GFP_KERNEL);
                if (!mc) {
                        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,
           num_vfs_param, iov->nr_virtfn);
 
        /* allocate the vf array */
-       bp->vfdb->vfs = kzalloc(sizeof(struct bnx2x_virtf) *
-                               BNX2X_NR_VIRTFN(bp), GFP_KERNEL);
+       bp->vfdb->vfs = kcalloc(BNX2X_NR_VIRTFN(bp),
+                               sizeof(struct bnx2x_virtf),
+                               GFP_KERNEL);
        if (!bp->vfdb->vfs) {
                BNX2X_ERR("failed to allocate vf array\n");
                err = -ENOMEM;
@@ -1278,9 +1279,9 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
        }
 
        /* allocate the queue arrays for all VFs */
-       bp->vfdb->vfqs = kzalloc(
-               BNX2X_MAX_NUM_VF_QUEUES * sizeof(struct bnx2x_vf_queue),
-               GFP_KERNEL);
+       bp->vfdb->vfqs = kcalloc(BNX2X_MAX_NUM_VF_QUEUES,
+                                sizeof(struct bnx2x_vf_queue),
+                                GFP_KERNEL);
 
        if (!bp->vfdb->vfqs) {
                BNX2X_ERR("failed to allocate vf queue array\n");
index 8bc126a156e80a1d18366a4b6cc3bd8cd2764954..30273a7717e2df797890da57e229ce31e9d957e2 100644 (file)
@@ -660,7 +660,7 @@ static int cnic_init_id_tbl(struct cnic_id_tbl *id_tbl, u32 size, u32 start_id,
        id_tbl->max = size;
        id_tbl->next = next;
        spin_lock_init(&id_tbl->lock);
-       id_tbl->table = kzalloc(DIV_ROUND_UP(size, 32) * 4, GFP_KERNEL);
+       id_tbl->table = kcalloc(DIV_ROUND_UP(size, 32), 4, GFP_KERNEL);
        if (!id_tbl->table)
                return -ENOMEM;
 
@@ -1255,13 +1255,13 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
                        cp->fcoe_init_cid = 0x10;
        }
 
-       cp->iscsi_tbl = kzalloc(sizeof(struct cnic_iscsi) * MAX_ISCSI_TBL_SZ,
+       cp->iscsi_tbl = kcalloc(MAX_ISCSI_TBL_SZ, sizeof(struct cnic_iscsi),
                                GFP_KERNEL);
        if (!cp->iscsi_tbl)
                goto error;
 
-       cp->ctx_tbl = kzalloc(sizeof(struct cnic_context) *
-                               cp->max_cid_space, GFP_KERNEL);
+       cp->ctx_tbl = kcalloc(cp->max_cid_space, sizeof(struct cnic_context),
+                             GFP_KERNEL);
        if (!cp->ctx_tbl)
                goto error;
 
@@ -4100,7 +4100,7 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
        struct cnic_local *cp = dev->cnic_priv;
        u32 port_id;
 
-       cp->csk_tbl = kzalloc(sizeof(struct cnic_sock) * MAX_CM_SK_TBL_SZ,
+       cp->csk_tbl = kcalloc(MAX_CM_SK_TBL_SZ, sizeof(struct cnic_sock),
                              GFP_KERNEL);
        if (!cp->csk_tbl)
                return -ENOMEM;
index 9f59b1270a7c68da3086d22db2930d041cbaaec8..3be87efdc93d6347da8417ddcd101ed90cc12d8c 100644 (file)
@@ -8631,8 +8631,9 @@ static int tg3_mem_tx_acquire(struct tg3 *tp)
                tnapi++;
 
        for (i = 0; i < tp->txq_cnt; i++, tnapi++) {
-               tnapi->tx_buffers = kzalloc(sizeof(struct tg3_tx_ring_info) *
-                                           TG3_TX_RING_SIZE, GFP_KERNEL);
+               tnapi->tx_buffers = kcalloc(TG3_TX_RING_SIZE,
+                                           sizeof(struct tg3_tx_ring_info),
+                                           GFP_KERNEL);
                if (!tnapi->tx_buffers)
                        goto err_out;
 
index 69cc3e0119d6a63073c7d2f4ef6e84c7503f30ac..ea5f32ea308a94b26d590ed838eae79fbf51897a 100644 (file)
@@ -3141,7 +3141,7 @@ bnad_set_rx_ucast_fltr(struct bnad *bnad)
        if (uc_count > bna_attr(&bnad->bna)->num_ucmac)
                goto mode_default;
 
-       mac_list = kzalloc(uc_count * ETH_ALEN, GFP_ATOMIC);
+       mac_list = kcalloc(ETH_ALEN, uc_count, GFP_ATOMIC);
        if (mac_list == NULL)
                goto mode_default;
 
@@ -3182,7 +3182,7 @@ bnad_set_rx_mcast_fltr(struct bnad *bnad)
        if (mc_count > bna_attr(&bnad->bna)->num_mcmac)
                goto mode_allmulti;
 
-       mac_list = kzalloc((mc_count + 1) * ETH_ALEN, GFP_ATOMIC);
+       mac_list = kcalloc(mc_count + 1, ETH_ALEN, GFP_ATOMIC);
 
        if (mac_list == NULL)
                goto mode_allmulti;
index 2bd7c638b178d5801bf2f3e4525e02734454ff6d..2c63afff138239aa51c0656c85fd712a759d7093 100644 (file)
@@ -739,7 +739,7 @@ static int xgmac_dma_desc_rings_init(struct net_device *dev)
 
        netdev_dbg(priv->dev, "mtu [%d] bfsize [%d]\n", dev->mtu, bfsize);
 
-       priv->rx_skbuff = kzalloc(sizeof(struct sk_buff *) * DMA_RX_RING_SZ,
+       priv->rx_skbuff = kcalloc(DMA_RX_RING_SZ, sizeof(struct sk_buff *),
                                  GFP_KERNEL);
        if (!priv->rx_skbuff)
                return -ENOMEM;
@@ -752,7 +752,7 @@ static int xgmac_dma_desc_rings_init(struct net_device *dev)
        if (!priv->dma_rx)
                goto err_dma_rx;
 
-       priv->tx_skbuff = kzalloc(sizeof(struct sk_buff *) * DMA_TX_RING_SZ,
+       priv->tx_skbuff = kcalloc(DMA_TX_RING_SZ, sizeof(struct sk_buff *),
                                  GFP_KERNEL);
        if (!priv->tx_skbuff)
                goto err_tx_skb;
index d42704d0748434d92eb17c74b0b0530aaa50f536..187a249ff2d1d2fd4201a4e74b9459cbeb3a4b52 100644 (file)
@@ -292,8 +292,8 @@ static int  nicvf_init_rbdr(struct nicvf *nic, struct rbdr *rbdr,
                rbdr->is_xdp = true;
        }
        rbdr->pgcnt = roundup_pow_of_two(rbdr->pgcnt);
-       rbdr->pgcache = kzalloc(sizeof(*rbdr->pgcache) *
-                               rbdr->pgcnt, GFP_KERNEL);
+       rbdr->pgcache = kcalloc(rbdr->pgcnt, sizeof(*rbdr->pgcache),
+                               GFP_KERNEL);
        if (!rbdr->pgcache)
                return -ENOMEM;
        rbdr->pgidx = 0;
index a95cde0fadf77345d808cf65f8d9e33ba095c24e..4bc211093c98e3564e628a7ccbdacbadbd1c040d 100644 (file)
@@ -561,13 +561,13 @@ int t4_uld_mem_alloc(struct adapter *adap)
        if (!adap->uld)
                return -ENOMEM;
 
-       s->uld_rxq_info = kzalloc(CXGB4_ULD_MAX *
+       s->uld_rxq_info = kcalloc(CXGB4_ULD_MAX,
                                  sizeof(struct sge_uld_rxq_info *),
                                  GFP_KERNEL);
        if (!s->uld_rxq_info)
                goto err_uld;
 
-       s->uld_txq_info = kzalloc(CXGB4_TX_MAX *
+       s->uld_txq_info = kcalloc(CXGB4_TX_MAX,
                                  sizeof(struct sge_uld_txq_info *),
                                  GFP_KERNEL);
        if (!s->uld_txq_info)
index ff9eb45f67f8962e7830bb84636862e8db7e8d1d..6d7404f66f84af7322c6b58def8cbff94958ca12 100644 (file)
@@ -910,8 +910,8 @@ static int geth_setup_freeq(struct gemini_ethernet *geth)
        }
 
        /* Allocate a mapping to page look-up index */
-       geth->freeq_pages = kzalloc(pages * sizeof(*geth->freeq_pages),
-                                  GFP_KERNEL);
+       geth->freeq_pages = kcalloc(pages, sizeof(*geth->freeq_pages),
+                                   GFP_KERNEL);
        if (!geth->freeq_pages)
                goto err_freeq;
        geth->num_freeq_pages = pages;
index 1ccb6443d2edb0531adf3f730ec5603158c91d98..ef9ef703d13a0e0efff11404afb41532f571283f 100644 (file)
@@ -2197,7 +2197,8 @@ static int hns_nic_init_ring_data(struct hns_nic_priv *priv)
                return -EINVAL;
        }
 
-       priv->ring_data = kzalloc(h->q_num * sizeof(*priv->ring_data) * 2,
+       priv->ring_data = kzalloc(array3_size(h->q_num,
+                                             sizeof(*priv->ring_data), 2),
                                  GFP_KERNEL);
        if (!priv->ring_data)
                return -ENOMEM;
index acf1e8b52b8e793d23b029c5985069e955e1177d..3ba0c90e7055b14a666566279fb7a58728da7427 100644 (file)
@@ -3312,7 +3312,7 @@ static int e1000e_write_mc_addr_list(struct net_device *netdev)
                return 0;
        }
 
-       mta_list = kzalloc(netdev_mc_count(netdev) * ETH_ALEN, GFP_ATOMIC);
+       mta_list = kcalloc(netdev_mc_count(netdev), ETH_ALEN, GFP_ATOMIC);
        if (!mta_list)
                return -ENOMEM;
 
index c33821d2afb3fee2f69294d3871631f267e19343..f707709969acfee137d30b698304dfd99f7c45e7 100644 (file)
@@ -3763,8 +3763,9 @@ static int igb_sw_init(struct igb_adapter *adapter)
        /* Assume MSI-X interrupts, will be checked during IRQ allocation */
        adapter->flags |= IGB_FLAG_HAS_MSIX;
 
-       adapter->mac_table = kzalloc(sizeof(struct igb_mac_addr) *
-                                    hw->mac.rar_entry_count, GFP_ATOMIC);
+       adapter->mac_table = kcalloc(hw->mac.rar_entry_count,
+                                    sizeof(struct igb_mac_addr),
+                                    GFP_ATOMIC);
        if (!adapter->mac_table)
                return -ENOMEM;
 
@@ -4752,7 +4753,7 @@ static int igb_write_mc_addr_list(struct net_device *netdev)
                return 0;
        }
 
-       mta_list = kzalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC);
+       mta_list = kcalloc(netdev_mc_count(netdev), 6, GFP_ATOMIC);
        if (!mta_list)
                return -ENOMEM;
 
index 4929f726559850622a54ae1281c530c0b2c5095e..0b1ba3ae159c765726e6b928d425ab8db64de622 100644 (file)
@@ -6034,8 +6034,8 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter,
        for (i = 1; i < IXGBE_MAX_LINK_HANDLE; i++)
                adapter->jump_tables[i] = NULL;
 
-       adapter->mac_table = kzalloc(sizeof(struct ixgbe_mac_addr) *
-                                    hw->mac.num_rar_entries,
+       adapter->mac_table = kcalloc(hw->mac.num_rar_entries,
+                                    sizeof(struct ixgbe_mac_addr),
                                     GFP_ATOMIC);
        if (!adapter->mac_table)
                return -ENOMEM;
index 8a165842fa8558123e611507cd39a00d9c534f86..06ff185eb1882ee6e6425baed1e35eca38d6bd2f 100644 (file)
@@ -589,8 +589,9 @@ jme_setup_tx_resources(struct jme_adapter *jme)
        atomic_set(&txring->next_to_clean, 0);
        atomic_set(&txring->nr_free, jme->tx_ring_size);
 
-       txring->bufinf          = kzalloc(sizeof(struct jme_buffer_info) *
-                                       jme->tx_ring_size, GFP_ATOMIC);
+       txring->bufinf          = kcalloc(jme->tx_ring_size,
+                                               sizeof(struct jme_buffer_info),
+                                               GFP_ATOMIC);
        if (unlikely(!(txring->bufinf)))
                goto err_free_txring;
 
@@ -838,8 +839,9 @@ jme_setup_rx_resources(struct jme_adapter *jme)
        rxring->next_to_use     = 0;
        atomic_set(&rxring->next_to_clean, 0);
 
-       rxring->bufinf          = kzalloc(sizeof(struct jme_buffer_info) *
-                                       jme->rx_ring_size, GFP_ATOMIC);
+       rxring->bufinf          = kcalloc(jme->rx_ring_size,
+                                               sizeof(struct jme_buffer_info),
+                                               GFP_ATOMIC);
        if (unlikely(!(rxring->bufinf)))
                goto err_free_rxring;
 
index 6dabd983e7e0fff578cda18e529a8510f13452c9..4bdf2505954271071007a748be8b901fee12fcef 100644 (file)
@@ -185,8 +185,8 @@ int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask,
        bitmap->avail = num - reserved_top - reserved_bot;
        bitmap->effective_len = bitmap->avail;
        spin_lock_init(&bitmap->lock);
-       bitmap->table = kzalloc(BITS_TO_LONGS(bitmap->max) *
-                               sizeof(long), GFP_KERNEL);
+       bitmap->table = kcalloc(BITS_TO_LONGS(bitmap->max), sizeof(long),
+                               GFP_KERNEL);
        if (!bitmap->table)
                return -ENOMEM;
 
index 03375c705df77b3d0c87f360f0cbd57831b9e7f3..e65bc3c95630a184309e3fad5ce77080d457b750 100644 (file)
@@ -2377,20 +2377,23 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
                struct mlx4_vf_admin_state *vf_admin;
 
                priv->mfunc.master.slave_state =
-                       kzalloc(dev->num_slaves *
-                               sizeof(struct mlx4_slave_state), GFP_KERNEL);
+                       kcalloc(dev->num_slaves,
+                               sizeof(struct mlx4_slave_state),
+                               GFP_KERNEL);
                if (!priv->mfunc.master.slave_state)
                        goto err_comm;
 
                priv->mfunc.master.vf_admin =
-                       kzalloc(dev->num_slaves *
-                               sizeof(struct mlx4_vf_admin_state), GFP_KERNEL);
+                       kcalloc(dev->num_slaves,
+                               sizeof(struct mlx4_vf_admin_state),
+                               GFP_KERNEL);
                if (!priv->mfunc.master.vf_admin)
                        goto err_comm_admin;
 
                priv->mfunc.master.vf_oper =
-                       kzalloc(dev->num_slaves *
-                               sizeof(struct mlx4_vf_oper_state), GFP_KERNEL);
+                       kcalloc(dev->num_slaves,
+                               sizeof(struct mlx4_vf_oper_state),
+                               GFP_KERNEL);
                if (!priv->mfunc.master.vf_oper)
                        goto err_comm_oper;
 
index 9670b33fc9b1ffd64a160bb1186af2f47419ab38..65eb06e017e401237842503bc3aabad3780c1a2e 100644 (file)
@@ -2229,13 +2229,15 @@ static int mlx4_en_copy_priv(struct mlx4_en_priv *dst,
                if (!dst->tx_ring_num[t])
                        continue;
 
-               dst->tx_ring[t] = kzalloc(sizeof(struct mlx4_en_tx_ring *) *
-                                         MAX_TX_RINGS, GFP_KERNEL);
+               dst->tx_ring[t] = kcalloc(MAX_TX_RINGS,
+                                         sizeof(struct mlx4_en_tx_ring *),
+                                         GFP_KERNEL);
                if (!dst->tx_ring[t])
                        goto err_free_tx;
 
-               dst->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) *
-                                       MAX_TX_RINGS, GFP_KERNEL);
+               dst->tx_cq[t] = kcalloc(MAX_TX_RINGS,
+                                       sizeof(struct mlx4_en_cq *),
+                                       GFP_KERNEL);
                if (!dst->tx_cq[t]) {
                        kfree(dst->tx_ring[t]);
                        goto err_free_tx;
@@ -3320,14 +3322,16 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
                if (!priv->tx_ring_num[t])
                        continue;
 
-               priv->tx_ring[t] = kzalloc(sizeof(struct mlx4_en_tx_ring *) *
-                                          MAX_TX_RINGS, GFP_KERNEL);
+               priv->tx_ring[t] = kcalloc(MAX_TX_RINGS,
+                                          sizeof(struct mlx4_en_tx_ring *),
+                                          GFP_KERNEL);
                if (!priv->tx_ring[t]) {
                        err = -ENOMEM;
                        goto out;
                }
-               priv->tx_cq[t] = kzalloc(sizeof(struct mlx4_en_cq *) *
-                                        MAX_TX_RINGS, GFP_KERNEL);
+               priv->tx_cq[t] = kcalloc(MAX_TX_RINGS,
+                                        sizeof(struct mlx4_en_cq *),
+                                        GFP_KERNEL);
                if (!priv->tx_cq[t]) {
                        err = -ENOMEM;
                        goto out;
index 0a30d81aab3ba3c94754a54e69e5051e2d562233..872014702fc1b0def72197f9e1b505849a5c72da 100644 (file)
@@ -2982,7 +2982,8 @@ static int mlx4_init_steering(struct mlx4_dev *dev)
        int num_entries = dev->caps.num_ports;
        int i, j;
 
-       priv->steer = kzalloc(sizeof(struct mlx4_steer) * num_entries, GFP_KERNEL);
+       priv->steer = kcalloc(num_entries, sizeof(struct mlx4_steer),
+                             GFP_KERNEL);
        if (!priv->steer)
                return -ENOMEM;
 
@@ -3103,7 +3104,7 @@ static u64 mlx4_enable_sriov(struct mlx4_dev *dev, struct pci_dev *pdev,
                }
        }
 
-       dev->dev_vfs = kzalloc(total_vfs * sizeof(*dev->dev_vfs), GFP_KERNEL);
+       dev->dev_vfs = kcalloc(total_vfs, sizeof(*dev->dev_vfs), GFP_KERNEL);
        if (NULL == dev->dev_vfs) {
                mlx4_err(dev, "Failed to allocate memory for VFs\n");
                goto disable_sriov;
index b0e11255a355fdda9059796e0df7a838cbf107d8..7b1b5ac986d0779db320ad986c13defa5db82949 100644 (file)
@@ -487,7 +487,7 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev)
        int max_vfs_guarantee_counter = get_max_gauranteed_vfs_counter(dev);
 
        priv->mfunc.master.res_tracker.slave_list =
-               kzalloc(dev->num_slaves * sizeof(struct slave_list),
+               kcalloc(dev->num_slaves, sizeof(struct slave_list),
                        GFP_KERNEL);
        if (!priv->mfunc.master.res_tracker.slave_list)
                return -ENOMEM;
@@ -514,14 +514,14 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev)
                                                      sizeof(int),
                                                      GFP_KERNEL);
                if (i == RES_MAC || i == RES_VLAN)
-                       res_alloc->allocated = kzalloc(MLX4_MAX_PORTS *
-                                                      (dev->persist->num_vfs
-                                                      + 1) *
-                                                      sizeof(int), GFP_KERNEL);
+                       res_alloc->allocated =
+                               kcalloc(MLX4_MAX_PORTS *
+                                               (dev->persist->num_vfs + 1),
+                                       sizeof(int), GFP_KERNEL);
                else
-                       res_alloc->allocated = kzalloc((dev->persist->
-                                                       num_vfs + 1) *
-                                                      sizeof(int), GFP_KERNEL);
+                       res_alloc->allocated =
+                               kcalloc(dev->persist->num_vfs + 1,
+                                       sizeof(int), GFP_KERNEL);
                /* Reduce the sink counter */
                if (i == RES_COUNTER)
                        res_alloc->res_free = dev->caps.max_counters - 1;
index a0433b48e8331d9eb2f892c172effc1313d0bd7c..5645a4facad2f3e5cc1a4a48553e6f83142e72dc 100644 (file)
@@ -381,7 +381,7 @@ int mlx5_fpga_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters,
 
        count = mlx5_fpga_ipsec_counters_count(mdev);
 
-       data = kzalloc(sizeof(*data) * count * 2, GFP_KERNEL);
+       data = kzalloc(array3_size(sizeof(*data), count, 2), GFP_KERNEL);
        if (!data) {
                ret = -ENOMEM;
                goto out;
index 857035583ccdd156c7913c001c1509e0cde044bb..1e062e6b2587eb7217fbeca7260844ee7c2b465a 100644 (file)
@@ -394,8 +394,9 @@ static int mlx5_init_pin_config(struct mlx5_clock *clock)
        int i;
 
        clock->ptp_info.pin_config =
-                       kzalloc(sizeof(*clock->ptp_info.pin_config) *
-                               clock->ptp_info.n_pins, GFP_KERNEL);
+                       kcalloc(clock->ptp_info.n_pins,
+                               sizeof(*clock->ptp_info.pin_config),
+                               GFP_KERNEL);
        if (!clock->ptp_info.pin_config)
                return -ENOMEM;
        clock->ptp_info.enable = mlx5_ptp_enable;
index 91262b0573e395c982bc97186f9b699a2cf0bbd0..cad603c35271bac2de3303713f9a1f181931f214 100644 (file)
@@ -740,7 +740,8 @@ int mlxsw_sp_tc_qdisc_init(struct mlxsw_sp_port *mlxsw_sp_port)
        mlxsw_sp_port->root_qdisc->prio_bitmap = 0xff;
        mlxsw_sp_port->root_qdisc->tclass_num = MLXSW_SP_PORT_DEFAULT_TCLASS;
 
-       mlxsw_sp_qdisc = kzalloc(sizeof(*mlxsw_sp_qdisc) * IEEE_8021QAZ_MAX_TCS,
+       mlxsw_sp_qdisc = kcalloc(IEEE_8021QAZ_MAX_TCS,
+                                sizeof(*mlxsw_sp_qdisc),
                                 GFP_KERNEL);
        if (!mlxsw_sp_qdisc)
                goto err_tclass_qdiscs_init;
index 52207508744cafbf8243533b35ab99d9e70567d0..b72d1bd11296bba36c83e1252fcfa0a397ee5c84 100644 (file)
@@ -4372,7 +4372,7 @@ static void ksz_update_timer(struct ksz_timer_info *info)
  */
 static int ksz_alloc_soft_desc(struct ksz_desc_info *desc_info, int transmit)
 {
-       desc_info->ring = kzalloc(sizeof(struct ksz_desc) * desc_info->alloc,
+       desc_info->ring = kcalloc(desc_info->alloc, sizeof(struct ksz_desc),
                                  GFP_KERNEL);
        if (!desc_info->ring)
                return 1;
index c60da9e8bf143ceadace9e08dc2033a359f47253..8d02956559336107d9c0be508d4e919247152310 100644 (file)
@@ -2220,22 +2220,22 @@ __vxge_hw_channel_allocate(struct __vxge_hw_vpath_handle *vph,
        channel->length = length;
        channel->vp_id = vp_id;
 
-       channel->work_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL);
+       channel->work_arr = kcalloc(length, sizeof(void *), GFP_KERNEL);
        if (channel->work_arr == NULL)
                goto exit1;
 
-       channel->free_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL);
+       channel->free_arr = kcalloc(length, sizeof(void *), GFP_KERNEL);
        if (channel->free_arr == NULL)
                goto exit1;
        channel->free_ptr = length;
 
-       channel->reserve_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL);
+       channel->reserve_arr = kcalloc(length, sizeof(void *), GFP_KERNEL);
        if (channel->reserve_arr == NULL)
                goto exit1;
        channel->reserve_ptr = length;
        channel->reserve_top = 0;
 
-       channel->orig_arr = kzalloc(sizeof(void *)*length, GFP_KERNEL);
+       channel->orig_arr = kcalloc(length, sizeof(void *), GFP_KERNEL);
        if (channel->orig_arr == NULL)
                goto exit1;
 
index a8918bb7c8020807924e0bcf2a9b8c90afc03aa3..5ae3fa82909f8eb8c64565f1e5ac330d70573bee 100644 (file)
@@ -3429,8 +3429,8 @@ static int vxge_device_register(struct __vxge_hw_device *hldev,
        vxge_initialize_ethtool_ops(ndev);
 
        /* Allocate memory for vpath */
-       vdev->vpaths = kzalloc((sizeof(struct vxge_vpath)) *
-                               no_of_vpath, GFP_KERNEL);
+       vdev->vpaths = kcalloc(no_of_vpath, sizeof(struct vxge_vpath),
+                              GFP_KERNEL);
        if (!vdev->vpaths) {
                vxge_debug_init(VXGE_ERR,
                        "%s: vpath memory allocation failed",
index 07a2eb3781b12a307b71849e38d8cbcb6edf1a1e..8a31a02c9f47f7ec9c328cbbacb8088b07c90ab8 100644 (file)
@@ -390,8 +390,9 @@ static int pasemi_mac_setup_rx_resources(const struct net_device *dev)
        spin_lock_init(&ring->lock);
 
        ring->size = RX_RING_SIZE;
-       ring->ring_info = kzalloc(sizeof(struct pasemi_mac_buffer) *
-                                 RX_RING_SIZE, GFP_KERNEL);
+       ring->ring_info = kcalloc(RX_RING_SIZE,
+                                 sizeof(struct pasemi_mac_buffer),
+                                 GFP_KERNEL);
 
        if (!ring->ring_info)
                goto out_ring_info;
@@ -473,8 +474,9 @@ pasemi_mac_setup_tx_resources(const struct net_device *dev)
        spin_lock_init(&ring->lock);
 
        ring->size = TX_RING_SIZE;
-       ring->ring_info = kzalloc(sizeof(struct pasemi_mac_buffer) *
-                                 TX_RING_SIZE, GFP_KERNEL);
+       ring->ring_info = kcalloc(TX_RING_SIZE,
+                                 sizeof(struct pasemi_mac_buffer),
+                                 GFP_KERNEL);
        if (!ring->ring_info)
                goto out_ring_info;
 
index b9ec460dd996efac5835854c1329c217be356833..a14e484890299565ee8fdac8851ed9d7f3e90437 100644 (file)
@@ -6617,7 +6617,8 @@ static enum dbg_status qed_mcp_trace_alloc_meta(struct qed_hwfn *p_hwfn,
 
        /* Read no. of modules and allocate memory for their pointers */
        meta->modules_num = qed_read_byte_from_buf(meta_buf_bytes, &offset);
-       meta->modules = kzalloc(meta->modules_num * sizeof(char *), GFP_KERNEL);
+       meta->modules = kcalloc(meta->modules_num, sizeof(char *),
+                               GFP_KERNEL);
        if (!meta->modules)
                return DBG_STATUS_VIRT_MEM_ALLOC_FAILED;
 
@@ -6645,7 +6646,7 @@ static enum dbg_status qed_mcp_trace_alloc_meta(struct qed_hwfn *p_hwfn,
 
        /* Read number of formats and allocate memory for all formats */
        meta->formats_num = qed_read_dword_from_buf(meta_buf_bytes, &offset);
-       meta->formats = kzalloc(meta->formats_num *
+       meta->formats = kcalloc(meta->formats_num,
                                sizeof(struct mcp_trace_format),
                                GFP_KERNEL);
        if (!meta->formats)
index b285edc8d6a10ae48e522b1619443934a84176dc..329781cda77fbecc88328ea95f00e39d4be5db9b 100644 (file)
@@ -814,26 +814,26 @@ static int qed_alloc_qm_data(struct qed_hwfn *p_hwfn)
        if (rc)
                goto alloc_err;
 
-       qm_info->qm_pq_params = kzalloc(sizeof(*qm_info->qm_pq_params) *
-                                       qed_init_qm_get_num_pqs(p_hwfn),
+       qm_info->qm_pq_params = kcalloc(qed_init_qm_get_num_pqs(p_hwfn),
+                                       sizeof(*qm_info->qm_pq_params),
                                        GFP_KERNEL);
        if (!qm_info->qm_pq_params)
                goto alloc_err;
 
-       qm_info->qm_vport_params = kzalloc(sizeof(*qm_info->qm_vport_params) *
-                                          qed_init_qm_get_num_vports(p_hwfn),
+       qm_info->qm_vport_params = kcalloc(qed_init_qm_get_num_vports(p_hwfn),
+                                          sizeof(*qm_info->qm_vport_params),
                                           GFP_KERNEL);
        if (!qm_info->qm_vport_params)
                goto alloc_err;
 
-       qm_info->qm_port_params = kzalloc(sizeof(*qm_info->qm_port_params) *
-                                         p_hwfn->cdev->num_ports_in_engine,
+       qm_info->qm_port_params = kcalloc(p_hwfn->cdev->num_ports_in_engine,
+                                         sizeof(*qm_info->qm_port_params),
                                          GFP_KERNEL);
        if (!qm_info->qm_port_params)
                goto alloc_err;
 
-       qm_info->wfq_data = kzalloc(sizeof(*qm_info->wfq_data) *
-                                   qed_init_qm_get_num_vports(p_hwfn),
+       qm_info->wfq_data = kcalloc(qed_init_qm_get_num_vports(p_hwfn),
+                                   sizeof(*qm_info->wfq_data),
                                    GFP_KERNEL);
        if (!qm_info->wfq_data)
                goto alloc_err;
index 3bb76da6baa27f0a548b9d15c37754cbef5444d8..d9ab5add27a8bf06af92247b60158e6de2e316be 100644 (file)
@@ -149,12 +149,12 @@ int qed_init_alloc(struct qed_hwfn *p_hwfn)
        if (IS_VF(p_hwfn->cdev))
                return 0;
 
-       rt_data->b_valid = kzalloc(sizeof(bool) * RUNTIME_ARRAY_SIZE,
+       rt_data->b_valid = kcalloc(RUNTIME_ARRAY_SIZE, sizeof(bool),
                                   GFP_KERNEL);
        if (!rt_data->b_valid)
                return -ENOMEM;
 
-       rt_data->init_val = kzalloc(sizeof(u32) * RUNTIME_ARRAY_SIZE,
+       rt_data->init_val = kcalloc(RUNTIME_ARRAY_SIZE, sizeof(u32),
                                    GFP_KERNEL);
        if (!rt_data->init_val) {
                kfree(rt_data->b_valid);
index 1f6ac848109dbab62121ca32d38ae3a453e29352..de1c70843efdb37ed1bb1aa9d6d494386cfe4f64 100644 (file)
@@ -98,7 +98,7 @@ int qed_l2_alloc(struct qed_hwfn *p_hwfn)
                p_l2_info->queues = max_t(u8, rx, tx);
        }
 
-       pp_qids = kzalloc(sizeof(unsigned long *) * p_l2_info->queues,
+       pp_qids = kcalloc(p_l2_info->queues, sizeof(unsigned long *),
                          GFP_KERNEL);
        if (!pp_qids)
                return -ENOMEM;
index 1b5f7d57b6f8fed6a8b232adfdee76b2cbaff13f..8c6724063231c47f826f8598b66b139eab1a1d67 100644 (file)
@@ -1025,15 +1025,17 @@ int qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
 
        act_pci_func = ahw->total_nic_func;
 
-       adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) *
-                                act_pci_func, GFP_KERNEL);
+       adapter->npars = kcalloc(act_pci_func,
+                                sizeof(struct qlcnic_npar_info),
+                                GFP_KERNEL);
        if (!adapter->npars) {
                ret = -ENOMEM;
                goto err_pci_info;
        }
 
-       adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
-                               QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
+       adapter->eswitch = kcalloc(QLCNIC_NIU_MAX_XG_PORTS,
+                                  sizeof(struct qlcnic_eswitch),
+                                  GFP_KERNEL);
        if (!adapter->eswitch) {
                ret = -ENOMEM;
                goto err_npars;
index c58180f408448e9a86a7ce40c6fb286063a6afb0..0c744b9c6e0adf96f91d6aba6c7cda34b208c7fe 100644 (file)
@@ -157,8 +157,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
        adapter->ahw->sriov = sriov;
        sriov->num_vfs = num_vfs;
        bc = &sriov->bc;
-       sriov->vf_info = kzalloc(sizeof(struct qlcnic_vf_info) *
-                                num_vfs, GFP_KERNEL);
+       sriov->vf_info = kcalloc(num_vfs, sizeof(struct qlcnic_vf_info),
+                                GFP_KERNEL);
        if (!sriov->vf_info) {
                err = -ENOMEM;
                goto qlcnic_free_sriov;
@@ -450,7 +450,7 @@ static int qlcnic_sriov_set_guest_vlan_mode(struct qlcnic_adapter *adapter,
                return 0;
 
        num_vlans = sriov->num_allowed_vlans;
-       sriov->allowed_vlans = kzalloc(sizeof(u16) * num_vlans, GFP_KERNEL);
+       sriov->allowed_vlans = kcalloc(num_vlans, sizeof(u16), GFP_KERNEL);
        if (!sriov->allowed_vlans)
                return -ENOMEM;
 
@@ -706,7 +706,7 @@ static inline int qlcnic_sriov_alloc_bc_trans(struct qlcnic_bc_trans **trans)
 static inline int qlcnic_sriov_alloc_bc_msg(struct qlcnic_bc_hdr **hdr,
                                            u32 size)
 {
-       *hdr = kzalloc(sizeof(struct qlcnic_bc_hdr) * size, GFP_ATOMIC);
+       *hdr = kcalloc(size, sizeof(struct qlcnic_bc_hdr), GFP_ATOMIC);
        if (!*hdr)
                return -ENOMEM;
 
index ce8071fc90c473162061643638f01c16378d7360..e080d3e7c582ff7df2a2fe0ecf6074ac4a306470 100644 (file)
@@ -973,7 +973,7 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id)
                goto err;
        }
 
-       dring->desc = kzalloc(DESC_NUM * sizeof(*dring->desc), GFP_KERNEL);
+       dring->desc = kcalloc(DESC_NUM, sizeof(*dring->desc), GFP_KERNEL);
        if (!dring->desc) {
                ret = -ENOMEM;
                goto err;
index eed18f88bdff7f6b253aa02ffaa05a2a859f84a7..302079e22b06c7c9992d2f7e2b01b817cccf5906 100644 (file)
@@ -2320,8 +2320,9 @@ static struct net_device *gelic_wl_alloc(struct gelic_card *card)
        pr_debug("%s: wl=%p port=%p\n", __func__, wl, port);
 
        /* allocate scan list */
-       wl->networks = kzalloc(sizeof(struct gelic_wl_scan_info) *
-                              GELIC_WL_BSS_MAX_ENT, GFP_KERNEL);
+       wl->networks = kcalloc(GELIC_WL_BSS_MAX_ENT,
+                              sizeof(struct gelic_wl_scan_info),
+                              GFP_KERNEL);
 
        if (!wl->networks)
                goto fail_bss;
index a6c87793d899f325b11768a0f7334ede655a7807..79e9b103188b4d7dc0f2a256bdf8ba885035cca9 100644 (file)
@@ -1097,8 +1097,9 @@ static struct dp83640_clock *dp83640_clock_get_bus(struct mii_bus *bus)
        if (!clock)
                goto out;
 
-       clock->caps.pin_config = kzalloc(sizeof(struct ptp_pin_desc) *
-                                        DP83640_N_PINS, GFP_KERNEL);
+       clock->caps.pin_config = kcalloc(DP83640_N_PINS,
+                                        sizeof(struct ptp_pin_desc),
+                                        GFP_KERNEL);
        if (!clock->caps.pin_config) {
                kfree(clock);
                clock = NULL;
index 8940417c30e547556d1f02c459ffad7b348ae6bf..b008266e91eab6cfc8fb8e009f1940ef97211e55 100644 (file)
@@ -1307,7 +1307,7 @@ static int __init slip_init(void)
        printk(KERN_INFO "SLIP linefill/keepalive option.\n");
 #endif
 
-       slip_devs = kzalloc(sizeof(struct net_device *)*slip_maxdev,
+       slip_devs = kcalloc(slip_maxdev, sizeof(struct net_device *),
                                                                GFP_KERNEL);
        if (!slip_devs)
                return -ENOMEM;
index ca0af0e15a2cc9f7d2b957340cf00d615c7f2440..b070959737ffe744f08683926a486c66ee08bb4a 100644 (file)
@@ -280,7 +280,7 @@ static int __team_options_register(struct team *team,
        struct team_option **dst_opts;
        int err;
 
-       dst_opts = kzalloc(sizeof(struct team_option *) * option_count,
+       dst_opts = kcalloc(option_count, sizeof(struct team_option *),
                           GFP_KERNEL);
        if (!dst_opts)
                return -ENOMEM;
index 309b88acd3d0b6ca1528dde7b27a23926f9be952..06b4d290784dad95f893b63da62d26e020fc060a 100644 (file)
@@ -1661,7 +1661,7 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message)
        }
 
        if (pdata->wolopts & (WAKE_BCAST | WAKE_MCAST | WAKE_ARP | WAKE_UCAST)) {
-               u32 *filter_mask = kzalloc(sizeof(u32) * 32, GFP_KERNEL);
+               u32 *filter_mask = kcalloc(32, sizeof(u32), GFP_KERNEL);
                u32 command[2];
                u32 offset[2];
                u32 crc[4];
index 15b9a83bbd9d29e84a076ac7d1030e71768b37d5..b6c9a2af37328d1037c3b0ba761256092556167e 100644 (file)
@@ -2552,7 +2552,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
                    virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ);
 
        /* Allocate space for find_vqs parameters */
-       vqs = kzalloc(total_vqs * sizeof(*vqs), GFP_KERNEL);
+       vqs = kcalloc(total_vqs, sizeof(*vqs), GFP_KERNEL);
        if (!vqs)
                goto err_vq;
        callbacks = kmalloc_array(total_vqs, sizeof(*callbacks), GFP_KERNEL);
@@ -2562,7 +2562,7 @@ static int virtnet_find_vqs(struct virtnet_info *vi)
        if (!names)
                goto err_names;
        if (!vi->big_packets || vi->mergeable_rx_bufs) {
-               ctx = kzalloc(total_vqs * sizeof(*ctx), GFP_KERNEL);
+               ctx = kcalloc(total_vqs, sizeof(*ctx), GFP_KERNEL);
                if (!ctx)
                        goto err_ctx;
        } else {
@@ -2626,10 +2626,10 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
        vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
        if (!vi->ctrl)
                goto err_ctrl;
-       vi->sq = kzalloc(sizeof(*vi->sq) * vi->max_queue_pairs, GFP_KERNEL);
+       vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL);
        if (!vi->sq)
                goto err_sq;
-       vi->rq = kzalloc(sizeof(*vi->rq) * vi->max_queue_pairs, GFP_KERNEL);
+       vi->rq = kcalloc(vi->max_queue_pairs, sizeof(*vi->rq), GFP_KERNEL);
        if (!vi->rq)
                goto err_rq;
 
index 4205dfd19da3b768cf13e0bd2dabfbf70142bcd9..9b09c9d0d0fb860d6788d751e967af538fc7e3f0 100644 (file)
@@ -198,12 +198,14 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
                goto free_tx_bd;
        }
 
-       priv->rx_skbuff = kzalloc(priv->rx_ring_size * sizeof(*priv->rx_skbuff),
+       priv->rx_skbuff = kcalloc(priv->rx_ring_size,
+                                 sizeof(*priv->rx_skbuff),
                                  GFP_KERNEL);
        if (!priv->rx_skbuff)
                goto free_ucc_pram;
 
-       priv->tx_skbuff = kzalloc(priv->tx_ring_size * sizeof(*priv->tx_skbuff),
+       priv->tx_skbuff = kcalloc(priv->tx_ring_size,
+                                 sizeof(*priv->tx_skbuff),
                                  GFP_KERNEL);
        if (!priv->tx_skbuff)
                goto free_rx_skbuff;
index bd23f6940488566b5962720572952543a0fde9ad..c72d8af122a28e19048c40f7072b4a9064d43e0b 100644 (file)
@@ -582,7 +582,7 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt)
        }
 
        htt->rx_ring.netbufs_ring =
-               kzalloc(htt->rx_ring.size * sizeof(struct sk_buff *),
+               kcalloc(htt->rx_ring.size, sizeof(struct sk_buff *),
                        GFP_KERNEL);
        if (!htt->rx_ring.netbufs_ring)
                goto err_netbuf;
index 2e34a1fc5ba684c5006da61a97657f11791f18d9..8c49a26fc57120bfa22acc0e435a2bf1b07004e8 100644 (file)
@@ -155,7 +155,7 @@ ath10k_wmi_tlv_parse_alloc(struct ath10k *ar, const void *ptr,
        const void **tb;
        int ret;
 
-       tb = kzalloc(sizeof(*tb) * WMI_TLV_TAG_MAX, gfp);
+       tb = kcalloc(WMI_TLV_TAG_MAX, sizeof(*tb), gfp);
        if (!tb)
                return ERR_PTR(-ENOMEM);
 
index 2ba8cf3f38afd4fa98c9038d43b8e4b838691114..0687697d5e2db5ed2e9c2567ae8189e85f9f711f 100644 (file)
@@ -1041,7 +1041,7 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy,
 
                n_channels = request->n_channels;
 
-               channels = kzalloc(n_channels * sizeof(u16), GFP_KERNEL);
+               channels = kcalloc(n_channels, sizeof(u16), GFP_KERNEL);
                if (channels == NULL) {
                        ath6kl_warn("failed to set scan channels, scan all channels");
                        n_channels = 0;
index 29e93c953d939b310a393f7cee3e380dd426904d..7f1bdea742b8ae88ab84508f502d2f49295f2187 100644 (file)
@@ -1958,7 +1958,7 @@ static int carl9170_parse_eeprom(struct ar9170 *ar)
        if (!bands)
                return -EINVAL;
 
-       ar->survey = kzalloc(sizeof(struct survey_info) * chans, GFP_KERNEL);
+       ar->survey = kcalloc(chans, sizeof(struct survey_info), GFP_KERNEL);
        if (!ar->survey)
                return -ENOMEM;
        ar->num_channels = chans;
@@ -1988,8 +1988,9 @@ int carl9170_register(struct ar9170 *ar)
        if (WARN_ON(ar->mem_bitmap))
                return -EINVAL;
 
-       ar->mem_bitmap = kzalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG) *
-                                sizeof(unsigned long), GFP_KERNEL);
+       ar->mem_bitmap = kcalloc(roundup(ar->fw.mem_blocks, BITS_PER_LONG),
+                                sizeof(unsigned long),
+                                GFP_KERNEL);
 
        if (!ar->mem_bitmap)
                return -ENOMEM;
index f2a2f41e3c96b2807a8f2d81d0ce157f68c7200a..44ab080d651823d0bd841c376f9103b1b67e12c7 100644 (file)
@@ -1518,7 +1518,7 @@ static int b43_nphy_load_samples(struct b43_wldev *dev,
        u16 i;
        u32 *data;
 
-       data = kzalloc(len * sizeof(u32), GFP_KERNEL);
+       data = kcalloc(len, sizeof(u32), GFP_KERNEL);
        if (!data) {
                b43err(dev->wl, "allocation for samples loading failed\n");
                return -ENOMEM;
index f1e3dad576292ef5b8e2f03a01a8c185c927a101..55f411925960e9cc954de38ae2a834a4ab140c60 100644 (file)
@@ -3300,8 +3300,8 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev)
 
        if ((phy->type == B43legacy_PHYTYPE_B) ||
            (phy->type == B43legacy_PHYTYPE_G)) {
-               phy->_lo_pairs = kzalloc(sizeof(struct b43legacy_lopair)
-                                        * B43legacy_LO_COUNT,
+               phy->_lo_pairs = kcalloc(B43legacy_LO_COUNT,
+                                        sizeof(struct b43legacy_lopair),
                                         GFP_KERNEL);
                if (!phy->_lo_pairs)
                        return -ENOMEM;
index 49d37ad969586e2471c61fefd6091e635d825192..c40ba8855cd53ee6ad058af2d71bcb6bdae3f114 100644 (file)
@@ -1486,8 +1486,9 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)
                (struct brcmf_commonring **)if_msgbuf->commonrings;
        msgbuf->flowrings = (struct brcmf_commonring **)if_msgbuf->flowrings;
        msgbuf->max_flowrings = if_msgbuf->max_flowrings;
-       msgbuf->flowring_dma_handle = kzalloc(msgbuf->max_flowrings *
-               sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL);
+       msgbuf->flowring_dma_handle =
+               kcalloc(msgbuf->max_flowrings,
+                       sizeof(*msgbuf->flowring_dma_handle), GFP_KERNEL);
        if (!msgbuf->flowring_dma_handle)
                goto fail;
 
index 4b2149b483626074816caaeeaf76be79a0741278..3e9c4f2f5dd12673e8c96e6dcacbea50cf7bc45e 100644 (file)
@@ -1058,7 +1058,7 @@ static s32 brcmf_p2p_act_frm_search(struct brcmf_p2p_info *p2p, u16 channel)
                channel_cnt = AF_PEER_SEARCH_CNT;
        else
                channel_cnt = SOCIAL_CHAN_CNT;
-       default_chan_list = kzalloc(channel_cnt * sizeof(*default_chan_list),
+       default_chan_list = kcalloc(channel_cnt, sizeof(*default_chan_list),
                                    GFP_KERNEL);
        if (default_chan_list == NULL) {
                brcmf_err("channel list allocation failed\n");
index 0a14942b821671ea9de11f30a4cba34a4fa50537..7d4e8f589fdc4e38328f710afb9c12a09e98dfc6 100644 (file)
@@ -507,7 +507,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid)
        wlc->hw->wlc = wlc;
 
        wlc->hw->bandstate[0] =
-               kzalloc(sizeof(struct brcms_hw_band) * MAXBANDS, GFP_ATOMIC);
+               kcalloc(MAXBANDS, sizeof(struct brcms_hw_band), GFP_ATOMIC);
        if (wlc->hw->bandstate[0] == NULL) {
                *err = 1006;
                goto fail;
@@ -521,7 +521,8 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid)
        }
 
        wlc->modulecb =
-               kzalloc(sizeof(struct modulecb) * BRCMS_MAXMODULES, GFP_ATOMIC);
+               kcalloc(BRCMS_MAXMODULES, sizeof(struct modulecb),
+                       GFP_ATOMIC);
        if (wlc->modulecb == NULL) {
                *err = 1009;
                goto fail;
@@ -553,7 +554,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid)
        }
 
        wlc->bandstate[0] =
-               kzalloc(sizeof(struct brcms_band)*MAXBANDS, GFP_ATOMIC);
+               kcalloc(MAXBANDS, sizeof(struct brcms_band), GFP_ATOMIC);
        if (wlc->bandstate[0] == NULL) {
                *err = 1025;
                goto fail;
index 063e19ced7c86ec40f05054690f9d16d3fdb4b4a..6514baf799fef58b98a56d468641e72f8cde0888 100644 (file)
@@ -922,7 +922,7 @@ il_init_channel_map(struct il_priv *il)
        D_EEPROM("Parsing data for %d channels.\n", il->channel_count);
 
        il->channel_info =
-           kzalloc(sizeof(struct il_channel_info) * il->channel_count,
+           kcalloc(il->channel_count, sizeof(struct il_channel_info),
                    GFP_KERNEL);
        if (!il->channel_info) {
                IL_ERR("Could not allocate channel_info\n");
@@ -3041,9 +3041,9 @@ il_tx_queue_init(struct il_priv *il, u32 txq_id)
        }
 
        txq->meta =
-           kzalloc(sizeof(struct il_cmd_meta) * actual_slots, GFP_KERNEL);
+           kcalloc(actual_slots, sizeof(struct il_cmd_meta), GFP_KERNEL);
        txq->cmd =
-           kzalloc(sizeof(struct il_device_cmd *) * actual_slots, GFP_KERNEL);
+           kcalloc(actual_slots, sizeof(struct il_device_cmd *), GFP_KERNEL);
 
        if (!txq->meta || !txq->cmd)
                goto out_free_arrays;
@@ -3455,7 +3455,7 @@ il_init_geos(struct il_priv *il)
        }
 
        channels =
-           kzalloc(sizeof(struct ieee80211_channel) * il->channel_count,
+           kcalloc(il->channel_count, sizeof(struct ieee80211_channel),
                    GFP_KERNEL);
        if (!channels)
                return -ENOMEM;
@@ -4654,8 +4654,9 @@ il_alloc_txq_mem(struct il_priv *il)
 {
        if (!il->txq)
                il->txq =
-                   kzalloc(sizeof(struct il_tx_queue) *
-                           il->cfg->num_of_queues, GFP_KERNEL);
+                   kcalloc(il->cfg->num_of_queues,
+                           sizeof(struct il_tx_queue),
+                           GFP_KERNEL);
        if (!il->txq) {
                IL_ERR("Not enough memory for txq\n");
                return -ENOMEM;
index 4b3753d78d03dfa3983e3e2991e8fa4106fcbeea..11ecdf63b7325b22f49402b10f2b1ca654c1fb36 100644 (file)
@@ -564,7 +564,7 @@ iwl_mvm_config_sched_scan_profiles(struct iwl_mvm *mvm,
        else
                blacklist_len = IWL_SCAN_MAX_BLACKLIST_LEN;
 
-       blacklist = kzalloc(sizeof(*blacklist) * blacklist_len, GFP_KERNEL);
+       blacklist = kcalloc(blacklist_len, sizeof(*blacklist), GFP_KERNEL);
        if (!blacklist)
                return -ENOMEM;
 
index d4c73d39336fce1e1d8cc3563fc534bd8e2da140..de2ef95c386c5baf1946ad29a74a168943ed2408 100644 (file)
@@ -161,8 +161,9 @@ static int p54_generate_band(struct ieee80211_hw *dev,
        if (!tmp)
                goto err_out;
 
-       tmp->channels = kzalloc(sizeof(struct ieee80211_channel) *
-                               list->band_channel_num[band], GFP_KERNEL);
+       tmp->channels = kcalloc(list->band_channel_num[band],
+                               sizeof(struct ieee80211_channel),
+                               GFP_KERNEL);
        if (!tmp->channels)
                goto err_out;
 
@@ -344,7 +345,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
                goto free;
        }
        priv->chan_num = max_channel_num;
-       priv->survey = kzalloc(sizeof(struct survey_info) * max_channel_num,
+       priv->survey = kcalloc(max_channel_num, sizeof(struct survey_info),
                               GFP_KERNEL);
        if (!priv->survey) {
                ret = -ENOMEM;
@@ -352,8 +353,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
        }
 
        list->max_entries = max_channel_num;
-       list->channels = kzalloc(sizeof(struct p54_channel_entry) *
-                                max_channel_num, GFP_KERNEL);
+       list->channels = kcalloc(max_channel_num,
+                                sizeof(struct p54_channel_entry),
+                                GFP_KERNEL);
        if (!list->channels) {
                ret = -ENOMEM;
                goto free;
index 6528ed5b9b1d23b10246fc6e30c9c162fc61b6a9..6d57e1cbcc0799bc8c8cae13a5b1348a5b41f62c 100644 (file)
@@ -244,7 +244,7 @@ mgt_init(islpci_private *priv)
        /* Alloc the cache */
        for (i = 0; i < OID_NUM_LAST; i++) {
                if (isl_oid[i].flags & OID_FLAG_CACHED) {
-                       priv->mib[i] = kzalloc(isl_oid[i].size *
+                       priv->mib[i] = kcalloc(isl_oid[i].size,
                                               (isl_oid[i].range + 1),
                                               GFP_KERNEL);
                        if (!priv->mib[i])
index 1edcddaf7b4b61455d29dc6a1cad2bacf85dc08b..7ab44cd32a9d506b9dcef96c1f81c359123356dd 100644 (file)
@@ -399,8 +399,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
 
        new_node->win_size = win_size;
 
-       new_node->rx_reorder_ptr = kzalloc(sizeof(void *) * win_size,
-                                       GFP_KERNEL);
+       new_node->rx_reorder_ptr = kcalloc(win_size, sizeof(void *),
+                                          GFP_KERNEL);
        if (!new_node->rx_reorder_ptr) {
                kfree((u8 *) new_node);
                mwifiex_dbg(priv->adapter, ERROR,
index 47d2dcc3f28fb0cb10f6e84ed1aca0a086d5601e..dfdcbc4f141af6dbbcfe144965e1642a7916fdfb 100644 (file)
@@ -2106,15 +2106,16 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter)
                return -ENOMEM;
 
        /* Allocate skb pointer buffers */
-       card->mpa_rx.skb_arr = kzalloc((sizeof(void *)) *
-                                      card->mp_agg_pkt_limit, GFP_KERNEL);
+       card->mpa_rx.skb_arr = kcalloc(card->mp_agg_pkt_limit, sizeof(void *),
+                                      GFP_KERNEL);
        if (!card->mpa_rx.skb_arr) {
                kfree(card->mp_regs);
                return -ENOMEM;
        }
 
-       card->mpa_rx.len_arr = kzalloc(sizeof(*card->mpa_rx.len_arr) *
-                                      card->mp_agg_pkt_limit, GFP_KERNEL);
+       card->mpa_rx.len_arr = kcalloc(card->mp_agg_pkt_limit,
+                                      sizeof(*card->mpa_rx.len_arr),
+                                      GFP_KERNEL);
        if (!card->mpa_rx.len_arr) {
                kfree(card->mp_regs);
                kfree(card->mpa_rx.skb_arr);
index 5eb143667539929ed7d0440f14fb6df991915131..c5d94a95e21a4abfabeeeca9fe2f19a780e25c3e 100644 (file)
@@ -1216,7 +1216,7 @@ static int qtnf_parse_variable_mac_info(struct qtnf_wmac *mac,
                                return -EINVAL;
                        }
 
-                       limits = kzalloc(sizeof(*limits) * rec->n_limits,
+                       limits = kcalloc(rec->n_limits, sizeof(*limits),
                                         GFP_KERNEL);
                        if (!limits)
                                return -ENOMEM;
index 0eee479583b86dcbebfcba02d8abe5ff946af2dd..acc399b5574e021de4e9767be7c18937b14caf69 100644 (file)
@@ -397,7 +397,7 @@ static ssize_t rt2x00debug_read_crypto_stats(struct file *file,
        if (*offset)
                return 0;
 
-       data = kzalloc((1 + CIPHER_MAX) * MAX_LINE_LENGTH, GFP_KERNEL);
+       data = kcalloc(1 + CIPHER_MAX, MAX_LINE_LENGTH, GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
index fd13d4ef53b80fa173d6a1c1d8c2fd95ee4da533..9729e51fce381232d2bb18b4aa3f6b32a0daa610 100644 (file)
@@ -258,8 +258,8 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
        }
 
        /* allocate memory for efuse_tbl and efuse_word */
-       efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] *
-                           sizeof(u8), GFP_ATOMIC);
+       efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE],
+                           GFP_ATOMIC);
        if (!efuse_tbl)
                return;
        efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC);
index ce3103bb8ebbd12a97874549141d6200c915f00b..f9faffc498bcbd2d94cad365814955f9b1347759 100644 (file)
@@ -1048,7 +1048,7 @@ int rtl_usb_probe(struct usb_interface *intf,
        }
        rtlpriv = hw->priv;
        rtlpriv->hw = hw;
-       rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32),
+       rtlpriv->usb_data = kcalloc(RTL_USB_MAX_RX_COUNT, sizeof(u32),
                                    GFP_KERNEL);
        if (!rtlpriv->usb_data)
                return -ENOMEM;
index 5153d2cfd9915ebfe911f830f309deff20d10f97..7c31b63b8258a6db067192f5b677a27fbafdaa43 100644 (file)
@@ -154,7 +154,7 @@ int cw1200_queue_stats_init(struct cw1200_queue_stats *stats,
        spin_lock_init(&stats->lock);
        init_waitqueue_head(&stats->wait_link_id_empty);
 
-       stats->link_map_cache = kzalloc(sizeof(int) * map_capacity,
+       stats->link_map_cache = kcalloc(map_capacity, sizeof(int),
                                        GFP_KERNEL);
        if (!stats->link_map_cache)
                return -ENOMEM;
@@ -181,13 +181,13 @@ int cw1200_queue_init(struct cw1200_queue *queue,
        spin_lock_init(&queue->lock);
        timer_setup(&queue->gc, cw1200_queue_gc, 0);
 
-       queue->pool = kzalloc(sizeof(struct cw1200_queue_item) * capacity,
-                       GFP_KERNEL);
+       queue->pool = kcalloc(capacity, sizeof(struct cw1200_queue_item),
+                             GFP_KERNEL);
        if (!queue->pool)
                return -ENOMEM;
 
-       queue->link_map_cache = kzalloc(sizeof(int) * stats->map_capacity,
-                       GFP_KERNEL);
+       queue->link_map_cache = kcalloc(stats->map_capacity, sizeof(int),
+                                       GFP_KERNEL);
        if (!queue->link_map_cache) {
                kfree(queue->pool);
                queue->pool = NULL;
index cc2ce60f4f097d93b09317801cda2376d8b880f0..67213f11acbd2e11f0ed85fee5d77003c20fae55 100644 (file)
@@ -230,9 +230,9 @@ void cw1200_scan_work(struct work_struct *work)
                        scan.type = WSM_SCAN_TYPE_BACKGROUND;
                        scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND;
                }
-               scan.ch = kzalloc(
-                       sizeof(struct wsm_scan_ch) * (it - priv->scan.curr),
-                       GFP_KERNEL);
+               scan.ch = kcalloc(it - priv->scan.curr,
+                                 sizeof(struct wsm_scan_ch),
+                                 GFP_KERNEL);
                if (!scan.ch) {
                        priv->scan.status = -ENOMEM;
                        goto fail;
index b3b0b648be62b929e99d2554aaaef1eeab0b4bf5..146de9489339b9534780b3abf84f0315c6f4671c 100644 (file)
@@ -122,7 +122,8 @@ static int rockchip_rk3328_efuse_read(void *context, unsigned int offset,
        addr_offset = offset % RK3399_NBYTES;
        addr_len = addr_end - addr_start;
 
-       buf = kzalloc(sizeof(*buf) * addr_len * RK3399_NBYTES, GFP_KERNEL);
+       buf = kzalloc(array3_size(addr_len, RK3399_NBYTES, sizeof(*buf)),
+                     GFP_KERNEL);
        if (!buf) {
                ret = -ENOMEM;
                goto nomem;
@@ -174,7 +175,8 @@ static int rockchip_rk3399_efuse_read(void *context, unsigned int offset,
        addr_offset = offset % RK3399_NBYTES;
        addr_len = addr_end - addr_start;
 
-       buf = kzalloc(sizeof(*buf) * addr_len * RK3399_NBYTES, GFP_KERNEL);
+       buf = kzalloc(array3_size(addr_len, RK3399_NBYTES, sizeof(*buf)),
+                     GFP_KERNEL);
        if (!buf) {
                clk_disable_unprepare(efuse->clk);
                return -ENOMEM;
index 26bb637afe924b314a25ec1a2ca6f5e669a14f24..d020f89248fd76a7baca320bb6a4238a71d785c0 100644 (file)
@@ -185,7 +185,7 @@ static int sunxi_sid_probe(struct platform_device *pdev)
        if (IS_ERR(nvmem))
                return PTR_ERR(nvmem);
 
-       randomness = kzalloc(sizeof(u8) * (size), GFP_KERNEL);
+       randomness = kzalloc(size, GFP_KERNEL);
        if (!randomness) {
                ret = -EINVAL;
                goto err_unreg_nvmem;
index 0b49a62b38a3800aff88b76307a294d093876dd4..14cc962e0eec990e7d8b5a813ba5ad9bc5a1b6c9 100644 (file)
@@ -129,7 +129,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
 
        /* Populate the resource table */
        if (num_irq || num_reg) {
-               res = kzalloc(sizeof(*res) * (num_irq + num_reg), GFP_KERNEL);
+               res = kcalloc(num_irq + num_reg, sizeof(*res), GFP_KERNEL);
                if (!res) {
                        platform_device_put(dev);
                        return NULL;
index ecee50d10d149a7894d8feb274b95ea46fa7fb22..722537e14848436bfb58bc1c32fabd5c786166ba 100644 (file)
@@ -156,7 +156,7 @@ static void __init of_unittest_dynamic(void)
        }
 
        /* Array of 4 properties for the purpose of testing */
-       prop = kzalloc(sizeof(*prop) * 4, GFP_KERNEL);
+       prop = kcalloc(4, sizeof(*prop), GFP_KERNEL);
        if (!prop) {
                unittest(0, "kzalloc() failed\n");
                return;
index 370eff3acd8ae64a6ddd8c40f48d495188ae778b..9e5a9a3112c9cec57abcffab6c9b23640682756c 100644 (file)
@@ -122,8 +122,8 @@ static int _store_optimized_voltages(struct device *dev,
                goto out;
        }
 
-       table = kzalloc(sizeof(*data->vdd_table) *
-                                 data->num_vdd_table, GFP_KERNEL);
+       table = kcalloc(data->num_vdd_table, sizeof(*data->vdd_table),
+                       GFP_KERNEL);
        if (!table) {
                ret = -ENOMEM;
                goto out;
index f45b74fcc059ae15a5734ba0b26e977b097df5a5..4d88afdfc8433ca159deefc544657f29d1a168b4 100644 (file)
@@ -474,7 +474,7 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
                return 0;
 
        /* Dynamically create the MSI attributes for the PCI device */
-       msi_attrs = kzalloc(sizeof(void *) * (num_msi + 1), GFP_KERNEL);
+       msi_attrs = kcalloc(num_msi + 1, sizeof(void *), GFP_KERNEL);
        if (!msi_attrs)
                return -ENOMEM;
        for_each_pci_msi_entry(entry, pdev) {
@@ -501,7 +501,7 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
        msi_irq_group->name = "msi_irqs";
        msi_irq_group->attrs = msi_attrs;
 
-       msi_irq_groups = kzalloc(sizeof(void *) * 2, GFP_KERNEL);
+       msi_irq_groups = kcalloc(2, sizeof(void *), GFP_KERNEL);
        if (!msi_irq_groups)
                goto error_irq_group;
        msi_irq_groups[0] = msi_irq_group;
index 788a200fb2dc4b3956f66ee07b7aeaa55157d0b2..0c4653c1d2cec6f743a0bd650ead5c029ef299bc 100644 (file)
@@ -1076,7 +1076,7 @@ void pci_create_legacy_files(struct pci_bus *b)
 {
        int error;
 
-       b->legacy_io = kzalloc(sizeof(struct bin_attribute) * 2,
+       b->legacy_io = kcalloc(2, sizeof(struct bin_attribute),
                               GFP_ATOMIC);
        if (!b->legacy_io)
                goto kzalloc_err;
index 959ae3e65ef8b2ae902141eb068865849e0deaad..f0af9985ca09219c6840c33901cb441b5e3130ce 100644 (file)
@@ -628,7 +628,7 @@ static int pd6729_pci_probe(struct pci_dev *dev,
        char configbyte;
        struct pd6729_socket *socket;
 
-       socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS,
+       socket = kcalloc(MAX_SOCKETS, sizeof(struct pd6729_socket),
                         GFP_KERNEL);
        if (!socket) {
                dev_warn(&dev->dev, "failed to kzalloc socket.\n");
index 136ccaf53df8d88cc5cc409f01cea24b40c50edd..fa530913a2c8fc73c37a9b668447f1058d99815a 100644 (file)
@@ -771,8 +771,8 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
                maps_per_pin++;
        if (num_pulls)
                maps_per_pin++;
-       cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps),
-                               GFP_KERNEL);
+       cur_map = maps = kcalloc(num_pins * maps_per_pin, sizeof(*maps),
+                                GFP_KERNEL);
        if (!maps)
                return -ENOMEM;
 
index 594f3e5ce9a9e81d63e7d60dbd35cca9e97d46f7..3a17846aa31f512b140d322f3b1d10952405e413 100644 (file)
@@ -89,7 +89,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
        if (!purecfg && config)
                new_num = 2;
 
-       new_map = kzalloc(sizeof(*new_map) * new_num, GFP_KERNEL);
+       new_map = kcalloc(new_num, sizeof(*new_map), GFP_KERNEL);
        if (!new_map)
                return -ENOMEM;
 
index 41dc39c7a7b14c700936eb38075aa440af0a1d85..81632af3a86ae5799a9e1194dc2f1df6f24b7019 100644 (file)
@@ -158,7 +158,8 @@ static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
 
        for_each_child_of_node(np_config, np)
                max_maps += ltq_pinctrl_dt_subnode_size(np);
-       *map = kzalloc(max_maps * sizeof(struct pinctrl_map) * 2, GFP_KERNEL);
+       *map = kzalloc(array3_size(max_maps, sizeof(struct pinctrl_map), 2),
+                      GFP_KERNEL);
        if (!*map)
                return -ENOMEM;
        tmp = *map;
index ca2347d0d57946574840ee778f2f4124b388c328..505845c66dd01930517c99563b6ea972ebe7262a 100644 (file)
@@ -108,7 +108,7 @@ static int sirfsoc_dt_node_to_map(struct pinctrl_dev *pctldev,
                return -ENODEV;
        }
 
-       *map = kzalloc(sizeof(**map) * count, GFP_KERNEL);
+       *map = kcalloc(count, sizeof(**map), GFP_KERNEL);
        if (!*map)
                return -ENOMEM;
 
index efe79d3f76596102a5c264c3065e37c4ccbdc3ab..c4f850345dc462c8886195982a0537d7e36b312f 100644 (file)
@@ -172,7 +172,7 @@ static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
                return -ENODEV;
        }
 
-       *map = kzalloc(sizeof(**map) * count, GFP_KERNEL);
+       *map = kcalloc(count, sizeof(**map), GFP_KERNEL);
        if (!*map)
                return -ENOMEM;
 
index 44459d28efd5042454012b0e69f4ed060c2ba79e..eaace8ec6afc4873242a76956a059f03a865e886 100644 (file)
@@ -277,7 +277,7 @@ static unsigned long *sunxi_pctrl_build_pin_config(struct device_node *node,
        if (!configlen)
                return NULL;
 
-       pinconfig = kzalloc(configlen * sizeof(*pinconfig), GFP_KERNEL);
+       pinconfig = kcalloc(configlen, sizeof(*pinconfig), GFP_KERNEL);
        if (!pinconfig)
                return ERR_PTR(-ENOMEM);
 
index d73956bdc21136ff29361bd2858391b2ae174bcf..c08318a5a91b6a7a201ce44c43424aa93ae03445 100644 (file)
@@ -352,7 +352,7 @@ static int wmt_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
        if (num_pulls)
                maps_per_pin++;
 
-       cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps),
+       cur_map = maps = kcalloc(num_pins * maps_per_pin, sizeof(*maps),
                                 GFP_KERNEL);
        if (!maps)
                return -ENOMEM;
index 9d7dbd925065c2f9e5321431d93e97d71b7b20ce..d975462a4c576748eb6163f512a607d4d3b8d19e 100644 (file)
@@ -458,19 +458,19 @@ static int alienware_zone_init(struct platform_device *dev)
         *      - zone_data num_zones is for the distinct zones
         */
        zone_dev_attrs =
-           kzalloc(sizeof(struct device_attribute) * (quirks->num_zones + 1),
+           kcalloc(quirks->num_zones + 1, sizeof(struct device_attribute),
                    GFP_KERNEL);
        if (!zone_dev_attrs)
                return -ENOMEM;
 
        zone_attrs =
-           kzalloc(sizeof(struct attribute *) * (quirks->num_zones + 2),
+           kcalloc(quirks->num_zones + 2, sizeof(struct attribute *),
                    GFP_KERNEL);
        if (!zone_attrs)
                return -ENOMEM;
 
        zone_data =
-           kzalloc(sizeof(struct platform_zone) * (quirks->num_zones),
+           kcalloc(quirks->num_zones, sizeof(struct platform_zone),
                    GFP_KERNEL);
        if (!zone_data)
                return -ENOMEM;
index a0c95853fd3f98abbe1979ad2478d6b781c7b046..014fc1634a3d856300e4c439c6b5c0c20a699b58 100644 (file)
@@ -964,12 +964,12 @@ static int ips_monitor(void *data)
        u16 *mcp_samples, *ctv1_samples, *ctv2_samples, *mch_samples;
        u8 cur_seqno, last_seqno;
 
-       mcp_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL);
-       ctv1_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL);
-       ctv2_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL);
-       mch_samples = kzalloc(sizeof(u16) * IPS_SAMPLE_COUNT, GFP_KERNEL);
-       cpu_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL);
-       mchp_samples = kzalloc(sizeof(u32) * IPS_SAMPLE_COUNT, GFP_KERNEL);
+       mcp_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL);
+       ctv1_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL);
+       ctv2_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL);
+       mch_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u16), GFP_KERNEL);
+       cpu_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u32), GFP_KERNEL);
+       mchp_samples = kcalloc(IPS_SAMPLE_COUNT, sizeof(u32), GFP_KERNEL);
        if (!mcp_samples || !ctv1_samples || !ctv2_samples || !mch_samples ||
                        !cpu_samples || !mchp_samples) {
                dev_err(ips->dev,
index 5c39b3211709bca675216625786bf3967e477ba9..8361ad75389a96f4c8f7eb87ff57ddb48f2a3380 100644 (file)
@@ -571,7 +571,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
                return -ENOMEM;
        }
 
-       pcc->sinf = kzalloc(sizeof(u32) * (num_sifr + 1), GFP_KERNEL);
+       pcc->sinf = kcalloc(num_sifr + 1, sizeof(u32), GFP_KERNEL);
        if (!pcc->sinf) {
                result = -ENOMEM;
                goto out_hotkey;
index da1ca4856ea192afefa641c9511c45dc7d34aa01..ab2d28867c52178fae4778a615f78d0b798c624b 100644 (file)
@@ -6006,7 +6006,7 @@ static int __init led_init(struct ibm_init_struct *iibm)
        if (led_supported == TPACPI_LED_NONE)
                return 1;
 
-       tpacpi_leds = kzalloc(sizeof(*tpacpi_leds) * TPACPI_LED_NUMLEDS,
+       tpacpi_leds = kcalloc(TPACPI_LED_NUMLEDS, sizeof(*tpacpi_leds),
                              GFP_KERNEL);
        if (!tpacpi_leds) {
                pr_err("Out of memory for LED data\n");
index bd4f66651513f8bdcdd7fe419c706acd82058277..6754e761778af9289000ce2eb5b4c6f5f659662a 100644 (file)
@@ -201,7 +201,7 @@ static int wm97xx_bat_probe(struct platform_device *dev)
        if (pdata->min_voltage >= 0)
                props++;        /* POWER_SUPPLY_PROP_VOLTAGE_MIN */
 
-       prop = kzalloc(props * sizeof(*prop), GFP_KERNEL);
+       prop = kcalloc(props, sizeof(*prop), GFP_KERNEL);
        if (!prop) {
                ret = -ENOMEM;
                goto err3;
index 8a43b49cfd35f0966461ea0cca32847c9f55861e..bcc2d1a9b0a797fa0897d1357a053779143c5adc 100644 (file)
@@ -146,7 +146,7 @@ static int z2_batt_ps_init(struct z2_charger *charger, int props)
        if (info->min_voltage >= 0)
                props++;        /* POWER_SUPPLY_PROP_VOLTAGE_MIN */
 
-       prop = kzalloc(props * sizeof(*prop), GFP_KERNEL);
+       prop = kcalloc(props, sizeof(*prop), GFP_KERNEL);
        if (!prop)
                return -ENOMEM;
 
index 64b2b2501a790978c48dd08af87178bb78d968c1..9e2f274bd44f2e3446608cc97951a42329f73956 100644 (file)
@@ -545,15 +545,16 @@ struct powercap_zone *powercap_register_zone(
        dev_set_name(&power_zone->dev, "%s:%x",
                                        dev_name(power_zone->dev.parent),
                                        power_zone->id);
-       power_zone->constraints = kzalloc(sizeof(*power_zone->constraints) *
-                                        nr_constraints, GFP_KERNEL);
+       power_zone->constraints = kcalloc(nr_constraints,
+                                         sizeof(*power_zone->constraints),
+                                         GFP_KERNEL);
        if (!power_zone->constraints)
                goto err_const_alloc;
 
        nr_attrs = nr_constraints * POWERCAP_CONSTRAINTS_ATTRS +
                                                POWERCAP_ZONE_MAX_ATTRS + 1;
-       power_zone->zone_dev_attrs = kzalloc(sizeof(void *) *
-                                               nr_attrs, GFP_KERNEL);
+       power_zone->zone_dev_attrs = kcalloc(nr_attrs, sizeof(void *),
+                                            GFP_KERNEL);
        if (!power_zone->zone_dev_attrs)
                goto err_attr_alloc;
        create_power_zone_common_attributes(power_zone);
index 161b927d9de1e24b3a034ac3926741312c655456..fd7b517132acef92915c72ea363222c1cac607bd 100644 (file)
@@ -425,9 +425,9 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
                rswitch = rdev->rswitch;
                rswitch->port_ok = 0;
                spin_lock_init(&rswitch->lock);
-               rswitch->route_table = kzalloc(sizeof(u8)*
-                                       RIO_MAX_ROUTE_ENTRIES(port->sys_size),
-                                       GFP_KERNEL);
+               rswitch->route_table =
+                       kzalloc(RIO_MAX_ROUTE_ENTRIES(port->sys_size),
+                               GFP_KERNEL);
                if (!rswitch->route_table)
                        goto cleanup;
                /* Initialize switch route table */
index 7726b874e5399cd55be8c4b7f0963956b64af0db..b4e588cce03dee1ec64ee577fb5886e724d1181a 100644 (file)
@@ -1162,7 +1162,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
                }
        }
 
-       rdata = kzalloc(sizeof(*rdata) * rdev_num, GFP_KERNEL);
+       rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL);
        if (!rdata)
                return -ENOMEM;
 
index 29024492b8ede9fed0eb1a94b28bd319ca001136..ed607288e696f64c7d041e4b791ef74836017640 100644 (file)
@@ -238,9 +238,9 @@ dcssblk_is_continuous(struct dcssblk_dev_info *dev_info)
        if (dev_info->num_of_segments <= 1)
                return 0;
 
-       sort_list = kzalloc(
-                       sizeof(struct segment_info) * dev_info->num_of_segments,
-                       GFP_KERNEL);
+       sort_list = kcalloc(dev_info->num_of_segments,
+                           sizeof(struct segment_info),
+                           GFP_KERNEL);
        if (sort_list == NULL)
                return -ENOMEM;
        i = 0;
index db1fbf9b00b5062795528541bcf5eb7d1cb14c9a..79eb60958015a5348818dfc94c23b2aa3585f0c1 100644 (file)
@@ -78,7 +78,7 @@ kbd_alloc(void) {
                }
        }
        kbd->fn_handler =
-               kzalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL);
+               kcalloc(NR_FN_HANDLER, sizeof(fn_handler_fn *), GFP_KERNEL);
        if (!kbd->fn_handler)
                goto out_func;
        kbd->accent_table = kmemdup(ebc_accent_table,
index 52aa894243187484c03bf301d274990cdbeacb32..cbde65ab217063f627b0eac66e7294152c8f8aac 100644 (file)
@@ -242,7 +242,7 @@ static struct ccw1 *alloc_chan_prog(const char __user *ubuf, int rec_count,
         * That means we allocate room for CCWs to cover count/reclen
         * records plus a NOP.
         */
-       cpa = kzalloc((rec_count + 1) * sizeof(struct ccw1),
+       cpa = kcalloc(rec_count + 1, sizeof(struct ccw1),
                      GFP_KERNEL | GFP_DMA);
        if (!cpa)
                return ERR_PTR(-ENOMEM);
index 4369662cfff5a7ad094d522590901bc845933872..76d3c50bf078bc0ce1490a0ec7d571eeac17634a 100644 (file)
@@ -152,7 +152,7 @@ static int zcore_memmap_open(struct inode *inode, struct file *filp)
        char *buf;
        int i = 0;
 
-       buf = kzalloc(memblock.memory.cnt * CHUNK_INFO_SIZE, GFP_KERNEL);
+       buf = kcalloc(memblock.memory.cnt, CHUNK_INFO_SIZE, GFP_KERNEL);
        if (!buf) {
                return -ENOMEM;
        }
index 4c14ce428e92d8927fedb8702d3d9dd26801ddad..78f1be41b05e3fb2cc5c91b31e0ec00877735851 100644 (file)
@@ -536,7 +536,7 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,
 
 int qdio_enable_async_operation(struct qdio_output_q *outq)
 {
-       outq->aobs = kzalloc(sizeof(struct qaob *) * QDIO_MAX_BUFFERS_PER_Q,
+       outq->aobs = kcalloc(QDIO_MAX_BUFFERS_PER_Q, sizeof(struct qaob *),
                             GFP_ATOMIC);
        if (!outq->aobs) {
                outq->use_cq = 0;
index 0787b587e4b8b690c9f1cb9bb511a6a6897f959b..07dea602205bdf2a18bfe85fad5888cf2f91b4dd 100644 (file)
@@ -241,8 +241,9 @@ out:
 /* allocate non-shared indicators and shared indicator */
 int __init tiqdio_allocate_memory(void)
 {
-       q_indicators = kzalloc(sizeof(struct indicator_t) * TIQDIO_NR_INDICATORS,
-                            GFP_KERNEL);
+       q_indicators = kcalloc(TIQDIO_NR_INDICATORS,
+                              sizeof(struct indicator_t),
+                              GFP_KERNEL);
        if (!q_indicators)
                return -ENOMEM;
        return 0;
index a9ae827cc1ce84f8042c8bceda48d4d89283baed..3929c8be8098b4098d5752d6697db506796fa9b4 100644 (file)
@@ -121,7 +121,7 @@ static int alloc_and_prep_cprbmem(size_t paramblen,
         * allocate consecutive memory for request CPRB, request param
         * block, reply CPRB and reply param block
         */
-       cprbmem = kzalloc(2 * cprbplusparamblen, GFP_KERNEL);
+       cprbmem = kcalloc(2, cprbplusparamblen, GFP_KERNEL);
        if (!cprbmem)
                return -ENOMEM;
 
index 7ce98b70cad38bf55be1fd4a15bdaa62761ff159..7617d21cb2960618cbc097bbf85cb8515234aa14 100644 (file)
@@ -1379,7 +1379,7 @@ static int add_channel(struct ccw_device *cdev, enum ctcm_channel_types type,
        } else
                ccw_num = 8;
 
-       ch->ccw = kzalloc(ccw_num * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
+       ch->ccw = kcalloc(ccw_num, sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
        if (ch->ccw == NULL)
                                        goto nomem_return;
 
index 9f28b6f2efc417d48081d6debcd9d5d2253fe9ef..8e1474f1ffacfb22b773b02aa1bff6ff91c61ce9 100644 (file)
@@ -374,9 +374,10 @@ static int qeth_alloc_cq(struct qeth_card *card)
                }
                card->qdio.no_in_queues = 2;
                card->qdio.out_bufstates =
-                       kzalloc(card->qdio.no_out_queues *
-                               QDIO_MAX_BUFFERS_PER_Q *
-                               sizeof(struct qdio_outbuf_state), GFP_KERNEL);
+                       kcalloc(card->qdio.no_out_queues *
+                                       QDIO_MAX_BUFFERS_PER_Q,
+                               sizeof(struct qdio_outbuf_state),
+                               GFP_KERNEL);
                outbuf_states = card->qdio.out_bufstates;
                if (outbuf_states == NULL) {
                        rc = -1;
@@ -2538,8 +2539,9 @@ static int qeth_alloc_qdio_buffers(struct qeth_card *card)
 
        /* outbound */
        card->qdio.out_qs =
-               kzalloc(card->qdio.no_out_queues *
-                       sizeof(struct qeth_qdio_out_q *), GFP_KERNEL);
+               kcalloc(card->qdio.no_out_queues,
+                       sizeof(struct qeth_qdio_out_q *),
+                       GFP_KERNEL);
        if (!card->qdio.out_qs)
                goto out_freepool;
        for (i = 0; i < card->qdio.no_out_queues; ++i) {
@@ -4963,8 +4965,8 @@ static int qeth_qdio_establish(struct qeth_card *card)
 
        QETH_DBF_TEXT(SETUP, 2, "qdioest");
 
-       qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q * sizeof(char),
-                             GFP_KERNEL);
+       qib_param_field = kzalloc(QDIO_MAX_BUFFERS_PER_Q,
+                                 GFP_KERNEL);
        if (!qib_param_field) {
                rc =  -ENOMEM;
                goto out_free_nothing;
@@ -4973,8 +4975,8 @@ static int qeth_qdio_establish(struct qeth_card *card)
        qeth_create_qib_param_field(card, qib_param_field);
        qeth_create_qib_param_field_blkt(card, qib_param_field);
 
-       in_sbal_ptrs = kzalloc(card->qdio.no_in_queues *
-                              QDIO_MAX_BUFFERS_PER_Q * sizeof(void *),
+       in_sbal_ptrs = kcalloc(card->qdio.no_in_queues * QDIO_MAX_BUFFERS_PER_Q,
+                              sizeof(void *),
                               GFP_KERNEL);
        if (!in_sbal_ptrs) {
                rc = -ENOMEM;
@@ -4985,7 +4987,7 @@ static int qeth_qdio_establish(struct qeth_card *card)
                        virt_to_phys(card->qdio.in_q->bufs[i].buffer);
        }
 
-       queue_start_poll = kzalloc(sizeof(void *) * card->qdio.no_in_queues,
+       queue_start_poll = kcalloc(card->qdio.no_in_queues, sizeof(void *),
                                   GFP_KERNEL);
        if (!queue_start_poll) {
                rc = -ENOMEM;
@@ -4997,8 +4999,9 @@ static int qeth_qdio_establish(struct qeth_card *card)
        qeth_qdio_establish_cq(card, in_sbal_ptrs, queue_start_poll);
 
        out_sbal_ptrs =
-               kzalloc(card->qdio.no_out_queues * QDIO_MAX_BUFFERS_PER_Q *
-                       sizeof(void *), GFP_KERNEL);
+               kcalloc(card->qdio.no_out_queues * QDIO_MAX_BUFFERS_PER_Q,
+                       sizeof(void *),
+                       GFP_KERNEL);
        if (!out_sbal_ptrs) {
                rc = -ENOMEM;
                goto out_free_queue_start_poll;
index 35380a58d3f0dd03c13add8bfe03dbc5f13e589b..0d4ffe0ae3065b8129567110e42ea564d4b01a5a 100644 (file)
@@ -2366,7 +2366,7 @@ static int __init blogic_init(void)
        if (blogic_probe_options.noprobe)
                return -ENODEV;
        blogic_probeinfo_list =
-           kzalloc(BLOGIC_MAX_ADAPTERS * sizeof(struct blogic_probeinfo),
+           kcalloc(BLOGIC_MAX_ADAPTERS, sizeof(struct blogic_probeinfo),
                            GFP_KERNEL);
        if (blogic_probeinfo_list == NULL) {
                blogic_err("BusLogic: Unable to allocate Probe Info List\n",
index f24fb942065d69878c0cc451e91d6066a944117d..04443577d48b371f37afb057ec5bceb9f2e000f7 100644 (file)
@@ -1681,7 +1681,9 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        if (aac_reset_devices || reset_devices)
                aac->init_reset = true;
 
-       aac->fibs = kzalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL);
+       aac->fibs = kcalloc(shost->can_queue + AAC_NUM_MGT_FIB,
+                           sizeof(struct fib),
+                           GFP_KERNEL);
        if (!aac->fibs)
                goto out_free_host;
        spin_lock_init(&aac->fib_lock);
index e97eceacf522f822f201dd9216dea7e635fd44ce..915a34f141e4f66503133af8453521de0ffb3783 100644 (file)
@@ -4779,8 +4779,8 @@ ahc_init_scbdata(struct ahc_softc *ahc)
        SLIST_INIT(&scb_data->sg_maps);
 
        /* Allocate SCB resources */
-       scb_data->scbarray = kzalloc(sizeof(struct scb) * AHC_SCB_MAX_ALLOC,
-                               GFP_ATOMIC);
+       scb_data->scbarray = kcalloc(AHC_SCB_MAX_ALLOC, sizeof(struct scb),
+                                    GFP_ATOMIC);
        if (scb_data->scbarray == NULL)
                return (ENOMEM);
 
index 35e0b5b64e8fa6f2f98a39db10d6598b8bfc2db9..3b8ad55e59de13e898c44cd5fc46d0e55cdf8f68 100644 (file)
@@ -220,8 +220,9 @@ static int asd_init_scbs(struct asd_ha_struct *asd_ha)
 
        /* allocate the index array and bitmap */
        asd_ha->seq.tc_index_bitmap_bits = asd_ha->hw_prof.max_scbs;
-       asd_ha->seq.tc_index_array = kzalloc(asd_ha->seq.tc_index_bitmap_bits*
-                                            sizeof(void *), GFP_KERNEL);
+       asd_ha->seq.tc_index_array = kcalloc(asd_ha->seq.tc_index_bitmap_bits,
+                                            sizeof(void *),
+                                            GFP_KERNEL);
        if (!asd_ha->seq.tc_index_array)
                return -ENOMEM;
 
index 6c838865ac5a7b32fd853aa36a07611e9809adc3..80e5b283fd8172b0ac02282aa2f4a3d7f646337e 100644 (file)
@@ -350,7 +350,7 @@ static ssize_t asd_store_update_bios(struct device *dev,
        int flash_command = FLASH_CMD_NONE;
        int err = 0;
 
-       cmd_ptr = kzalloc(count*2, GFP_KERNEL);
+       cmd_ptr = kcalloc(count, 2, GFP_KERNEL);
 
        if (!cmd_ptr) {
                err = FAIL_OUT_MEMORY;
index d981c16cd61116522b811d448cd9de96c60dbbac..818d185d63f0776d81d9c6b88482807065e2b472 100644 (file)
@@ -2467,8 +2467,8 @@ static int beiscsi_alloc_mem(struct beiscsi_hba *phba)
 
        /* Allocate memory for wrb_context */
        phwi_ctrlr = phba->phwi_ctrlr;
-       phwi_ctrlr->wrb_context = kzalloc(sizeof(struct hwi_wrb_context) *
-                                         phba->params.cxns_per_ctrl,
+       phwi_ctrlr->wrb_context = kcalloc(phba->params.cxns_per_ctrl,
+                                         sizeof(struct hwi_wrb_context),
                                          GFP_KERNEL);
        if (!phwi_ctrlr->wrb_context) {
                kfree(phba->phwi_ctrlr);
@@ -2621,8 +2621,8 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
 
        /* Allocate memory for WRBQ */
        phwi_ctxt = phwi_ctrlr->phwi_ctxt;
-       phwi_ctxt->be_wrbq = kzalloc(sizeof(struct be_queue_info) *
-                                    phba->params.cxns_per_ctrl,
+       phwi_ctxt->be_wrbq = kcalloc(phba->params.cxns_per_ctrl,
+                                    sizeof(struct be_queue_info),
                                     GFP_KERNEL);
        if (!phwi_ctxt->be_wrbq) {
                beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
@@ -2633,16 +2633,18 @@ static int beiscsi_init_wrb_handle(struct beiscsi_hba *phba)
        for (index = 0; index < phba->params.cxns_per_ctrl; index++) {
                pwrb_context = &phwi_ctrlr->wrb_context[index];
                pwrb_context->pwrb_handle_base =
-                               kzalloc(sizeof(struct wrb_handle *) *
-                                       phba->params.wrbs_per_cxn, GFP_KERNEL);
+                               kcalloc(phba->params.wrbs_per_cxn,
+                                       sizeof(struct wrb_handle *),
+                                       GFP_KERNEL);
                if (!pwrb_context->pwrb_handle_base) {
                        beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
                                    "BM_%d : Mem Alloc Failed. Failing to load\n");
                        goto init_wrb_hndl_failed;
                }
                pwrb_context->pwrb_handle_basestd =
-                               kzalloc(sizeof(struct wrb_handle *) *
-                                       phba->params.wrbs_per_cxn, GFP_KERNEL);
+                               kcalloc(phba->params.wrbs_per_cxn,
+                                       sizeof(struct wrb_handle *),
+                                       GFP_KERNEL);
                if (!pwrb_context->pwrb_handle_basestd) {
                        beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
                                    "BM_%d : Mem Alloc Failed. Failing to load\n");
@@ -3896,18 +3898,18 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba)
        mem_descr_sglh = phba->init_mem;
        mem_descr_sglh += HWI_MEM_SGLH;
        if (1 == mem_descr_sglh->num_elements) {
-               phba->io_sgl_hndl_base = kzalloc(sizeof(struct sgl_handle *) *
-                                                phba->params.ios_per_ctrl,
+               phba->io_sgl_hndl_base = kcalloc(phba->params.ios_per_ctrl,
+                                                sizeof(struct sgl_handle *),
                                                 GFP_KERNEL);
                if (!phba->io_sgl_hndl_base) {
                        beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
                                    "BM_%d : Mem Alloc Failed. Failing to load\n");
                        return -ENOMEM;
                }
-               phba->eh_sgl_hndl_base = kzalloc(sizeof(struct sgl_handle *) *
-                                                (phba->params.icds_per_ctrl -
-                                                phba->params.ios_per_ctrl),
-                                                GFP_KERNEL);
+               phba->eh_sgl_hndl_base =
+                       kcalloc(phba->params.icds_per_ctrl -
+                                       phba->params.ios_per_ctrl,
+                               sizeof(struct sgl_handle *), GFP_KERNEL);
                if (!phba->eh_sgl_hndl_base) {
                        kfree(phba->io_sgl_hndl_base);
                        beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
@@ -4034,8 +4036,9 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
                        phba->cid_array_info[ulp_num] = ptr_cid_info;
                }
        }
-       phba->ep_array = kzalloc(sizeof(struct iscsi_endpoint *) *
-                                phba->params.cxns_per_ctrl, GFP_KERNEL);
+       phba->ep_array = kcalloc(phba->params.cxns_per_ctrl,
+                                sizeof(struct iscsi_endpoint *),
+                                GFP_KERNEL);
        if (!phba->ep_array) {
                beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
                            "BM_%d : Failed to allocate memory in "
@@ -4045,8 +4048,9 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba)
                goto free_memory;
        }
 
-       phba->conn_table = kzalloc(sizeof(struct beiscsi_conn *) *
-                                  phba->params.cxns_per_ctrl, GFP_KERNEL);
+       phba->conn_table = kcalloc(phba->params.cxns_per_ctrl,
+                                  sizeof(struct beiscsi_conn *),
+                                  GFP_KERNEL);
        if (!phba->conn_table) {
                beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
                            "BM_%d : Failed to allocate memory in"
index d4d276c757ea79929c7e3c25ee4974d58db567a8..26b0fa4e90b58b5340bf18bb20e1a22fd8d5c677 100644 (file)
@@ -927,7 +927,7 @@ bfad_im_num_of_discovered_ports_show(struct device *dev,
        struct bfa_rport_qualifier_s *rports = NULL;
        unsigned long   flags;
 
-       rports = kzalloc(sizeof(struct bfa_rport_qualifier_s) * nrports,
+       rports = kcalloc(nrports, sizeof(struct bfa_rport_qualifier_s),
                         GFP_ATOMIC);
        if (rports == NULL)
                return snprintf(buf, PAGE_SIZE, "Failed\n");
index 7c884f881180959e04947211f4994469a2a9538a..5d163ca1b36666041fc22d5413fd2e6ecb1ebd3c 100644 (file)
@@ -3252,8 +3252,9 @@ bfad_fcxp_map_sg(struct bfad_s *bfad, void *payload_kbuf,
        struct bfa_sge_s        *sg_table;
        int sge_num = 1;
 
-       buf_base = kzalloc((sizeof(struct bfad_buf_info) +
-                          sizeof(struct bfa_sge_s)) * sge_num, GFP_KERNEL);
+       buf_base = kcalloc(sizeof(struct bfad_buf_info) +
+                               sizeof(struct bfa_sge_s),
+                          sge_num, GFP_KERNEL);
        if (!buf_base)
                return NULL;
 
index 65de1d0578a1fa03ff350eee94e8c5145bce88b3..f000458133789935fbb2b15550d91106ec5c65ca 100644 (file)
@@ -1397,7 +1397,7 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic)
        hba->next_conn_id = 0;
 
        hba->tgt_ofld_list =
-               kzalloc(sizeof(struct bnx2fc_rport *) * BNX2FC_NUM_MAX_SESS,
+               kcalloc(BNX2FC_NUM_MAX_SESS, sizeof(struct bnx2fc_rport *),
                        GFP_KERNEL);
        if (!hba->tgt_ofld_list) {
                printk(KERN_ERR PFX "Unable to allocate tgt offload list\n");
index 5a645b8b9af170d66a2abd510393c5f5c5725aa8..350257c13a5bac433f1fdfbfcdc12dc6698587cb 100644 (file)
@@ -240,15 +240,15 @@ struct bnx2fc_cmd_mgr *bnx2fc_cmd_mgr_alloc(struct bnx2fc_hba *hba)
                return NULL;
        }
 
-       cmgr->free_list = kzalloc(sizeof(*cmgr->free_list) *
-                                 arr_sz, GFP_KERNEL);
+       cmgr->free_list = kcalloc(arr_sz, sizeof(*cmgr->free_list),
+                                 GFP_KERNEL);
        if (!cmgr->free_list) {
                printk(KERN_ERR PFX "failed to alloc free_list\n");
                goto mem_err;
        }
 
-       cmgr->free_list_lock = kzalloc(sizeof(*cmgr->free_list_lock) *
-                                      arr_sz, GFP_KERNEL);
+       cmgr->free_list_lock = kcalloc(arr_sz, sizeof(*cmgr->free_list_lock),
+                                      GFP_KERNEL);
        if (!cmgr->free_list_lock) {
                printk(KERN_ERR PFX "failed to alloc free_list_lock\n");
                kfree(cmgr->free_list);
index c0a17789752febb281182c15c1b74f14da25841e..faa357b62c61686fba4b9548895b4e3709c9d6f7 100644 (file)
@@ -276,7 +276,7 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize,
                        q->un.iq.flq_idx = flq_idx;
 
                        flq = wrm->q_arr[q->un.iq.flq_idx];
-                       flq->un.fl.bufs = kzalloc(flq->credits *
+                       flq->un.fl.bufs = kcalloc(flq->credits,
                                                  sizeof(struct csio_dma_buf),
                                                  GFP_KERNEL);
                        if (!flq->un.fl.bufs) {
@@ -1579,7 +1579,7 @@ csio_wrm_init(struct csio_wrm *wrm, struct csio_hw *hw)
                return -EINVAL;
        }
 
-       wrm->q_arr = kzalloc(sizeof(struct csio_q *) * wrm->num_q, GFP_KERNEL);
+       wrm->q_arr = kcalloc(wrm->num_q, sizeof(struct csio_q *), GFP_KERNEL);
        if (!wrm->q_arr)
                goto err;
 
index 9db645dde35ec355071219362d301f05ef322543..bbe77db8938d6c5217793447658b98ae3317a91a 100644 (file)
@@ -833,7 +833,7 @@ bool esas2r_init_adapter_struct(struct esas2r_adapter *a,
 
        /* allocate requests for asynchronous events */
        a->first_ae_req =
-               kzalloc(num_ae_requests * sizeof(struct esas2r_request),
+               kcalloc(num_ae_requests, sizeof(struct esas2r_request),
                        GFP_KERNEL);
 
        if (a->first_ae_req == NULL) {
@@ -843,8 +843,8 @@ bool esas2r_init_adapter_struct(struct esas2r_adapter *a,
        }
 
        /* allocate the S/G list memory descriptors */
-       a->sg_list_mds = kzalloc(
-               num_sg_lists * sizeof(struct esas2r_mem_desc), GFP_KERNEL);
+       a->sg_list_mds = kcalloc(num_sg_lists, sizeof(struct esas2r_mem_desc),
+                                GFP_KERNEL);
 
        if (a->sg_list_mds == NULL) {
                esas2r_log(ESAS2R_LOG_CRIT,
@@ -854,8 +854,9 @@ bool esas2r_init_adapter_struct(struct esas2r_adapter *a,
 
        /* allocate the request table */
        a->req_table =
-               kzalloc((num_requests + num_ae_requests +
-                        1) * sizeof(struct esas2r_request *), GFP_KERNEL);
+               kcalloc(num_requests + num_ae_requests + 1,
+                       sizeof(struct esas2r_request *),
+                       GFP_KERNEL);
 
        if (a->req_table == NULL) {
                esas2r_log(ESAS2R_LOG_CRIT,
index e6f31fa9ec65f0019d2f4cf8b1c70692ed85f217..af0e628ff39656ce5c4cc4828b1d40e6d9e2644a 100644 (file)
@@ -1923,8 +1923,8 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h,
        }
        spin_unlock_irqrestore(&h->reset_lock, flags);
 
-       added = kzalloc(sizeof(*added) * HPSA_MAX_DEVICES, GFP_KERNEL);
-       removed = kzalloc(sizeof(*removed) * HPSA_MAX_DEVICES, GFP_KERNEL);
+       added = kcalloc(HPSA_MAX_DEVICES, sizeof(*added), GFP_KERNEL);
+       removed = kcalloc(HPSA_MAX_DEVICES, sizeof(*removed), GFP_KERNEL);
 
        if (!added || !removed) {
                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)
                return 0;
 
        h->ioaccel2_cmd_sg_list =
-               kzalloc(sizeof(*h->ioaccel2_cmd_sg_list) * h->nr_cmds,
+               kcalloc(h->nr_cmds, sizeof(*h->ioaccel2_cmd_sg_list),
                                        GFP_KERNEL);
        if (!h->ioaccel2_cmd_sg_list)
                return -ENOMEM;
@@ -2211,8 +2211,8 @@ static int hpsa_alloc_sg_chain_blocks(struct ctlr_info *h)
        if (h->chainsize <= 0)
                return 0;
 
-       h->cmd_sg_list = kzalloc(sizeof(*h->cmd_sg_list) * h->nr_cmds,
-                               GFP_KERNEL);
+       h->cmd_sg_list = kcalloc(h->nr_cmds, sizeof(*h->cmd_sg_list),
+                                GFP_KERNEL);
        if (!h->cmd_sg_list)
                return -ENOMEM;
 
@@ -4321,7 +4321,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
        bool physical_device;
        DECLARE_BITMAP(lunzerobits, MAX_EXT_TARGETS);
 
-       currentsd = kzalloc(sizeof(*currentsd) * HPSA_MAX_DEVICES, GFP_KERNEL);
+       currentsd = kcalloc(HPSA_MAX_DEVICES, sizeof(*currentsd), GFP_KERNEL);
        physdev_list = kzalloc(sizeof(*physdev_list), GFP_KERNEL);
        logdev_list = kzalloc(sizeof(*logdev_list), GFP_KERNEL);
        tmpdevice = kzalloc(sizeof(*tmpdevice), GFP_KERNEL);
@@ -6404,7 +6404,7 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info *h, void __user *argp)
                status = -EINVAL;
                goto cleanup1;
        }
-       buff = kzalloc(SG_ENTRIES_IN_CMD * sizeof(char *), GFP_KERNEL);
+       buff = kcalloc(SG_ENTRIES_IN_CMD, sizeof(char *), GFP_KERNEL);
        if (!buff) {
                status = -ENOMEM;
                goto cleanup1;
@@ -7933,9 +7933,9 @@ static void hpsa_free_cmd_pool(struct ctlr_info *h)
 
 static int hpsa_alloc_cmd_pool(struct ctlr_info *h)
 {
-       h->cmd_pool_bits = kzalloc(
-               DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) *
-               sizeof(unsigned long), GFP_KERNEL);
+       h->cmd_pool_bits = kcalloc(DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG),
+                                  sizeof(unsigned long),
+                                  GFP_KERNEL);
        h->cmd_pool = pci_alloc_consistent(h->pdev,
                    h->nr_cmds * sizeof(*h->cmd_pool),
                    &(h->cmd_pool_dhandle));
@@ -8509,7 +8509,7 @@ static struct ctlr_info *hpda_alloc_ctlr_info(void)
        if (!h)
                return NULL;
 
-       h->reply_map = kzalloc(sizeof(*h->reply_map) * nr_cpu_ids, GFP_KERNEL);
+       h->reply_map = kcalloc(nr_cpu_ids, sizeof(*h->reply_map), GFP_KERNEL);
        if (!h->reply_map) {
                kfree(h);
                return NULL;
index 6615ad8754b89f73292be3d067360be823979995..e63785d5df322be3a33cf3a4caaa6e2fb882d06f 100644 (file)
@@ -9713,8 +9713,9 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
        int i, rc = -ENOMEM;
 
        ENTER;
-       ioa_cfg->res_entries = kzalloc(sizeof(struct ipr_resource_entry) *
-                                      ioa_cfg->max_devs_supported, GFP_KERNEL);
+       ioa_cfg->res_entries = kcalloc(ioa_cfg->max_devs_supported,
+                                      sizeof(struct ipr_resource_entry),
+                                      GFP_KERNEL);
 
        if (!ioa_cfg->res_entries)
                goto out;
@@ -9775,8 +9776,9 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg)
                list_add_tail(&ioa_cfg->hostrcb[i]->queue, &ioa_cfg->hostrcb_free_q);
        }
 
-       ioa_cfg->trace = kzalloc(sizeof(struct ipr_trace_entry) *
-                                IPR_NUM_TRACE_ENTRIES, GFP_KERNEL);
+       ioa_cfg->trace = kcalloc(IPR_NUM_TRACE_ENTRIES,
+                                sizeof(struct ipr_trace_entry),
+                                GFP_KERNEL);
 
        if (!ioa_cfg->trace)
                goto out_free_hostrcb_dma;
index 8b7114348def9d4faa1ce416a40324627af92844..fadc99cb60df935b7a285f39b4ac7d0d50622c3f 100644 (file)
@@ -443,7 +443,7 @@ static int sas_expander_discover(struct domain_device *dev)
        struct expander_device *ex = &dev->ex_dev;
        int res = -ENOMEM;
 
-       ex->ex_phy = kzalloc(sizeof(*ex->ex_phy)*ex->num_phys, GFP_KERNEL);
+       ex->ex_phy = kcalloc(ex->num_phys, sizeof(*ex->ex_phy), GFP_KERNEL);
        if (!ex->ex_phy)
                return -ENOMEM;
 
index 7ae343b1463013dc4f1e9cf09f06111da4c478bf..52cae87da0d21fb7cf8bb0fcf69da8f2c841face 100644 (file)
@@ -5723,8 +5723,9 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
        }
 
        if (!phba->sli.sli3_ring)
-               phba->sli.sli3_ring = kzalloc(LPFC_SLI3_MAX_RING *
-                       sizeof(struct lpfc_sli_ring), GFP_KERNEL);
+               phba->sli.sli3_ring = kcalloc(LPFC_SLI3_MAX_RING,
+                                             sizeof(struct lpfc_sli_ring),
+                                             GFP_KERNEL);
        if (!phba->sli.sli3_ring)
                return -ENOMEM;
 
@@ -6233,7 +6234,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 
        /* Allocate eligible FCF bmask memory for FCF roundrobin failover */
        longs = (LPFC_SLI4_FCF_TBL_INDX_MAX + BITS_PER_LONG - 1)/BITS_PER_LONG;
-       phba->fcf.fcf_rr_bmask = kzalloc(longs * sizeof(unsigned long),
+       phba->fcf.fcf_rr_bmask = kcalloc(longs, sizeof(unsigned long),
                                         GFP_KERNEL);
        if (!phba->fcf.fcf_rr_bmask) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
index 4b70d53acb7204d542a45108ef99bc237726ef53..6f3c00a233ecdde57e42100c8a1a83ba94a631b3 100644 (file)
@@ -1720,7 +1720,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
                                           - LPFC_IOCBQ_LOOKUP_INCREMENT)) {
                new_len = psli->iocbq_lookup_len + LPFC_IOCBQ_LOOKUP_INCREMENT;
                spin_unlock_irq(&phba->hbalock);
-               new_arr = kzalloc(new_len * sizeof (struct lpfc_iocbq *),
+               new_arr = kcalloc(new_len, sizeof(struct lpfc_iocbq *),
                                  GFP_KERNEL);
                if (new_arr) {
                        spin_lock_irq(&phba->hbalock);
@@ -5142,16 +5142,17 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
                 */
                if ((phba->vpi_bmask == NULL) && (phba->vpi_ids == NULL)) {
                        longs = (phba->max_vpi + BITS_PER_LONG) / BITS_PER_LONG;
-                       phba->vpi_bmask = kzalloc(longs * sizeof(unsigned long),
+                       phba->vpi_bmask = kcalloc(longs,
+                                                 sizeof(unsigned long),
                                                  GFP_KERNEL);
                        if (!phba->vpi_bmask) {
                                rc = -ENOMEM;
                                goto lpfc_sli_hba_setup_error;
                        }
 
-                       phba->vpi_ids = kzalloc(
-                                       (phba->max_vpi+1) * sizeof(uint16_t),
-                                       GFP_KERNEL);
+                       phba->vpi_ids = kcalloc(phba->max_vpi + 1,
+                                               sizeof(uint16_t),
+                                               GFP_KERNEL);
                        if (!phba->vpi_ids) {
                                kfree(phba->vpi_bmask);
                                rc = -ENOMEM;
@@ -5836,14 +5837,14 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
        length = sizeof(struct lpfc_rsrc_blks);
        switch (type) {
        case LPFC_RSC_TYPE_FCOE_RPI:
-               phba->sli4_hba.rpi_bmask = kzalloc(longs *
+               phba->sli4_hba.rpi_bmask = kcalloc(longs,
                                                   sizeof(unsigned long),
                                                   GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.rpi_bmask)) {
                        rc = -ENOMEM;
                        goto err_exit;
                }
-               phba->sli4_hba.rpi_ids = kzalloc(rsrc_id_cnt *
+               phba->sli4_hba.rpi_ids = kcalloc(rsrc_id_cnt,
                                                 sizeof(uint16_t),
                                                 GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.rpi_ids)) {
@@ -5865,15 +5866,13 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
                ext_blk_list = &phba->sli4_hba.lpfc_rpi_blk_list;
                break;
        case LPFC_RSC_TYPE_FCOE_VPI:
-               phba->vpi_bmask = kzalloc(longs *
-                                         sizeof(unsigned long),
+               phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long),
                                          GFP_KERNEL);
                if (unlikely(!phba->vpi_bmask)) {
                        rc = -ENOMEM;
                        goto err_exit;
                }
-               phba->vpi_ids = kzalloc(rsrc_id_cnt *
-                                        sizeof(uint16_t),
+               phba->vpi_ids = kcalloc(rsrc_id_cnt, sizeof(uint16_t),
                                         GFP_KERNEL);
                if (unlikely(!phba->vpi_ids)) {
                        kfree(phba->vpi_bmask);
@@ -5887,7 +5886,7 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
                ext_blk_list = &phba->lpfc_vpi_blk_list;
                break;
        case LPFC_RSC_TYPE_FCOE_XRI:
-               phba->sli4_hba.xri_bmask = kzalloc(longs *
+               phba->sli4_hba.xri_bmask = kcalloc(longs,
                                                   sizeof(unsigned long),
                                                   GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.xri_bmask)) {
@@ -5895,7 +5894,7 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
                        goto err_exit;
                }
                phba->sli4_hba.max_cfg_param.xri_used = 0;
-               phba->sli4_hba.xri_ids = kzalloc(rsrc_id_cnt *
+               phba->sli4_hba.xri_ids = kcalloc(rsrc_id_cnt,
                                                 sizeof(uint16_t),
                                                 GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.xri_ids)) {
@@ -5910,14 +5909,14 @@ lpfc_sli4_alloc_extent(struct lpfc_hba *phba, uint16_t type)
                ext_blk_list = &phba->sli4_hba.lpfc_xri_blk_list;
                break;
        case LPFC_RSC_TYPE_FCOE_VFI:
-               phba->sli4_hba.vfi_bmask = kzalloc(longs *
+               phba->sli4_hba.vfi_bmask = kcalloc(longs,
                                                   sizeof(unsigned long),
                                                   GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.vfi_bmask)) {
                        rc = -ENOMEM;
                        goto err_exit;
                }
-               phba->sli4_hba.vfi_ids = kzalloc(rsrc_id_cnt *
+               phba->sli4_hba.vfi_ids = kcalloc(rsrc_id_cnt,
                                                 sizeof(uint16_t),
                                                 GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.vfi_ids)) {
@@ -6250,15 +6249,14 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
                }
                base = phba->sli4_hba.max_cfg_param.rpi_base;
                longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
-               phba->sli4_hba.rpi_bmask = kzalloc(longs *
+               phba->sli4_hba.rpi_bmask = kcalloc(longs,
                                                   sizeof(unsigned long),
                                                   GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.rpi_bmask)) {
                        rc = -ENOMEM;
                        goto err_exit;
                }
-               phba->sli4_hba.rpi_ids = kzalloc(count *
-                                                sizeof(uint16_t),
+               phba->sli4_hba.rpi_ids = kcalloc(count, sizeof(uint16_t),
                                                 GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.rpi_ids)) {
                        rc = -ENOMEM;
@@ -6279,15 +6277,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
                }
                base = phba->sli4_hba.max_cfg_param.vpi_base;
                longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
-               phba->vpi_bmask = kzalloc(longs *
-                                         sizeof(unsigned long),
+               phba->vpi_bmask = kcalloc(longs, sizeof(unsigned long),
                                          GFP_KERNEL);
                if (unlikely(!phba->vpi_bmask)) {
                        rc = -ENOMEM;
                        goto free_rpi_ids;
                }
-               phba->vpi_ids = kzalloc(count *
-                                       sizeof(uint16_t),
+               phba->vpi_ids = kcalloc(count, sizeof(uint16_t),
                                        GFP_KERNEL);
                if (unlikely(!phba->vpi_ids)) {
                        rc = -ENOMEM;
@@ -6308,7 +6304,7 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
                }
                base = phba->sli4_hba.max_cfg_param.xri_base;
                longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
-               phba->sli4_hba.xri_bmask = kzalloc(longs *
+               phba->sli4_hba.xri_bmask = kcalloc(longs,
                                                   sizeof(unsigned long),
                                                   GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.xri_bmask)) {
@@ -6316,8 +6312,7 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
                        goto free_vpi_ids;
                }
                phba->sli4_hba.max_cfg_param.xri_used = 0;
-               phba->sli4_hba.xri_ids = kzalloc(count *
-                                                sizeof(uint16_t),
+               phba->sli4_hba.xri_ids = kcalloc(count, sizeof(uint16_t),
                                                 GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.xri_ids)) {
                        rc = -ENOMEM;
@@ -6338,15 +6333,14 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
                }
                base = phba->sli4_hba.max_cfg_param.vfi_base;
                longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
-               phba->sli4_hba.vfi_bmask = kzalloc(longs *
+               phba->sli4_hba.vfi_bmask = kcalloc(longs,
                                                   sizeof(unsigned long),
                                                   GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.vfi_bmask)) {
                        rc = -ENOMEM;
                        goto free_xri_ids;
                }
-               phba->sli4_hba.vfi_ids = kzalloc(count *
-                                                sizeof(uint16_t),
+               phba->sli4_hba.vfi_ids = kcalloc(count, sizeof(uint16_t),
                                                 GFP_KERNEL);
                if (unlikely(!phba->sli4_hba.vfi_ids)) {
                        rc = -ENOMEM;
index c9d33b1268cb66c57fb2e8c0246a944586ada4c3..81bc12dedf415c03f538e5a078b392d5f3410f17 100644 (file)
@@ -840,7 +840,7 @@ lpfc_create_vport_work_array(struct lpfc_hba *phba)
        struct lpfc_vport *port_iterator;
        struct lpfc_vport **vports;
        int index = 0;
-       vports = kzalloc((phba->max_vports + 1) * sizeof(struct lpfc_vport *),
+       vports = kcalloc(phba->max_vports + 1, sizeof(struct lpfc_vport *),
                         GFP_KERNEL);
        if (vports == NULL)
                return NULL;
index c5d0c4bd71d241f224c02826dda29025a290ef65..71d97573a667fe1f2870df134f186d9f2ffb9839 100644 (file)
@@ -5419,9 +5419,9 @@ static int megasas_init_fw(struct megasas_instance *instance)
        /* stream detection initialization */
        if (instance->adapter_type == VENTURA_SERIES) {
                fusion->stream_detect_by_ld =
-                       kzalloc(sizeof(struct LD_STREAM_DETECT *)
-                       * MAX_LOGICAL_DRIVES_EXT,
-                       GFP_KERNEL);
+                       kcalloc(MAX_LOGICAL_DRIVES_EXT,
+                               sizeof(struct LD_STREAM_DETECT *),
+                               GFP_KERNEL);
                if (!fusion->stream_detect_by_ld) {
                        dev_err(&instance->pdev->dev,
                                "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)
  */
 static int megasas_alloc_ctrl_mem(struct megasas_instance *instance)
 {
-       instance->reply_map = kzalloc(sizeof(unsigned int) * nr_cpu_ids,
+       instance->reply_map = kcalloc(nr_cpu_ids, sizeof(unsigned int),
                                      GFP_KERNEL);
        if (!instance->reply_map)
                return -ENOMEM;
index 98a7a090b75e92c9d3b94ecc14783449ebd298c0..b965d4fe18ef46594478e337e386b4180b4f69fd 100644 (file)
@@ -487,7 +487,7 @@ megasas_alloc_cmdlist_fusion(struct megasas_instance *instance)
         * commands.
         */
        fusion->cmd_list =
-               kzalloc(sizeof(struct megasas_cmd_fusion *) * max_mpt_cmd,
+               kcalloc(max_mpt_cmd, sizeof(struct megasas_cmd_fusion *),
                        GFP_KERNEL);
        if (!fusion->cmd_list) {
                dev_err(&instance->pdev->dev,
index 773c4bfeb0f88d8bb1b48c74bfc40392f2dde14d..928ee4e898130723e5d03c86d02549149c72d137 100644 (file)
@@ -381,7 +381,7 @@ static int osst_execute(struct osst_request *SRpnt, const unsigned char *cmd,
                struct scatterlist *sg, *sgl = (struct scatterlist *)buffer;
                int i;
 
-               pages = kzalloc(use_sg * sizeof(struct page *), GFP_KERNEL);
+               pages = kcalloc(use_sg, sizeof(struct page *), GFP_KERNEL);
                if (!pages)
                        goto free_req;
 
index 596f3ff965f5bd9a3eea4beb0a9567b70b6543ac..d193961ea82f1c308ac14b679f2a221727c7ae92 100644 (file)
@@ -705,7 +705,7 @@ static ssize_t pm8001_store_update_fw(struct device *cdev,
                return -EINPROGRESS;
        pm8001_ha->fw_status = FLASH_IN_PROGRESS;
 
-       cmd_ptr = kzalloc(count*2, GFP_KERNEL);
+       cmd_ptr = kcalloc(count, 2, GFP_KERNEL);
        if (!cmd_ptr) {
                pm8001_ha->fw_status = FAIL_OUT_MEMORY;
                return -ENOMEM;
index 95530393872d5f6bcecdeeec3c3f8e47c62463f8..4e86994e10e81f4c41a2617ce8660e97ee772e66 100644 (file)
@@ -4873,8 +4873,9 @@ static int pmcraid_allocate_config_buffers(struct pmcraid_instance *pinstance)
        int i;
 
        pinstance->res_entries =
-                       kzalloc(sizeof(struct pmcraid_resource_entry) *
-                               PMCRAID_MAX_RESOURCES, GFP_KERNEL);
+                       kcalloc(PMCRAID_MAX_RESOURCES,
+                               sizeof(struct pmcraid_resource_entry),
+                               GFP_KERNEL);
 
        if (NULL == pinstance->res_entries) {
                pmcraid_err("failed to allocate memory for resource table\n");
index 32ee7f62fef973abdbee2341b170d0c2c65282aa..cf274a79e77aac86d338d358a71a753636002812 100644 (file)
@@ -524,7 +524,7 @@ static int qedi_init_id_tbl(struct qedi_portid_tbl *id_tbl, u16 size,
        id_tbl->max = size;
        id_tbl->next = next;
        spin_lock_init(&id_tbl->lock);
-       id_tbl->table = kzalloc(DIV_ROUND_UP(size, 32) * 4, GFP_KERNEL);
+       id_tbl->table = kcalloc(DIV_ROUND_UP(size, 32), 4, GFP_KERNEL);
        if (!id_tbl->table)
                return -ENOMEM;
 
index 1aa3720ea2ed582ef9b451506a8c83225bd0fa66..fbbb328c64d57cd3c0ea3f2dd71e6623274314cf 100644 (file)
@@ -3089,8 +3089,9 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
                        req->num_outstanding_cmds = ha->cur_fw_iocb_count;
        }
 
-       req->outstanding_cmds = kzalloc(sizeof(srb_t *) *
-           req->num_outstanding_cmds, GFP_KERNEL);
+       req->outstanding_cmds = kcalloc(req->num_outstanding_cmds,
+                                       sizeof(srb_t *),
+                                       GFP_KERNEL);
 
        if (!req->outstanding_cmds) {
                /*
@@ -3098,8 +3099,9 @@ qla2x00_alloc_outstanding_cmds(struct qla_hw_data *ha, struct req_que *req)
                 * initialization.
                 */
                req->num_outstanding_cmds = MIN_OUTSTANDING_COMMANDS;
-               req->outstanding_cmds = kzalloc(sizeof(srb_t *) *
-                   req->num_outstanding_cmds, GFP_KERNEL);
+               req->outstanding_cmds = kcalloc(req->num_outstanding_cmds,
+                                               sizeof(srb_t *),
+                                               GFP_KERNEL);
 
                if (!req->outstanding_cmds) {
                        ql_log(ql_log_fatal, NULL, 0x0126,
index a3dc83f9444dade9e3a549756dddd23b0d4d852a..d14d3911516d5ff2051436b72dbc293b5da52691 100644 (file)
@@ -3434,8 +3434,9 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
                            "Adjusted Max no of queues pairs: %d.\n", ha->max_qpairs);
                }
        }
-       ha->msix_entries = kzalloc(sizeof(struct qla_msix_entry) *
-                               ha->msix_count, GFP_KERNEL);
+       ha->msix_entries = kcalloc(ha->msix_count,
+                                  sizeof(struct qla_msix_entry),
+                                  GFP_KERNEL);
        if (!ha->msix_entries) {
                ql_log(ql_log_fatal, vha, 0x00c8,
                    "Failed to allocate memory for ha->msix_entries.\n");
index 817c18a8e84d0b3e508d224fe6db442a8c93ea34..e881fce7477a90956a4d45b856e484d89821b9e4 100644 (file)
@@ -410,7 +410,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, struct req_que *req,
                                struct rsp_que *rsp)
 {
        scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
-       ha->req_q_map = kzalloc(sizeof(struct req_que *) * ha->max_req_queues,
+       ha->req_q_map = kcalloc(ha->max_req_queues, sizeof(struct req_que *),
                                GFP_KERNEL);
        if (!ha->req_q_map) {
                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,
                goto fail_req_map;
        }
 
-       ha->rsp_q_map = kzalloc(sizeof(struct rsp_que *) * ha->max_rsp_queues,
+       ha->rsp_q_map = kcalloc(ha->max_rsp_queues, sizeof(struct rsp_que *),
                                GFP_KERNEL);
        if (!ha->rsp_q_map) {
                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,
            (*rsp)->ring);
        /* Allocate memory for NVRAM data for vports */
        if (ha->nvram_npiv_size) {
-               ha->npiv_info = kzalloc(sizeof(struct qla_npiv_entry) *
-                   ha->nvram_npiv_size, GFP_KERNEL);
+               ha->npiv_info = kcalloc(ha->nvram_npiv_size,
+                                       sizeof(struct qla_npiv_entry),
+                                       GFP_KERNEL);
                if (!ha->npiv_info) {
                        ql_log_pci(ql_log_fatal, ha->pdev, 0x002d,
                            "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,
        INIT_LIST_HEAD(&ha->vp_list);
 
        /* Allocate memory for our loop_id bitmap */
-       ha->loop_id_map = kzalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE) * sizeof(long),
-           GFP_KERNEL);
+       ha->loop_id_map = kcalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE),
+                                 sizeof(long),
+                                 GFP_KERNEL);
        if (!ha->loop_id_map)
                goto fail_loop_id_map;
        else {
index b85c833099fffe34aa532a03dcfd3c2bbf257ecc..0fea2e2326becbf4993dd7cc216e36dad529d678 100644 (file)
@@ -6248,8 +6248,9 @@ int qlt_add_target(struct qla_hw_data *ha, struct scsi_qla_host *base_vha)
                return -ENOMEM;
        }
 
-       tgt->qphints = kzalloc((ha->max_qpairs + 1) *
-           sizeof(struct qla_qpair_hint), GFP_KERNEL);
+       tgt->qphints = kcalloc(ha->max_qpairs + 1,
+                              sizeof(struct qla_qpair_hint),
+                              GFP_KERNEL);
        if (!tgt->qphints) {
                kfree(tgt);
                ql_log(ql_log_warn, base_vha, 0x0197,
@@ -7089,8 +7090,9 @@ qlt_mem_alloc(struct qla_hw_data *ha)
        if (!QLA_TGT_MODE_ENABLED())
                return 0;
 
-       ha->tgt.tgt_vp_map = kzalloc(sizeof(struct qla_tgt_vp_map) *
-           MAX_MULTI_ID_FABRIC, GFP_KERNEL);
+       ha->tgt.tgt_vp_map = kcalloc(MAX_MULTI_ID_FABRIC,
+                                    sizeof(struct qla_tgt_vp_map),
+                                    GFP_KERNEL);
        if (!ha->tgt.tgt_vp_map)
                return -ENOMEM;
 
index 656c98e116a902da2c230c2026d3b2632548e2f6..798a6afa4cbf86eccbe5600c3c1a086185413a56 100644 (file)
@@ -3450,7 +3450,7 @@ static int resp_comp_write(struct scsi_cmnd *scp,
                return check_condition_result;
        }
        dnum = 2 * num;
-       arr = kzalloc(dnum * lb_size, GFP_ATOMIC);
+       arr = kcalloc(lb_size, dnum, GFP_ATOMIC);
        if (NULL == arr) {
                mk_sense_buffer(scp, ILLEGAL_REQUEST, INSUFF_RES_ASC,
                                INSUFF_RES_ASCQ);
index 62f04c0511cfe9cb95ccd1eb36e202fb11da6334..0fc39224ce1e4f10c81db98ab01650215e2d44c8 100644 (file)
@@ -747,7 +747,7 @@ static int ses_intf_add(struct device *cdev,
                buf = NULL;
        }
 page2_not_supported:
-       scomp = kzalloc(sizeof(struct ses_component) * components, GFP_KERNEL);
+       scomp = kcalloc(components, sizeof(struct ses_component), GFP_KERNEL);
        if (!scomp)
                goto err_free;
 
index 573763908562836e0770671805701518ab1a599b..53ae52dbff84afd2021e80b7c1329cb7c53117c2 100644 (file)
@@ -1045,7 +1045,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
                else {
                        sg_req_info_t *rinfo;
 
-                       rinfo = kzalloc(SZ_SG_REQ_INFO * SG_MAX_QUEUE,
+                       rinfo = kcalloc(SG_MAX_QUEUE, SZ_SG_REQ_INFO,
                                        GFP_KERNEL);
                        if (!rinfo)
                                return -ENOMEM;
index 8332f958cc42d44bc5992683704010caa1342a11..b78d20b74ed8e31c5ee2c4cb523e91b39bda7441 100644 (file)
@@ -4252,8 +4252,9 @@ static int pqi_alloc_io_resources(struct pqi_ctrl_info *ctrl_info)
        struct device *dev;
        struct pqi_io_request *io_request;
 
-       ctrl_info->io_request_pool = kzalloc(ctrl_info->max_io_slots *
-               sizeof(ctrl_info->io_request_pool[0]), GFP_KERNEL);
+       ctrl_info->io_request_pool =
+               kcalloc(ctrl_info->max_io_slots,
+                       sizeof(ctrl_info->io_request_pool[0]), GFP_KERNEL);
 
        if (!ctrl_info->io_request_pool) {
                dev_err(&ctrl_info->pci_dev->dev,
index c16e4de3a03fdceed284e73c9020bb231efb341c..50c66ccc4b41eaa836ea08d5dfdda2c9206545e2 100644 (file)
@@ -3888,7 +3888,7 @@ static struct st_buffer *new_tape_buffer(int need_dma, int max_sg)
        tb->dma = need_dma;
        tb->buffer_size = 0;
 
-       tb->reserved_pages = kzalloc(max_sg * sizeof(struct page *),
+       tb->reserved_pages = kcalloc(max_sg, sizeof(struct page *),
                                     GFP_KERNEL);
        if (!tb->reserved_pages) {
                kfree(tb);
index 7442bc130055c3745e02a7a1e4503742335513b5..eeb028b9cdb39ae495cd1b6dc6ba4a34361fadf4 100644 (file)
@@ -249,7 +249,7 @@ static int __init sh_clk_div_register_ops(struct clk *clks, int nr,
        int k;
 
        freq_table_size *= (nr_divs + 1);
-       freq_table = kzalloc(freq_table_size * nr, GFP_KERNEL);
+       freq_table = kcalloc(nr, freq_table_size, GFP_KERNEL);
        if (!freq_table) {
                pr_err("%s: unable to alloc memory\n", __func__);
                return -ENOMEM;
index 8e72bcbd3d6d4b4da15f716d74cd89be8906b0a3..46f0f322d4d8f7d4c2b4d373d74da5d58c8774d5 100644 (file)
@@ -203,7 +203,7 @@ int __init register_intc_controller(struct intc_desc *desc)
 
        if (desc->num_resources) {
                d->nr_windows = desc->num_resources;
-               d->window = kzalloc(d->nr_windows * sizeof(*d->window),
+               d->window = kcalloc(d->nr_windows, sizeof(*d->window),
                                    GFP_NOWAIT);
                if (!d->window)
                        goto err1;
@@ -230,12 +230,12 @@ int __init register_intc_controller(struct intc_desc *desc)
        d->nr_reg += hw->ack_regs ? hw->nr_ack_regs : 0;
        d->nr_reg += hw->subgroups ? hw->nr_subgroups : 0;
 
-       d->reg = kzalloc(d->nr_reg * sizeof(*d->reg), GFP_NOWAIT);
+       d->reg = kcalloc(d->nr_reg, sizeof(*d->reg), GFP_NOWAIT);
        if (!d->reg)
                goto err2;
 
 #ifdef CONFIG_SMP
-       d->smp = kzalloc(d->nr_reg * sizeof(*d->smp), GFP_NOWAIT);
+       d->smp = kcalloc(d->nr_reg, sizeof(*d->smp), GFP_NOWAIT);
        if (!d->smp)
                goto err3;
 #endif
@@ -253,7 +253,7 @@ int __init register_intc_controller(struct intc_desc *desc)
        }
 
        if (hw->prio_regs) {
-               d->prio = kzalloc(hw->nr_vectors * sizeof(*d->prio),
+               d->prio = kcalloc(hw->nr_vectors, sizeof(*d->prio),
                                  GFP_NOWAIT);
                if (!d->prio)
                        goto err4;
@@ -269,7 +269,7 @@ int __init register_intc_controller(struct intc_desc *desc)
        }
 
        if (hw->sense_regs) {
-               d->sense = kzalloc(hw->nr_vectors * sizeof(*d->sense),
+               d->sense = kcalloc(hw->nr_vectors, sizeof(*d->sense),
                                   GFP_NOWAIT);
                if (!d->sense)
                        goto err5;
index 7525039d812cebdc44f8d6f2f41e37355cdda742..2e45988d1259c9cf0573cb00604c97d86218e83b 100644 (file)
@@ -161,7 +161,7 @@ int maple_add_packet(struct maple_device *mdev, u32 function, u32 command,
        void *sendbuf = NULL;
 
        if (length) {
-               sendbuf = kzalloc(length * 4, GFP_KERNEL);
+               sendbuf = kcalloc(length, 4, GFP_KERNEL);
                if (!sendbuf) {
                        ret = -ENOMEM;
                        goto out;
index bb36a8fbc9b1bcc2ee8311de86b197e62f179be6..db1f5135846aac611a4da17454f406581fd35124 100644 (file)
@@ -540,7 +540,7 @@ static int qcom_slim_probe(struct platform_device *pdev)
        ctrl->tx.sl_sz = SLIM_MSGQ_BUF_LEN;
        ctrl->rx.n = QCOM_RX_MSGS;
        ctrl->rx.sl_sz = SLIM_MSGQ_BUF_LEN;
-       ctrl->wr_comp = kzalloc(sizeof(struct completion *) * QCOM_TX_MSGS,
+       ctrl->wr_comp = kcalloc(QCOM_TX_MSGS, sizeof(struct completion *),
                                GFP_KERNEL);
        if (!ctrl->wr_comp)
                return -ENOMEM;
index 2d9ab2620b82df501095a90e7e420097b2dee254..04b1a095038761f2c6adcb8a08dad0b5501ff085 100644 (file)
@@ -143,7 +143,7 @@ static int rt2880_pinctrl_dt_node_to_map(struct pinctrl_dev *pctrldev,
        if (!max_maps)
                return max_maps;
 
-       *map = kzalloc(max_maps * sizeof(struct pinctrl_map), GFP_KERNEL);
+       *map = kcalloc(max_maps, sizeof(struct pinctrl_map), GFP_KERNEL);
        if (!*map)
                return -ENOMEM;
 
index d7c7d146a84de25725f9da8e1459cffb028155fa..1dc71455f270c5539fe2aaff39a07becc9cd8560 100644 (file)
@@ -237,8 +237,8 @@ void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf)
        }
 
        /* allocate memory for efuse_tbl and efuse_word */
-       efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE] *
-                           sizeof(u8), GFP_ATOMIC);
+       efuse_tbl = kzalloc(rtlpriv->cfg->maps[EFUSE_HWSET_MAX_SIZE],
+                           GFP_ATOMIC);
        if (!efuse_tbl)
                return;
        efuse_word = kcalloc(EFUSE_MAX_WORD_UNIT, sizeof(u16 *), GFP_ATOMIC);
index 167e98f8688e01008fe9be1f913a5de41a61ed0c..4fc521c51c0e8d639a54ff6d1c6799f97361f16d 100644 (file)
@@ -865,7 +865,7 @@ static void do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp,
                if (cmdrsp->scsi.no_disk_result == 0)
                        return;
 
-               buf = kzalloc(sizeof(char) * 36, GFP_KERNEL);
+               buf = kzalloc(36, GFP_KERNEL);
                if (!buf)
                        return;
 
index f0e8f0f4ccb4fc21f7cf419d64a319a8be394b00..efe8214f2df32853498804e9cdb31be980fc9cab 100644 (file)
@@ -250,7 +250,7 @@ int transport_alloc_session_tags(struct se_session *se_sess,
 {
        int rc;
 
-       se_sess->sess_cmd_map = kzalloc(tag_num * tag_size,
+       se_sess->sess_cmd_map = kcalloc(tag_size, tag_num,
                                        GFP_KERNEL | __GFP_NOWARN | __GFP_RETRY_MAYFAIL);
        if (!se_sess->sess_cmd_map) {
                se_sess->sess_cmd_map = vzalloc(tag_num * tag_size);
index 94b183efd23626188388bba10cc98f258287b229..7f96dfa32b9cdf1cbf167fe1b0581e3b94f1a08b 100644 (file)
@@ -1717,8 +1717,9 @@ static int tcmu_configure_device(struct se_device *dev)
 
        info = &udev->uio_info;
 
-       udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) *
-                                   sizeof(unsigned long), GFP_KERNEL);
+       udev->data_bitmap = kcalloc(BITS_TO_LONGS(udev->max_blocks),
+                                   sizeof(unsigned long),
+                                   GFP_KERNEL);
        if (!udev->data_bitmap) {
                ret = -ENOMEM;
                goto err_bitmap_alloc;
index c719167e9f2829dedea376e21b51a773559e5866..45e7e5cbdffb438648869b2ebd236b906ad82933 100644 (file)
@@ -96,7 +96,7 @@ int acpi_parse_trt(acpi_handle handle, int *trt_count, struct trt **trtp,
        }
 
        *trt_count = p->package.count;
-       trts = kzalloc(*trt_count * sizeof(struct trt), GFP_KERNEL);
+       trts = kcalloc(*trt_count, sizeof(struct trt), GFP_KERNEL);
        if (!trts) {
                result = -ENOMEM;
                goto end;
@@ -178,7 +178,7 @@ int acpi_parse_art(acpi_handle handle, int *art_count, struct art **artp,
 
        /* ignore p->package.elements[0], as this is _ART Revision field */
        *art_count = p->package.count - 1;
-       arts = kzalloc(*art_count * sizeof(struct art), GFP_KERNEL);
+       arts = kcalloc(*art_count, sizeof(struct art), GFP_KERNEL);
        if (!arts) {
                result = -ENOMEM;
                goto end;
index 145a5c53ff5c0fd16c579352124394ece156c0eb..953c83967ceb533984e650660c06faeabbcac1e1 100644 (file)
@@ -239,9 +239,10 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
        if (ACPI_FAILURE(status))
                trip_cnt = 0;
        else {
-               int34x_thermal_zone->aux_trips = kzalloc(
-                               sizeof(*int34x_thermal_zone->aux_trips) *
-                               trip_cnt, GFP_KERNEL);
+               int34x_thermal_zone->aux_trips =
+                       kcalloc(trip_cnt,
+                               sizeof(*int34x_thermal_zone->aux_trips),
+                               GFP_KERNEL);
                if (!int34x_thermal_zone->aux_trips) {
                        ret = -ENOMEM;
                        goto err_trip_alloc;
index e09f0354a4bc378488d522a27ab215909388d1a5..5798420ac29cbf241aad267a063b1a582d11ced8 100644 (file)
@@ -870,7 +870,7 @@ __init *thermal_of_build_thermal_zone(struct device_node *np)
        if (tz->ntrips == 0) /* must have at least one child */
                goto finish;
 
-       tz->trips = kzalloc(tz->ntrips * sizeof(*tz->trips), GFP_KERNEL);
+       tz->trips = kcalloc(tz->ntrips, sizeof(*tz->trips), GFP_KERNEL);
        if (!tz->trips) {
                ret = -ENOMEM;
                goto free_tz;
@@ -896,7 +896,7 @@ __init *thermal_of_build_thermal_zone(struct device_node *np)
        if (tz->num_tbps == 0)
                goto finish;
 
-       tz->tbps = kzalloc(tz->num_tbps * sizeof(*tz->tbps), GFP_KERNEL);
+       tz->tbps = kcalloc(tz->num_tbps, sizeof(*tz->tbps), GFP_KERNEL);
        if (!tz->tbps) {
                ret = -ENOMEM;
                goto free_trips;
index 1a6c88b10a396e37ee8ff7a429752fdffd4b9a50..1ef937d799e4f3d200dbfe9fb5a3dc2b08fd1d21 100644 (file)
@@ -516,7 +516,8 @@ static int __init pkg_temp_thermal_init(void)
                return -ENODEV;
 
        max_packages = topology_max_packages();
-       packages = kzalloc(max_packages * sizeof(struct pkg_device *), GFP_KERNEL);
+       packages = kcalloc(max_packages, sizeof(struct pkg_device *),
+                          GFP_KERNEL);
        if (!packages)
                return -ENOMEM;
 
index 47ac56817c43f53ff78faa5c12b79a3e8788d4ed..eea4049b5dcc67836ec99f2f25faa8c4a24ccd4d 100644 (file)
@@ -754,7 +754,7 @@ static int __init ehv_bc_init(void)
         * array, then you can use pointer math (e.g. "bc - bcs") to get its
         * tty index.
         */
-       bcs = kzalloc(count * sizeof(struct ehv_bc_data), GFP_KERNEL);
+       bcs = kcalloc(count, sizeof(struct ehv_bc_data), GFP_KERNEL);
        if (!bcs)
                return -ENOMEM;
 
index 1c1bd0afcd489e5eef35d6c4b32a8d018e1cc25c..37caba7c3affda7c32a76513f5a31518ca3572a8 100644 (file)
@@ -245,8 +245,9 @@ static int goldfish_tty_create_driver(void)
        int ret;
        struct tty_driver *tty;
 
-       goldfish_ttys = kzalloc(sizeof(*goldfish_ttys) *
-                               goldfish_tty_line_count, GFP_KERNEL);
+       goldfish_ttys = kcalloc(goldfish_tty_line_count,
+                               sizeof(*goldfish_ttys),
+                               GFP_KERNEL);
        if (goldfish_ttys == NULL) {
                ret = -ENOMEM;
                goto err_alloc_goldfish_ttys_failed;
index a74680729825ee1fba8f4c85fa2c8f3ef231650b..2af1e5751bd6302463a397cedd68bdccb23d8313 100644 (file)
@@ -1252,7 +1252,7 @@ static int hvc_iucv_setup_filter(const char *val)
        if (size > MAX_VMID_FILTER)
                return -ENOSPC;
 
-       array = kzalloc(size * 8, GFP_KERNEL);
+       array = kcalloc(size, 8, GFP_KERNEL);
        if (!array)
                return -ENOMEM;
 
index 760d5dd0aada2e34b198c70727741c671ed0ad16..cb85002a10d8d16c9c0b4ec5bc70c1994822e25a 100644 (file)
@@ -991,7 +991,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv)
 
        priv->tx_dma_use = 1;
 
-       priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
+       priv->sg_tx_p = kcalloc(num, sizeof(struct scatterlist), GFP_ATOMIC);
        if (!priv->sg_tx_p) {
                dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__);
                return 0;
index 890b8832aff20e053567654299379e9a7ec19d84..9c14a453f73c0e8365610809ba742cdd3085311b 100644 (file)
@@ -2445,7 +2445,7 @@ int uart_register_driver(struct uart_driver *drv)
         * Maybe we should be using a slab cache for this, especially if
         * we have a large number of ports to handle.
         */
-       drv->state = kzalloc(sizeof(struct uart_state) * drv->nr, GFP_KERNEL);
+       drv->state = kcalloc(drv->nr, sizeof(struct uart_state), GFP_KERNEL);
        if (!drv->state)
                goto out;
 
index b93d0225f8c957f97ea1e5ba42fda53829ee54f0..72131b5e132eba262ef67d8bf1e94f18ab05fdda 100644 (file)
@@ -1125,8 +1125,9 @@ static int __init sunsab_init(void)
        }
 
        if (num_channels) {
-               sunsab_ports = kzalloc(sizeof(struct uart_sunsab_port) *
-                                      num_channels, GFP_KERNEL);
+               sunsab_ports = kcalloc(num_channels,
+                                      sizeof(struct uart_sunsab_port),
+                                      GFP_KERNEL);
                if (!sunsab_ports)
                        return -ENOMEM;
 
index 31d5b1d3b5af69a7344653f83c4b07cc99293f12..91aea8823af55ff0e992df9c35e3555995ba14ba 100644 (file)
@@ -129,7 +129,7 @@ static int pruss_probe(struct platform_device *pdev)
        if (!gdev)
                return -ENOMEM;
 
-       gdev->info = kzalloc(sizeof(*p) * MAX_PRUSS_EVT, GFP_KERNEL);
+       gdev->info = kcalloc(MAX_PRUSS_EVT, sizeof(*p), GFP_KERNEL);
        if (!gdev->info) {
                kfree(gdev);
                return -ENOMEM;
index 26c2438d288933c6818d1f36f28b3b9b35e88912..fcae521df29b8de4712e92de725c575f298f567a 100644 (file)
@@ -1376,7 +1376,7 @@ static int hub_configure(struct usb_hub *hub,
        dev_info(hub_dev, "%d port%s detected\n", maxchild,
                        (maxchild == 1) ? "" : "s");
 
-       hub->ports = kzalloc(maxchild * sizeof(struct usb_port *), GFP_KERNEL);
+       hub->ports = kcalloc(maxchild, sizeof(struct usb_port *), GFP_KERNEL);
        if (!hub->ports) {
                ret = -ENOMEM;
                goto fail;
index 1faefea16cecdb8320774eb4760d9524e7aec499..edaf0b6af4f0491ba192d346c29a792a06a85751 100644 (file)
@@ -5079,13 +5079,14 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
        dev_dbg(hsotg->dev, "hcfg=%08x\n", hcfg);
 
 #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
-       hsotg->frame_num_array = kzalloc(sizeof(*hsotg->frame_num_array) *
-                                        FRAME_NUM_ARRAY_SIZE, GFP_KERNEL);
+       hsotg->frame_num_array = kcalloc(FRAME_NUM_ARRAY_SIZE,
+                                        sizeof(*hsotg->frame_num_array),
+                                        GFP_KERNEL);
        if (!hsotg->frame_num_array)
                goto error1;
-       hsotg->last_frame_num_array = kzalloc(
-                       sizeof(*hsotg->last_frame_num_array) *
-                       FRAME_NUM_ARRAY_SIZE, GFP_KERNEL);
+       hsotg->last_frame_num_array =
+               kcalloc(FRAME_NUM_ARRAY_SIZE,
+                       sizeof(*hsotg->last_frame_num_array), GFP_KERNEL);
        if (!hsotg->last_frame_num_array)
                goto error1;
 #endif
index 03149b9d7ea719748c9d153cc03d9d03dad9bd08..a4d9b5e1e50ea09747edc4b1bb0a4fadf7b440d8 100644 (file)
@@ -138,9 +138,9 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
                __func__, ep, num_tabs);
 
        /* Allocate memory for table array */
-       ep->bd_list.bd_table_array = kzalloc(
-                                       num_tabs * sizeof(struct bd_table *),
-                                       GFP_ATOMIC);
+       ep->bd_list.bd_table_array = kcalloc(num_tabs,
+                                            sizeof(struct bd_table *),
+                                            GFP_ATOMIC);
        if (!ep->bd_list.bd_table_array)
                return -ENOMEM;
 
index 9a3f7db26a5efb1569fd2a12261a7e8ae63d6923..be59309e848c335fafc8301eaec211f3fec9657e 100644 (file)
@@ -2246,7 +2246,7 @@ static int struct_udc_setup(struct fsl_udc *udc,
        pdata = dev_get_platdata(&pdev->dev);
        udc->phy_mode = pdata->phy_mode;
 
-       udc->eps = kzalloc(sizeof(struct fsl_ep) * udc->max_ep, GFP_KERNEL);
+       udc->eps = kcalloc(udc->max_ep, sizeof(struct fsl_ep), GFP_KERNEL);
        if (!udc->eps)
                return -1;
 
index e56db44708bccd86ac43a870d51fc039224305c8..1d87295682b8ee17e5e697fd861620326fba53f7 100644 (file)
@@ -117,8 +117,9 @@ static struct ehci_tt *find_tt(struct usb_device *udev)
        if (utt->multi) {
                tt_index = utt->hcpriv;
                if (!tt_index) {                /* Create the index array */
-                       tt_index = kzalloc(utt->hub->maxchild *
-                                       sizeof(*tt_index), GFP_ATOMIC);
+                       tt_index = kcalloc(utt->hub->maxchild,
+                                          sizeof(*tt_index),
+                                          GFP_ATOMIC);
                        if (!tt_index)
                                return ERR_PTR(-ENOMEM);
                        utt->hcpriv = tt_index;
index 3a8bbfe43a8eaa25d947469a719ffd7abd44c085..6e3dad19d3696a78054bc809c25ef7c7d6d294a0 100644 (file)
@@ -741,8 +741,8 @@ static int imx21_hc_urb_enqueue_isoc(struct usb_hcd *hcd,
        if (urb_priv == NULL)
                return -ENOMEM;
 
-       urb_priv->isoc_td = kzalloc(
-               sizeof(struct td) * urb->number_of_packets, mem_flags);
+       urb_priv->isoc_td = kcalloc(urb->number_of_packets, sizeof(struct td),
+                                   mem_flags);
        if (urb_priv->isoc_td == NULL) {
                ret = -ENOMEM;
                goto alloc_td_failed;
index 34e866ad4a81bfbf2fb90d5b904117735227b1e0..ad2c082bd0fb6bd657c1ebaccc2f49b5c5306425 100644 (file)
@@ -1024,7 +1024,8 @@ static long mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg
                        return -EINVAL;
 
                size = CHUNK_ALIGN(arg);
-               vec = kzalloc(sizeof(struct mon_pgmap) * (size / CHUNK_SIZE), GFP_KERNEL);
+               vec = kcalloc(size / CHUNK_SIZE, sizeof(struct mon_pgmap),
+                             GFP_KERNEL);
                if (vec == NULL) {
                        ret = -ENOMEM;
                        break;
index 34ee9ebe12a377c5d7ce7fa51fc4b9ff467a97c1..33d059c40616ea604fdb5417c611cfc7a1126f00 100644 (file)
@@ -1068,7 +1068,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
        if (!gpriv)
                return -ENOMEM;
 
-       uep = kzalloc(sizeof(struct usbhsg_uep) * pipe_size, GFP_KERNEL);
+       uep = kcalloc(pipe_size, sizeof(struct usbhsg_uep), GFP_KERNEL);
        if (!uep) {
                ret = -ENOMEM;
                goto usbhs_mod_gadget_probe_err_gpriv;
index 9677e0e31475e46cb6267d8f07bb183d96abb5f9..c4922b96c93bcec16e3b60010eed556306914d6c 100644 (file)
@@ -803,7 +803,8 @@ int usbhs_pipe_probe(struct usbhs_priv *priv)
                return -EINVAL;
        }
 
-       info->pipe = kzalloc(sizeof(struct usbhs_pipe) * pipe_size, GFP_KERNEL);
+       info->pipe = kcalloc(pipe_size, sizeof(struct usbhs_pipe),
+                            GFP_KERNEL);
        if (!info->pipe)
                return -ENOMEM;
 
index d0f1a66984607dd0a5ddbfb5d0969709565dc0ea..38884aac862b99f820a9f5fc45813fc02ade7bd6 100644 (file)
@@ -470,7 +470,8 @@ error:
 int wa_rpipes_create(struct wahc *wa)
 {
        wa->rpipes = le16_to_cpu(wa->wa_descr->wNumRPipes);
-       wa->rpipe_bm = kzalloc(BITS_TO_LONGS(wa->rpipes)*sizeof(unsigned long),
+       wa->rpipe_bm = kcalloc(BITS_TO_LONGS(wa->rpipes),
+                              sizeof(unsigned long),
                               GFP_KERNEL);
        if (wa->rpipe_bm == NULL)
                return -ENOMEM;
index ce10eb75b04240bf88d6a4d5fe8f38c8c74f741d..17fcd3b2e68668ec12e51680dde8a04673979555 100644 (file)
@@ -1685,22 +1685,25 @@ static int vhost_scsi_nexus_cb(struct se_portal_group *se_tpg,
        for (i = 0; i < VHOST_SCSI_DEFAULT_TAGS; i++) {
                tv_cmd = &((struct vhost_scsi_cmd *)se_sess->sess_cmd_map)[i];
 
-               tv_cmd->tvc_sgl = kzalloc(sizeof(struct scatterlist) *
-                                       VHOST_SCSI_PREALLOC_SGLS, GFP_KERNEL);
+               tv_cmd->tvc_sgl = kcalloc(VHOST_SCSI_PREALLOC_SGLS,
+                                         sizeof(struct scatterlist),
+                                         GFP_KERNEL);
                if (!tv_cmd->tvc_sgl) {
                        pr_err("Unable to allocate tv_cmd->tvc_sgl\n");
                        goto out;
                }
 
-               tv_cmd->tvc_upages = kzalloc(sizeof(struct page *) *
-                               VHOST_SCSI_PREALLOC_UPAGES, GFP_KERNEL);
+               tv_cmd->tvc_upages = kcalloc(VHOST_SCSI_PREALLOC_UPAGES,
+                                            sizeof(struct page *),
+                                            GFP_KERNEL);
                if (!tv_cmd->tvc_upages) {
                        pr_err("Unable to allocate tv_cmd->tvc_upages\n");
                        goto out;
                }
 
-               tv_cmd->tvc_prot_sgl = kzalloc(sizeof(struct scatterlist) *
-                               VHOST_SCSI_PREALLOC_PROT_SGLS, GFP_KERNEL);
+               tv_cmd->tvc_prot_sgl = kcalloc(VHOST_SCSI_PREALLOC_PROT_SGLS,
+                                              sizeof(struct scatterlist),
+                                              GFP_KERNEL);
                if (!tv_cmd->tvc_prot_sgl) {
                        pr_err("Unable to allocate tv_cmd->tvc_prot_sgl\n");
                        goto out;
index 08b822656846cca9072d40f40ea090635c75f1ab..ff45dca3ee46ab3faf3bc1452665708fdc9920af 100644 (file)
@@ -649,7 +649,7 @@ static void *sti_bmode_font_raw(struct sti_cooked_font *f)
        unsigned char *n, *p, *q;
        int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font);
        
-       n = kzalloc(4*size, STI_LOWMEM);
+       n = kcalloc(4, size, STI_LOWMEM);
        if (!n)
                return NULL;
        p = n + 3;
index 9f9a7bef1ff6d46d80fe8cb6dcfeea5a3e26729d..d6ba348deb9fbd74935d0fd2c3aec59785428b64 100644 (file)
@@ -617,7 +617,7 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par,
        int tail_start_addr;
        int start_sector_addr;
 
-       sector_buffer = kzalloc(sizeof(char)*sector_size, GFP_KERNEL);
+       sector_buffer = kzalloc(sector_size, GFP_KERNEL);
        if (!sector_buffer)
                return -ENOMEM;
 
index 522cf441842c08af3ac527e7e0ca9e564db723d2..852d86c1c527ac26c3987d18d379108849f8060b 100644 (file)
@@ -620,7 +620,7 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize,
        int num = 0, i, first = 1;
        int ver, rev;
 
-       mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL);
+       mode = kcalloc(50, sizeof(struct fb_videomode), GFP_KERNEL);
        if (mode == NULL)
                return NULL;
 
@@ -1055,8 +1055,9 @@ void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
        if (!(num + svd_n))
                return;
 
-       m = kzalloc((specs->modedb_len + num + svd_n) *
-                      sizeof(struct fb_videomode), GFP_KERNEL);
+       m = kcalloc(specs->modedb_len + num + svd_n,
+                   sizeof(struct fb_videomode),
+                   GFP_KERNEL);
 
        if (!m)
                return;
index 92279e02dd94bdd4952b79cf31f6e5fad44dfb58..f27697e07c55349442e985f90ecb030f3d5150b7 100644 (file)
@@ -493,8 +493,8 @@ static int modes_setup(struct mmpfb_info *fbi)
                return 0;
        }
        /* put videomode list to info structure */
-       videomodes = kzalloc(sizeof(struct fb_videomode) * videomode_num,
-                       GFP_KERNEL);
+       videomodes = kcalloc(videomode_num, sizeof(struct fb_videomode),
+                            GFP_KERNEL);
        if (!videomodes) {
                dev_err(fbi->dev, "can't malloc video modes\n");
                return -ENOMEM;
index 69f86d2cc274db90070abccbe248b3924adab7fd..d21c641e1f3c8008e41a752ad66eb131a6c02822 100644 (file)
@@ -42,8 +42,8 @@ int dss_init_overlay_managers(void)
 
        num_managers = dss_feat_get_num_mgrs();
 
-       managers = kzalloc(sizeof(struct omap_overlay_manager) * num_managers,
-                       GFP_KERNEL);
+       managers = kcalloc(num_managers, sizeof(struct omap_overlay_manager),
+                          GFP_KERNEL);
 
        BUG_ON(managers == NULL);
 
index d6c5d75d2ef8262d6b13f8286ad912dd33dfce4e..be17a4785a5eab20f22197d15ff7d8fd2fd18b29 100644 (file)
@@ -59,8 +59,8 @@ void dss_init_overlays(struct platform_device *pdev)
 
        num_overlays = dss_feat_get_num_ovls();
 
-       overlays = kzalloc(sizeof(struct omap_overlay) * num_overlays,
-                       GFP_KERNEL);
+       overlays = kcalloc(num_overlays, sizeof(struct omap_overlay),
+                          GFP_KERNEL);
 
        BUG_ON(overlays == NULL);
 
index c592ca513115c060e37133c87411efad58bbc1ad..440a6636d8f0a894648efcfbd15f38ea8f80ddea 100644 (file)
@@ -486,8 +486,9 @@ static int uvesafb_vbe_getmodes(struct uvesafb_ktask *task,
                mode++;
        }
 
-       par->vbe_modes = kzalloc(sizeof(struct vbe_mode_ib) *
-                               par->vbe_modes_cnt, GFP_KERNEL);
+       par->vbe_modes = kcalloc(par->vbe_modes_cnt,
+                                sizeof(struct vbe_mode_ib),
+                                GFP_KERNEL);
        if (!par->vbe_modes)
                return -ENOMEM;
 
@@ -858,7 +859,7 @@ static int uvesafb_vbe_init_mode(struct fb_info *info)
         * Convert the modelist into a modedb so that we can use it with
         * fb_find_mode().
         */
-       mode = kzalloc(i * sizeof(*mode), GFP_KERNEL);
+       mode = kcalloc(i, sizeof(*mode), GFP_KERNEL);
        if (mode) {
                i = 0;
                list_for_each(pos, &info->modelist) {
index 83b8963c9657c6a2ff83bb24bbc6f56e1bf6baad..5244e93ceafc5c0b520ad0f849dadf1d70e09dbb 100644 (file)
@@ -181,8 +181,9 @@ struct display_timings *of_get_display_timings(const struct device_node *np)
                goto entryfail;
        }
 
-       disp->timings = kzalloc(sizeof(struct display_timing *) *
-                               disp->num_timings, GFP_KERNEL);
+       disp->timings = kcalloc(disp->num_timings,
+                               sizeof(struct display_timing *),
+                               GFP_KERNEL);
        if (!disp->timings) {
                pr_err("%pOF: could not allocate timings array\n", np);
                goto entryfail;
index 4e05d7f711fefede62fe047ffcfda573dc8f67c7..8ba726e600e9a9c1a17278783f8b95ed0699ff9b 100644 (file)
@@ -223,7 +223,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)
         * 'pages' is an array of struct page pointers that's initialized by
         * get_user_pages().
         */
-       pages = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL);
+       pages = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL);
        if (!pages) {
                pr_debug("fsl-hv: could not allocate page list\n");
                return -ENOMEM;
index a491d0ed3f16a4b1fb2ba7aa5078f087614aa50b..b563a4499cc86346572e23e1257e57cf034c5dc6 100644 (file)
@@ -119,7 +119,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
        if (!vp_dev->msix_names)
                goto error;
        vp_dev->msix_affinity_masks
-               = kzalloc(nvectors * sizeof *vp_dev->msix_affinity_masks,
+               = kcalloc(nvectors, sizeof(*vp_dev->msix_affinity_masks),
                          GFP_KERNEL);
        if (!vp_dev->msix_affinity_masks)
                goto error;
index 85dd20e0572678581ffa03a8ff6b734773230d1e..3e789c77f568dadb3f88070f3a016d726d37eeec 100644 (file)
@@ -70,9 +70,9 @@ static int xen_map_device_mmio(const struct resource *resources,
                if ((resource_type(r) != IORESOURCE_MEM) || (nr == 0))
                        continue;
 
-               gpfns = kzalloc(sizeof(xen_pfn_t) * nr, GFP_KERNEL);
-               idxs = kzalloc(sizeof(xen_ulong_t) * nr, GFP_KERNEL);
-               errs = kzalloc(sizeof(int) * nr, GFP_KERNEL);
+               gpfns = kcalloc(nr, sizeof(xen_pfn_t), GFP_KERNEL);
+               idxs = kcalloc(nr, sizeof(xen_ulong_t), GFP_KERNEL);
+               errs = kcalloc(nr, sizeof(int), GFP_KERNEL);
                if (!gpfns || !idxs || !errs) {
                        kfree(gpfns);
                        kfree(idxs);
index dc062b195c4654820e484fe25ce4ac722a836415..a3fdb4fe967d29cc87a4e2402d7898ddeb3b5670 100644 (file)
@@ -1603,8 +1603,8 @@ static int btrfsic_read_block(struct btrfsic_state *state,
 
        num_pages = (block_ctx->len + (u64)PAGE_SIZE - 1) >>
                    PAGE_SHIFT;
-       block_ctx->mem_to_free = kzalloc((sizeof(*block_ctx->datav) +
-                                         sizeof(*block_ctx->pagev)) *
+       block_ctx->mem_to_free = kcalloc(sizeof(*block_ctx->datav) +
+                                               sizeof(*block_ctx->pagev),
                                         num_pages, GFP_NOFS);
        if (!block_ctx->mem_to_free)
                return -ENOMEM;
index 5aca336642c0acd7cafa9d6a7ef3f80b6cfb0ab9..42329b25877db2b3de349b0ce5723f70bebad92b 100644 (file)
@@ -2077,7 +2077,7 @@ struct cifs_writedata *
 cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete)
 {
        struct page **pages =
-               kzalloc(sizeof(struct page *) * nr_pages, GFP_NOFS);
+               kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
        if (pages)
                return cifs_writedata_direct_alloc(pages, complete);
 
index 87eece6fbd488669c6557c30f3631f29b88e9a01..8d41ca7bfcf1fe8f0eb0e3e8c6272547e09cc16c 100644 (file)
@@ -2900,7 +2900,7 @@ static struct cifs_readdata *
 cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete)
 {
        struct page **pages =
-               kzalloc(sizeof(struct page *) * nr_pages, GFP_KERNEL);
+               kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);
        struct cifs_readdata *ret = NULL;
 
        if (pages) {
index c969275ce3ee7469167a6921e8fa22e4c91ed3a2..0057fe3f248d195736ee58ec40131dadd98d59bb 100644 (file)
@@ -577,7 +577,7 @@ int ext4_ext_precache(struct inode *inode)
        down_read(&ei->i_data_sem);
        depth = ext_depth(inode);
 
-       path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1),
+       path = kcalloc(depth + 1, sizeof(struct ext4_ext_path),
                       GFP_NOFS);
        if (path == NULL) {
                up_read(&ei->i_data_sem);
@@ -879,7 +879,7 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block,
        }
        if (!path) {
                /* account possible depth increase */
-               path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 2),
+               path = kcalloc(depth + 2, sizeof(struct ext4_ext_path),
                                GFP_NOFS);
                if (unlikely(!path))
                        return ERR_PTR(-ENOMEM);
@@ -1063,7 +1063,7 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
         * We need this to handle errors and free blocks
         * upon them.
         */
-       ablocks = kzalloc(sizeof(ext4_fsblk_t) * depth, GFP_NOFS);
+       ablocks = kcalloc(depth, sizeof(ext4_fsblk_t), GFP_NOFS);
        if (!ablocks)
                return -ENOMEM;
 
@@ -2921,7 +2921,7 @@ again:
                        path[k].p_block =
                                le16_to_cpu(path[k].p_hdr->eh_entries)+1;
        } else {
-               path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1),
+               path = kcalloc(depth + 1, sizeof(struct ext4_ext_path),
                               GFP_NOFS);
                if (path == NULL) {
                        ext4_journal_stop(handle);
index c75ad982bcfcc5989a7a3c6afda037599eb5952c..956f2782602682e40937af60d2cc4cd2deb7e1b3 100644 (file)
@@ -461,7 +461,7 @@ ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh,
                fh_count = be32_to_cpup(p);
 
                fls->mirror_array[i]->fh_versions =
-                       kzalloc(fh_count * sizeof(struct nfs_fh),
+                       kcalloc(fh_count, sizeof(struct nfs_fh),
                                gfp_flags);
                if (fls->mirror_array[i]->fh_versions == NULL) {
                        rc = -ENOMEM;
index d62279d3fc5d311f5eacc6eb7618beac70159bf5..59aa04976331be3c7459785cae239fcd22bfd2b7 100644 (file)
@@ -99,7 +99,8 @@ nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev,
        version_count = be32_to_cpup(p);
        dprintk("%s: version count %d\n", __func__, version_count);
 
-       ds_versions = kzalloc(version_count * sizeof(struct nfs4_ff_ds_version),
+       ds_versions = kcalloc(version_count,
+                             sizeof(struct nfs4_ff_ds_version),
                              gfp_flags);
        if (!ds_versions)
                goto out_scratch;
index 8ceb25a10ea0df002cae637d137d0f0e0d55a93b..a1143f7c220153c0809cb8dd43da895a685fe98b 100644 (file)
@@ -404,8 +404,9 @@ fsloc_parse(char **mesg, char *buf, struct nfsd4_fs_locations *fsloc)
        if (fsloc->locations_count == 0)
                return 0;
 
-       fsloc->locations = kzalloc(fsloc->locations_count
-                       * sizeof(struct nfsd4_fs_location), GFP_KERNEL);
+       fsloc->locations = kcalloc(fsloc->locations_count,
+                                  sizeof(struct nfsd4_fs_location),
+                                  GFP_KERNEL);
        if (!fsloc->locations)
                return -ENOMEM;
        for (i=0; i < fsloc->locations_count; i++) {
index e5dcea6cee5ff678b33e78083c7240ddc56e3500..bd3475694e83a06501a055e73fd1403f81123eef 100644 (file)
@@ -1383,7 +1383,7 @@ static int __ocfs2_recovery_thread(void *arg)
                goto bail;
        }
 
-       rm_quota = kzalloc(osb->max_slots * sizeof(int), GFP_NOFS);
+       rm_quota = kcalloc(osb->max_slots, sizeof(int), GFP_NOFS);
        if (!rm_quota) {
                status = -ENOMEM;
                goto bail;
index af155c1831234f7cfef3d4a5d4e0d7b6359f79ed..5965f3878d49be01a92b6276ce88c25be4df21cb 100644 (file)
@@ -69,10 +69,11 @@ static struct inode **get_local_system_inode(struct ocfs2_super *osb,
        spin_unlock(&osb->osb_lock);
 
        if (unlikely(!local_system_inodes)) {
-               local_system_inodes = kzalloc(sizeof(struct inode *) *
-                                             NUM_LOCAL_SYSTEM_INODES *
-                                             osb->max_slots,
-                                             GFP_NOFS);
+               local_system_inodes =
+                       kzalloc(array3_size(sizeof(struct inode *),
+                                           NUM_LOCAL_SYSTEM_INODES,
+                                           osb->max_slots),
+                               GFP_NOFS);
                if (!local_system_inodes) {
                        mlog_errno(-ENOMEM);
                        /*
index 08801b45df00dcb346be697f8a6a407f5afabde0..c993dd8db739df44572fb4c0dcf7882b20ea2eab 100644 (file)
@@ -612,7 +612,7 @@ static int ovl_get_index_name_fh(struct ovl_fh *fh, struct qstr *name)
 {
        char *n, *s;
 
-       n = kzalloc(fh->len * 2, GFP_KERNEL);
+       n = kcalloc(fh->len, 2, GFP_KERNEL);
        if (!n)
                return -ENOMEM;
 
index 4d765e5e91eda8961d3a49fab214dd8736c1e699..89921a0d2ebbcb9b31c361a7b5972480771cf5ad 100644 (file)
@@ -1426,7 +1426,7 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
        /* If there are mixed files and directories we need a new table */
        if (nr_dirs && nr_files) {
                struct ctl_table *new;
-               files = kzalloc(sizeof(struct ctl_table) * (nr_files + 1),
+               files = kcalloc(nr_files + 1, sizeof(struct ctl_table),
                                GFP_KERNEL);
                if (!files)
                        goto out;
index b13fc024d2eed8b3201ae1c6dda226a0031d1e8d..132ec4406ed00733947e9ba8c2fc770de08ec749 100644 (file)
@@ -1044,7 +1044,8 @@ research:
                        if (blocks_needed == 1) {
                                un = &unf_single;
                        } else {
-                               un = kzalloc(min(blocks_needed, max_to_insert) * UNFM_P_SIZE, GFP_NOFS);
+                               un = kcalloc(min(blocks_needed, max_to_insert),
+                                            UNFM_P_SIZE, GFP_NOFS);
                                if (!un) {
                                        un = &unf_single;
                                        blocks_needed = 1;
index 0d27d41f5c6e70e51c12d9d702b8ec32e239bfff..fc77ea736da70b759bc39b3f4af1b51d7372eb55 100644 (file)
@@ -1585,7 +1585,7 @@ static struct udf_vds_record *handle_partition_descriptor(
                struct udf_vds_record *new_loc;
                unsigned int new_size = ALIGN(partnum, PART_DESC_ALLOC_STEP);
 
-               new_loc = kzalloc(sizeof(*new_loc) * new_size, GFP_KERNEL);
+               new_loc = kcalloc(new_size, sizeof(*new_loc), GFP_KERNEL);
                if (!new_loc)
                        return ERR_PTR(-ENOMEM);
                memcpy(new_loc, data->part_descs_loc,
@@ -1644,8 +1644,9 @@ static noinline int udf_process_sequence(
 
        memset(data.vds, 0, sizeof(struct udf_vds_record) * VDS_POS_LENGTH);
        data.size_part_descs = PART_DESC_ALLOC_STEP;
-       data.part_descs_loc = kzalloc(sizeof(*data.part_descs_loc) *
-                                       data.size_part_descs, GFP_KERNEL);
+       data.part_descs_loc = kcalloc(data.size_part_descs,
+                                     sizeof(*data.part_descs_loc),
+                                     GFP_KERNEL);
        if (!data.part_descs_loc)
                return -ENOMEM;
 
index cced0c1e63e2d62f2bd60795e29b6cfbc8c0df93..1494e087890e73c07f678ea75c91e6e15506e84c 100644 (file)
@@ -5447,7 +5447,7 @@ static int jit_subprogs(struct bpf_verifier_env *env)
                insn->imm = 1;
        }
 
-       func = kzalloc(sizeof(prog) * env->subprog_cnt, GFP_KERNEL);
+       func = kcalloc(env->subprog_cnt, sizeof(prog), GFP_KERNEL);
        if (!func)
                return -ENOMEM;
 
index aaa69531fae2c2ab26d088332c5ff2966171c07f..2ddfce8f1e8fb2dddfc8fbbc2ca433da5b2aebbb 100644 (file)
@@ -691,7 +691,7 @@ static int kdb_defcmd2(const char *cmdstr, const char *argv0)
        }
        if (!s->usable)
                return KDB_NOTIMP;
-       s->command = kzalloc((s->count + 1) * sizeof(*(s->command)), GFP_KDB);
+       s->command = kcalloc(s->count + 1, sizeof(*(s->command)), GFP_KDB);
        if (!s->command) {
                kdb_printf("Could not allocate new kdb_defcmd table for %s\n",
                           cmdstr);
index 1725b902983fcd5b561fdc3b30d843b931f4cffd..ccc579a7d32e0c8a11835a19aee17b71d1375b8a 100644 (file)
@@ -1184,7 +1184,8 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
        if (unlikely(!area))
                goto out;
 
-       area->bitmap = kzalloc(BITS_TO_LONGS(UINSNS_PER_PAGE) * sizeof(long), GFP_KERNEL);
+       area->bitmap = kcalloc(BITS_TO_LONGS(UINSNS_PER_PAGE), sizeof(long),
+                              GFP_KERNEL);
        if (!area->bitmap)
                goto free_area;
 
index 4ceeb13a74ed70687ce7c1c06981710899a1bce4..8402b3349dca40a53a82a34900165c1054ae2fff 100644 (file)
@@ -989,7 +989,8 @@ static int __init lock_torture_init(void)
        }
 
        if (nwriters_stress) {
-               writer_tasks = kzalloc(cxt.nrealwriters_stress * sizeof(writer_tasks[0]),
+               writer_tasks = kcalloc(cxt.nrealwriters_stress,
+                                      sizeof(writer_tasks[0]),
                                       GFP_KERNEL);
                if (writer_tasks == NULL) {
                        VERBOSE_TOROUT_ERRSTRING("writer_tasks: Out of memory");
@@ -999,7 +1000,8 @@ static int __init lock_torture_init(void)
        }
 
        if (cxt.cur_ops->readlock) {
-               reader_tasks = kzalloc(cxt.nrealreaders_stress * sizeof(reader_tasks[0]),
+               reader_tasks = kcalloc(cxt.nrealreaders_stress,
+                                      sizeof(reader_tasks[0]),
                                       GFP_KERNEL);
                if (reader_tasks == NULL) {
                        VERBOSE_TOROUT_ERRSTRING("reader_tasks: Out of memory");
index e497c05aab7f84f8cea23b21e6f1b01da0c2a1b6..1866e64792a791f8737128c88ae691d7453ff117 100644 (file)
@@ -10215,10 +10215,10 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
        struct cfs_rq *cfs_rq;
        int i;
 
-       tg->cfs_rq = kzalloc(sizeof(cfs_rq) * nr_cpu_ids, GFP_KERNEL);
+       tg->cfs_rq = kcalloc(nr_cpu_ids, sizeof(cfs_rq), GFP_KERNEL);
        if (!tg->cfs_rq)
                goto err;
-       tg->se = kzalloc(sizeof(se) * nr_cpu_ids, GFP_KERNEL);
+       tg->se = kcalloc(nr_cpu_ids, sizeof(se), GFP_KERNEL);
        if (!tg->se)
                goto err;
 
index ef3c4e6f53457ba52151fe243c5d62c160ecc115..47556b0c9a95faff3e827f6ffd690646cff38224 100644 (file)
@@ -183,10 +183,10 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
        struct sched_rt_entity *rt_se;
        int i;
 
-       tg->rt_rq = kzalloc(sizeof(rt_rq) * nr_cpu_ids, GFP_KERNEL);
+       tg->rt_rq = kcalloc(nr_cpu_ids, sizeof(rt_rq), GFP_KERNEL);
        if (!tg->rt_rq)
                goto err;
-       tg->rt_se = kzalloc(sizeof(rt_se) * nr_cpu_ids, GFP_KERNEL);
+       tg->rt_se = kcalloc(nr_cpu_ids, sizeof(rt_se), GFP_KERNEL);
        if (!tg->rt_se)
                goto err;
 
index 6a78cf70761db3c436316f8e3f7453d20962dc08..2d9837c0aff4aef97ad8bb1542bcbd7cf1493b35 100644 (file)
@@ -3047,7 +3047,8 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
                if (IS_ERR(kbuf))
                        return PTR_ERR(kbuf);
 
-               tmp_bitmap = kzalloc(BITS_TO_LONGS(bitmap_len) * sizeof(unsigned long),
+               tmp_bitmap = kcalloc(BITS_TO_LONGS(bitmap_len),
+                                    sizeof(unsigned long),
                                     GFP_KERNEL);
                if (!tmp_bitmap) {
                        kfree(kbuf);
index df4b6254f986fae4a016fb5922a3692d7affb4b9..efed9c1cfb7ea4ea12182e711dacf01623f73452 100644 (file)
@@ -728,7 +728,7 @@ static int ftrace_profile_init_cpu(int cpu)
         */
        size = FTRACE_PROFILE_HASH_SIZE;
 
-       stat->hash = kzalloc(sizeof(struct hlist_head) * size, GFP_KERNEL);
+       stat->hash = kcalloc(size, sizeof(struct hlist_head), GFP_KERNEL);
 
        if (!stat->hash)
                return -ENOMEM;
index 8ea8550156138e6edb800c8209cfe080151209d8..c9336e98ac59a778d31c16a9ac72b184477e7177 100644 (file)
@@ -4361,7 +4361,8 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled)
 
        if (mask == TRACE_ITER_RECORD_TGID) {
                if (!tgid_map)
-                       tgid_map = kzalloc((PID_MAX_DEFAULT + 1) * sizeof(*tgid_map),
+                       tgid_map = kcalloc(PID_MAX_DEFAULT + 1,
+                                          sizeof(*tgid_map),
                                           GFP_KERNEL);
                if (!tgid_map) {
                        tr->trace_flags &= ~TRACE_ITER_RECORD_TGID;
index 465a28b4cd32a53d09a5a9d1d71cd235752da09f..78b192071ef7b58a4d92bbc65943fdaad7ccf735 100644 (file)
@@ -5638,7 +5638,7 @@ static void __init wq_numa_init(void)
         * available.  Build one from cpu_to_node() which should have been
         * fully initialized by now.
         */
-       tbl = kzalloc(nr_node_ids * sizeof(tbl[0]), GFP_KERNEL);
+       tbl = kcalloc(nr_node_ids, sizeof(tbl[0]), GFP_KERNEL);
        BUG_ON(!tbl);
 
        for_each_node(node)
index 28ba40b99337e7098783b6693c55527ea1952ab3..2b10a4024c35179d6835589d18ba8b0a996cb8ab 100644 (file)
@@ -119,7 +119,7 @@ struct lru_cache *lc_create(const char *name, struct kmem_cache *cache,
        slot = kcalloc(e_count, sizeof(struct hlist_head), GFP_KERNEL);
        if (!slot)
                goto out_fail;
-       element = kzalloc(e_count * sizeof(struct lc_element *), GFP_KERNEL);
+       element = kcalloc(e_count, sizeof(struct lc_element *), GFP_KERNEL);
        if (!element)
                goto out_fail;
 
index 2dbfc4c8a237b9836d070b6d3412ba1f4f25cf7b..20ed0f766787134cc459e5e43bbcbda607ab2217 100644 (file)
@@ -98,7 +98,7 @@ int mpi_resize(MPI a, unsigned nlimbs)
                kzfree(a->d);
                a->d = p;
        } else {
-               a->d = kzalloc(nlimbs * sizeof(mpi_limb_t), GFP_KERNEL);
+               a->d = kcalloc(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL);
                if (!a->d)
                        return -ENOMEM;
        }
index 36688f6c87ebd84d8978cecb26bc4739cb8b0910..aa76a70e087e6f5f1b1f61a18065831447dffec5 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4338,7 +4338,8 @@ static int leaks_show(struct seq_file *m, void *p)
        if (x[0] == x[1]) {
                /* Increase the buffer size */
                mutex_unlock(&slab_mutex);
-               m->private = kzalloc(x[0] * 4 * sizeof(unsigned long), GFP_KERNEL);
+               m->private = kcalloc(x[0] * 4, sizeof(unsigned long),
+                                    GFP_KERNEL);
                if (!m->private) {
                        /* Too bad, we are really out */
                        m->private = x;
index faf5dcb7b44f1a53d4b3508450b5a948260c4740..a3b8467c14af642138deaf35fd3ed3f7f87aed93 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3623,8 +3623,9 @@ static void list_slab_objects(struct kmem_cache *s, struct page *page,
 #ifdef CONFIG_SLUB_DEBUG
        void *addr = page_address(page);
        void *p;
-       unsigned long *map = kzalloc(BITS_TO_LONGS(page->objects) *
-                                    sizeof(long), GFP_ATOMIC);
+       unsigned long *map = kcalloc(BITS_TO_LONGS(page->objects),
+                                    sizeof(long),
+                                    GFP_ATOMIC);
        if (!map)
                return;
        slab_err(s, page, text, s->name);
@@ -4752,7 +4753,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s,
        int x;
        unsigned long *nodes;
 
-       nodes = kzalloc(sizeof(unsigned long) * nr_node_ids, GFP_KERNEL);
+       nodes = kcalloc(nr_node_ids, sizeof(unsigned long), GFP_KERNEL);
        if (!nodes)
                return -ENOMEM;
 
index cb4729539b82d1b3013b9d6ca60f20ded0062a2d..920665dd92db30232734b7d8492c0687d974becc 100644 (file)
@@ -333,7 +333,7 @@ static int br_mdb_rehash(struct net_bridge_mdb_htable __rcu **mdbp, int max,
        mdb->max = max;
        mdb->old = old;
 
-       mdb->mhash = kzalloc(max * sizeof(*mdb->mhash), GFP_ATOMIC);
+       mdb->mhash = kcalloc(max, sizeof(*mdb->mhash), GFP_ATOMIC);
        if (!mdb->mhash) {
                kfree(mdb);
                return -ENOMEM;
index 394ff1d2791f1e3947a4ed0c8953f9d9b227b35a..9393f25df08d3fce299aaa463efd79244e6527e9 100644 (file)
@@ -1105,7 +1105,8 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
                        }
 
                        /* create and init array for received CAN frames */
-                       op->last_frames = kzalloc(msg_head->nframes * op->cfsiz,
+                       op->last_frames = kcalloc(msg_head->nframes,
+                                                 op->cfsiz,
                                                  GFP_KERNEL);
                        if (!op->last_frames) {
                                kfree(op->frames);
index 436e4f9cc7f01d014930b4b0d1959a93aadd6c1a..8be6be2d9c7b89f62ca3a13f975132232249a13d 100644 (file)
@@ -911,7 +911,7 @@ static noinline_for_stack int ethtool_get_sset_info(struct net_device *dev,
        memset(&info, 0, sizeof(info));
        info.cmd = ETHTOOL_GSSET_INFO;
 
-       info_buf = kzalloc(n_bits * sizeof(u32), GFP_USER);
+       info_buf = kcalloc(n_bits, sizeof(u32), GFP_USER);
        if (!info_buf)
                return -ENOMEM;
 
@@ -1017,7 +1017,7 @@ static noinline_for_stack int ethtool_get_rxnfc(struct net_device *dev,
        if (info.cmd == ETHTOOL_GRXCLSRLALL) {
                if (info.rule_cnt > 0) {
                        if (info.rule_cnt <= KMALLOC_MAX_SIZE / sizeof(u32))
-                               rule_buf = kzalloc(info.rule_cnt * sizeof(u32),
+                               rule_buf = kcalloc(info.rule_cnt, sizeof(u32),
                                                   GFP_USER);
                        if (!rule_buf)
                                return -ENOMEM;
index dc2960be51e0a6161d921bb3e3235926a15c3a82..b231e40f006a696b7d2bf20f1eaecb0e501f6bbb 100644 (file)
@@ -38,7 +38,7 @@ static int ieee802154_nl_fill_phy(struct sk_buff *msg, u32 portid,
 {
        void *hdr;
        int i, pages = 0;
-       uint32_t *buf = kzalloc(32 * sizeof(uint32_t), GFP_KERNEL);
+       uint32_t *buf = kcalloc(32, sizeof(uint32_t), GFP_KERNEL);
 
        pr_debug("%s\n", __func__);
 
index 63aa39b3af03cb70c50b16418bf95a5c736f6cae..b21833651394233bbdb143d765e4408333b13b72 100644 (file)
@@ -567,7 +567,7 @@ static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt,
                struct nlattr *mx;
                int len = 0;
 
-               mx = kzalloc(3 * nla_total_size(4), GFP_KERNEL);
+               mx = kcalloc(3, nla_total_size(4), GFP_KERNEL);
                if (!mx)
                        return -ENOMEM;
 
index 6bcd1eacc1f0fc53315d26ea27bfcd14563cc9a1..1df6e97106d79eef9dfde27472c5f9c20cae3943 100644 (file)
@@ -649,7 +649,7 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
 
        hash = rcu_dereference(nh->nh_exceptions);
        if (!hash) {
-               hash = kzalloc(FNHE_HASH_SIZE * sizeof(*hash), GFP_ATOMIC);
+               hash = kcalloc(FNHE_HASH_SIZE, sizeof(*hash), GFP_ATOMIC);
                if (!hash)
                        goto out_unlock;
                rcu_assign_pointer(nh->nh_exceptions, hash);
index d8c4b63743772d60d6bd75176a3cd857179ed989..be491bf6ab6e9ff4d1a9d84bc78c4582f4fe8e01 100644 (file)
@@ -956,7 +956,7 @@ static int __net_init icmpv6_sk_init(struct net *net)
        int err, i, j;
 
        net->ipv6.icmp_sk =
-               kzalloc(nr_cpu_ids * sizeof(struct sock *), GFP_KERNEL);
+               kcalloc(nr_cpu_ids, sizeof(struct sock *), GFP_KERNEL);
        if (!net->ipv6.icmp_sk)
                return -ENOMEM;
 
index 89178b46b32fab38f9c7dfc4359237ecd3fd9a8c..d9558ffb8acf73b8d596989a3fe22e753937f5d9 100644 (file)
@@ -1186,7 +1186,7 @@ static int ieee80211_chsw_switch_vifs(struct ieee80211_local *local,
        lockdep_assert_held(&local->mtx);
        lockdep_assert_held(&local->chanctx_mtx);
 
-       vif_chsw = kzalloc(sizeof(vif_chsw[0]) * n_vifs, GFP_KERNEL);
+       vif_chsw = kcalloc(n_vifs, sizeof(vif_chsw[0]), GFP_KERNEL);
        if (!vif_chsw)
                return -ENOMEM;
 
index 7fadfbca9f1b09d2c658e3cfe761aea3aa70e7e5..76048b53c5b27637d343868c69ab54c928c6614d 100644 (file)
@@ -592,7 +592,7 @@ minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
                        max_rates = sband->n_bitrates;
        }
 
-       mi->r = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp);
+       mi->r = kcalloc(max_rates, sizeof(struct minstrel_rate), gfp);
        if (!mi->r)
                goto error;
 
index 267ab9d5137e9733057aa8227926f851715e570d..67ebdeaffbbc8e6afbc5259988bf463f0c46abb9 100644 (file)
@@ -1313,7 +1313,7 @@ minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
        if (!msp)
                return NULL;
 
-       msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp);
+       msp->ratelist = kcalloc(max_rates, sizeof(struct minstrel_rate), gfp);
        if (!msp->ratelist)
                goto error;
 
index a3b1bcc2b4615373bc636a5f3e2b6ae326608c9b..2e917a6d239d234ce671b8b4017dbd23c4be5b2e 100644 (file)
@@ -1157,7 +1157,7 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
                }
        }
 
-       ie = kzalloc(num_bands * iebufsz, GFP_KERNEL);
+       ie = kcalloc(iebufsz, num_bands, GFP_KERNEL);
        if (!ie) {
                ret = -ENOMEM;
                goto out;
index 2d82c88efd0b6f271b693067451cc75d210fb8c4..5e2e511c4a6f69cf0b613c1b3facd0665d672cfd 100644 (file)
@@ -1803,8 +1803,9 @@ static int ieee80211_reconfig_nan(struct ieee80211_sub_if_data *sdata)
        if (WARN_ON(res))
                return res;
 
-       funcs = kzalloc((sdata->local->hw.max_nan_de_entries + 1) *
-                       sizeof(*funcs), GFP_KERNEL);
+       funcs = kcalloc(sdata->local->hw.max_nan_de_entries + 1,
+                       sizeof(*funcs),
+                       GFP_KERNEL);
        if (!funcs)
                return -ENOMEM;
 
index cae4a026859dc65a3042ca90007a778c81bf5fdd..f0411fbffe77a96655f66c618d22e4a9d53fcb06 100644 (file)
@@ -5303,7 +5303,7 @@ static int nf_tables_flowtable_parse_hook(const struct nft_ctx *ctx,
        if (err < 0)
                return err;
 
-       ops = kzalloc(sizeof(struct nf_hook_ops) * n, GFP_KERNEL);
+       ops = kcalloc(n, sizeof(struct nf_hook_ops), GFP_KERNEL);
        if (!ops)
                return -ENOMEM;
 
index cb5b5f2077774c29fb987b7f1eb2d75e9efc2fe1..e5d27b2e4ebac9d7256ad53657167e3b87052f94 100644 (file)
@@ -190,8 +190,9 @@ nfnl_cthelper_parse_expect_policy(struct nf_conntrack_helper *helper,
        if (class_max > NF_CT_MAX_EXPECT_CLASSES)
                return -EOVERFLOW;
 
-       expect_policy = kzalloc(sizeof(struct nf_conntrack_expect_policy) *
-                               class_max, GFP_KERNEL);
+       expect_policy = kcalloc(class_max,
+                               sizeof(struct nf_conntrack_expect_policy),
+                               GFP_KERNEL);
        if (expect_policy == NULL)
                return -ENOMEM;
 
index b97eb766a1d52a97d7c6445594f259aeee276ca4..93fbcafbf3886d34b0be87244c405b8319df89dd 100644 (file)
@@ -1395,7 +1395,7 @@ static int __init nr_proto_init(void)
                return -1;
        }
 
-       dev_nr = kzalloc(nr_ndevs * sizeof(struct net_device *), GFP_KERNEL);
+       dev_nr = kcalloc(nr_ndevs, sizeof(struct net_device *), GFP_KERNEL);
        if (dev_nr == NULL) {
                printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device array\n");
                return -1;
index f81c1d0ddff4d6e05da635f78e84bd28cc681f06..19f6765566e727d8e02655f0dd6c2f0f971f64e3 100644 (file)
@@ -47,7 +47,7 @@ static struct hlist_head *dev_table;
  */
 int ovs_vport_init(void)
 {
-       dev_table = kzalloc(VPORT_HASH_BUCKETS * sizeof(struct hlist_head),
+       dev_table = kcalloc(VPORT_HASH_BUCKETS, sizeof(struct hlist_head),
                            GFP_KERNEL);
        if (!dev_table)
                return -ENOMEM;
index 02deee29e7f109e96908382345faf528471f2d90..b6ad38e48f62692fa9dc6cc9f7c7081c706394a7 100644 (file)
@@ -163,7 +163,8 @@ static void rds_ib_add_one(struct ib_device *device)
        rds_ibdev->max_initiator_depth = device->attrs.max_qp_init_rd_atom;
        rds_ibdev->max_responder_resources = device->attrs.max_qp_rd_atom;
 
-       rds_ibdev->vector_load = kzalloc(sizeof(int) * device->num_comp_vectors,
+       rds_ibdev->vector_load = kcalloc(device->num_comp_vectors,
+                                        sizeof(int),
                                         GFP_KERNEL);
        if (!rds_ibdev->vector_load) {
                pr_err("RDS/IB: %s failed to allocate vector memory\n",
index 5b73fea849dff2d72bca7dbc5295ba9f369acf84..ebe42e7eb45697030367c4baba455b50c973c409 100644 (file)
@@ -1514,7 +1514,8 @@ static int __init rose_proto_init(void)
 
        rose_callsign = null_ax25_address;
 
-       dev_rose = kzalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);
+       dev_rose = kcalloc(rose_ndevs, sizeof(struct net_device *),
+                          GFP_KERNEL);
        if (dev_rose == NULL) {
                printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");
                rc = -ENOMEM;
index e64630cd33318ef3c90339bd61388fafd27928f3..5b537613946fcaaabcb2716b74b5a7188a828142 100644 (file)
@@ -482,8 +482,9 @@ int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp)
                return 0;
 
        /* Allocated the array of pointers to transorms */
-       ep->auth_hmacs = kzalloc(sizeof(struct crypto_shash *) *
-                                SCTP_AUTH_NUM_HMACS, gfp);
+       ep->auth_hmacs = kcalloc(SCTP_AUTH_NUM_HMACS,
+                                sizeof(struct crypto_shash *),
+                                gfp);
        if (!ep->auth_hmacs)
                return -ENOMEM;
 
index cc7c1bb60fe87115e942f96f7c6a87602ccd6094..dbd2605d19627b0f91731767f3d0d8e0c166f454 100644 (file)
@@ -584,9 +584,9 @@ int smc_wr_alloc_link_mem(struct smc_link *link)
                                   GFP_KERNEL);
        if (!link->wr_rx_sges)
                goto no_mem_wr_tx_sges;
-       link->wr_tx_mask = kzalloc(
-               BITS_TO_LONGS(SMC_WR_BUF_CNT) * sizeof(*link->wr_tx_mask),
-               GFP_KERNEL);
+       link->wr_tx_mask = kcalloc(BITS_TO_LONGS(SMC_WR_BUF_CNT),
+                                  sizeof(*link->wr_tx_mask),
+                                  GFP_KERNEL);
        if (!link->wr_tx_mask)
                goto no_mem_wr_rx_sges;
        link->wr_tx_pends = kcalloc(SMC_WR_BUF_CNT,
index 46b295e4f2b82c3ca70efe04091aeebfb97b8ae9..d58bd058b09ba7898b0d14d09a4124a99382eb86 100644 (file)
@@ -224,7 +224,7 @@ static void gssp_free_receive_pages(struct gssx_arg_accept_sec_context *arg)
 static int gssp_alloc_receive_pages(struct gssx_arg_accept_sec_context *arg)
 {
        arg->npages = DIV_ROUND_UP(NGROUPS_MAX * 4, PAGE_SIZE);
-       arg->pages = kzalloc(arg->npages * sizeof(struct page *), GFP_KERNEL);
+       arg->pages = kcalloc(arg->npages, sizeof(struct page *), GFP_KERNEL);
        /*
         * XXX: actual pages are allocated by xdr layer in
         * xdr_partial_copy_from_skb.
index cdda4744c9b154295cbff961a3f5a71eacb86983..109fbe591e7bf35de11e7d5fee20de519e872aa0 100644 (file)
@@ -1683,7 +1683,7 @@ struct cache_detail *cache_create_net(const struct cache_detail *tmpl, struct ne
        if (cd == NULL)
                return ERR_PTR(-ENOMEM);
 
-       cd->hash_table = kzalloc(cd->hash_size * sizeof(struct hlist_head),
+       cd->hash_table = kcalloc(cd->hash_size, sizeof(struct hlist_head),
                                 GFP_KERNEL);
        if (cd->hash_table == NULL) {
                kfree(cd);
index 07514ca011b2fb24cabd18659d1b0f01cebde7fe..c7bbe5f0aae8839bdfe5ac7b7bd02c6aad8ac8dc 100644 (file)
@@ -10833,7 +10833,7 @@ static int nl80211_parse_wowlan_nd(struct cfg80211_registered_device *rdev,
        struct nlattr **tb;
        int err;
 
-       tb = kzalloc(NUM_NL80211_ATTR * sizeof(*tb), GFP_KERNEL);
+       tb = kcalloc(NUM_NL80211_ATTR, sizeof(*tb), GFP_KERNEL);
        if (!tb)
                return -ENOMEM;
 
@@ -11793,7 +11793,7 @@ static int nl80211_nan_add_func(struct sk_buff *skb,
 
                        func->srf_num_macs = n_entries;
                        func->srf_macs =
-                               kzalloc(sizeof(*func->srf_macs) * n_entries,
+                               kcalloc(n_entries, sizeof(*func->srf_macs),
                                        GFP_KERNEL);
                        if (!func->srf_macs) {
                                err = -ENOMEM;
index b9e6b2cafa6993fe29820e13429988e7e9d01c09..0e566a01d217c8dee874f7a063c18ef3eb190523 100644 (file)
@@ -475,7 +475,7 @@ static bool unpack_trans_table(struct aa_ext *e, struct aa_profile *profile)
                /* currently 4 exec bits and entries 0-3 are reserved iupcx */
                if (size > 16 - 4)
                        goto fail;
-               profile->file.trans.table = kzalloc(sizeof(char *) * size,
+               profile->file.trans.table = kcalloc(size, sizeof(char *),
                                                    GFP_KERNEL);
                if (!profile->file.trans.table)
                        goto fail;
index a2d44824121c7287ee028f6f14529d970d577ec5..dd2ceec06fef27dbf5ca47bb622b254dd5256231 100644 (file)
@@ -2118,7 +2118,7 @@ int security_load_policy(struct selinux_state *state, void *data, size_t len)
        int rc = 0;
        struct policy_file file = { data, len }, *fp = &file;
 
-       oldpolicydb = kzalloc(2 * sizeof(*oldpolicydb), GFP_KERNEL);
+       oldpolicydb = kcalloc(2, sizeof(*oldpolicydb), GFP_KERNEL);
        if (!oldpolicydb) {
                rc = -ENOMEM;
                goto out;
index 12aa15df435d1cca2bf6f3cf42b60704b2340004..ad7a0a32557dc778e32acc6cb813cf4e56a54623 100644 (file)
@@ -147,7 +147,7 @@ static int ff400_switch_fetching_mode(struct snd_ff *ff, bool enable)
        __le32 *reg;
        int i;
 
-       reg = kzalloc(sizeof(__le32) * 18, GFP_KERNEL);
+       reg = kcalloc(18, sizeof(__le32), GFP_KERNEL);
        if (reg == NULL)
                return -ENOMEM;
 
index 908658a00377e3b2fb56579e97d93a3b94851af9..2ada8444abd99ba4d5d4ab14a59285eed87b61fb 100644 (file)
@@ -275,7 +275,7 @@ static int atc_pcm_playback_prepare(struct ct_atc *atc, struct ct_atc_pcm *apcm)
 
        /* Get AMIXER resource */
        n_amixer = (n_amixer < 2) ? 2 : n_amixer;
-       apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
+       apcm->amixers = kcalloc(n_amixer, sizeof(void *), GFP_KERNEL);
        if (!apcm->amixers) {
                err = -ENOMEM;
                goto error1;
@@ -543,18 +543,18 @@ atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
        }
 
        if (n_srcc) {
-               apcm->srccs = kzalloc(sizeof(void *)*n_srcc, GFP_KERNEL);
+               apcm->srccs = kcalloc(n_srcc, sizeof(void *), GFP_KERNEL);
                if (!apcm->srccs)
                        return -ENOMEM;
        }
        if (n_amixer) {
-               apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
+               apcm->amixers = kcalloc(n_amixer, sizeof(void *), GFP_KERNEL);
                if (!apcm->amixers) {
                        err = -ENOMEM;
                        goto error1;
                }
        }
-       apcm->srcimps = kzalloc(sizeof(void *)*n_srcimp, GFP_KERNEL);
+       apcm->srcimps = kcalloc(n_srcimp, sizeof(void *), GFP_KERNEL);
        if (!apcm->srcimps) {
                err = -ENOMEM;
                goto error1;
@@ -819,7 +819,7 @@ static int spdif_passthru_playback_get_resources(struct ct_atc *atc,
 
        /* Get AMIXER resource */
        n_amixer = (n_amixer < 2) ? 2 : n_amixer;
-       apcm->amixers = kzalloc(sizeof(void *)*n_amixer, GFP_KERNEL);
+       apcm->amixers = kcalloc(n_amixer, sizeof(void *), GFP_KERNEL);
        if (!apcm->amixers) {
                err = -ENOMEM;
                goto error1;
@@ -1378,19 +1378,19 @@ static int atc_get_resources(struct ct_atc *atc)
        num_daios = ((atc->model == CTSB1270) ? 8 : 7);
        num_srcs = ((atc->model == CTSB1270) ? 6 : 4);
 
-       atc->daios = kzalloc(sizeof(void *)*num_daios, GFP_KERNEL);
+       atc->daios = kcalloc(num_daios, sizeof(void *), GFP_KERNEL);
        if (!atc->daios)
                return -ENOMEM;
 
-       atc->srcs = kzalloc(sizeof(void *)*num_srcs, GFP_KERNEL);
+       atc->srcs = kcalloc(num_srcs, sizeof(void *), GFP_KERNEL);
        if (!atc->srcs)
                return -ENOMEM;
 
-       atc->srcimps = kzalloc(sizeof(void *)*num_srcs, GFP_KERNEL);
+       atc->srcimps = kcalloc(num_srcs, sizeof(void *), GFP_KERNEL);
        if (!atc->srcimps)
                return -ENOMEM;
 
-       atc->pcm = kzalloc(sizeof(void *)*(2*4), GFP_KERNEL);
+       atc->pcm = kcalloc(2 * 4, sizeof(void *), GFP_KERNEL);
        if (!atc->pcm)
                return -ENOMEM;
 
index 7f089cb433e17d6c9dde341d09b328aa471ec0c1..f35a7341e44634c1f4108e7c32c7cde102d8a369 100644 (file)
@@ -398,7 +398,8 @@ static int dao_rsc_init(struct dao *dao,
        if (err)
                return err;
 
-       dao->imappers = kzalloc(sizeof(void *)*desc->msr*2, GFP_KERNEL);
+       dao->imappers = kzalloc(array3_size(sizeof(void *), desc->msr, 2),
+                               GFP_KERNEL);
        if (!dao->imappers) {
                err = -ENOMEM;
                goto error1;
index 4f4a2a5dedb8f0fd8eb5b1679cfbab08c5441e12..db710d0a609fc14a55c0719816992b8a976ea2f0 100644 (file)
@@ -910,13 +910,14 @@ static int ct_mixer_get_mem(struct ct_mixer **rmixer)
        if (!mixer)
                return -ENOMEM;
 
-       mixer->amixers = kzalloc(sizeof(void *)*(NUM_CT_AMIXERS*CHN_NUM),
+       mixer->amixers = kcalloc(NUM_CT_AMIXERS * CHN_NUM, sizeof(void *),
                                 GFP_KERNEL);
        if (!mixer->amixers) {
                err = -ENOMEM;
                goto error1;
        }
-       mixer->sums = kzalloc(sizeof(void *)*(NUM_CT_SUMS*CHN_NUM), GFP_KERNEL);
+       mixer->sums = kcalloc(NUM_CT_SUMS * CHN_NUM, sizeof(void *),
+                             GFP_KERNEL);
        if (!mixer->sums) {
                err = -ENOMEM;
                goto error2;
index bb4c9c3c89aee0c26583096b9a23c1b8d986b5d6..a4fc10723fc6b4d044b5a72846191faebb9ae96e 100644 (file)
@@ -679,7 +679,7 @@ static int srcimp_rsc_init(struct srcimp *srcimp,
                return err;
 
        /* Reserve memory for imapper nodes */
-       srcimp->imappers = kzalloc(sizeof(struct imapper)*desc->msr,
+       srcimp->imappers = kcalloc(desc->msr, sizeof(struct imapper),
                                   GFP_KERNEL);
        if (!srcimp->imappers) {
                err = -ENOMEM;
index 292e2c592c17af0b5580f67e2e49be18fdd9e1fc..04e949aa01ada5492765cd313608624f3a42c7b9 100644 (file)
@@ -7482,7 +7482,9 @@ static int ca0132_prepare_verbs(struct hda_codec *codec)
        spec->chip_init_verbs = ca0132_init_verbs0;
        if (spec->quirk == QUIRK_SBZ)
                spec->sbz_init_verbs = sbz_init_verbs;
-       spec->spec_init_verbs = kzalloc(sizeof(struct hda_verb) * NUM_SPEC_VERBS, GFP_KERNEL);
+       spec->spec_init_verbs = kcalloc(NUM_SPEC_VERBS,
+                                       sizeof(struct hda_verb),
+                                       GFP_KERNEL);
        if (!spec->spec_init_verbs)
                return -ENOMEM;
 
index 2175dccdf38891045d89212f5f60aa18c19f2807..2fcdd84021a565b36f46b3858a0f28aaae88c411 100644 (file)
@@ -1899,7 +1899,7 @@ static void *wm_adsp_read_algs(struct wm_adsp *dsp, size_t n_algs,
                adsp_warn(dsp, "Algorithm list end %x 0x%x != 0xbedead\n",
                          pos + len, be32_to_cpu(val));
 
-       alg = kzalloc(len * 2, GFP_KERNEL | GFP_DMA);
+       alg = kcalloc(len, 2, GFP_KERNEL | GFP_DMA);
        if (!alg)
                return ERR_PTR(-ENOMEM);
 
index 62f3a8e0ec87696389d46c7824297b5e36fce188..dcff13802c007ece2a87b6bd695c6362613dc67b 100644 (file)
@@ -121,8 +121,8 @@ static int msg_empty_list_init(struct sst_generic_ipc *ipc)
 {
        int i;
 
-       ipc->msg = kzalloc(sizeof(struct ipc_message) *
-               IPC_EMPTY_LIST_SIZE, GFP_KERNEL);
+       ipc->msg = kcalloc(IPC_EMPTY_LIST_SIZE, sizeof(struct ipc_message),
+                          GFP_KERNEL);
        if (ipc->msg == NULL)
                return -ENOMEM;
 
index 3d56f1fe5914e981ac9e480e3b335c139d25b6f5..61542847cb3b7bbdfedb9abb39f75f6de79ccb1c 100644 (file)
@@ -373,8 +373,8 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
        if (!rtd->dai_link->ops)
                rtd->dai_link->ops = &null_snd_soc_ops;
 
-       rtd->codec_dais = kzalloc(sizeof(struct snd_soc_dai *) *
-                                       dai_link->num_codecs,
+       rtd->codec_dais = kcalloc(dai_link->num_codecs,
+                                       sizeof(struct snd_soc_dai *),
                                        GFP_KERNEL);
        if (!rtd->codec_dais) {
                kfree(rtd);
index 255cad43a972119622d5eb1cb2b3bf9e151ac06e..229c123498030b092e3f82a7c021128ec5618d55 100644 (file)
@@ -3055,7 +3055,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card)
                        continue;
 
                if (w->num_kcontrols) {
-                       w->kcontrols = kzalloc(w->num_kcontrols *
+                       w->kcontrols = kcalloc(w->num_kcontrols,
                                                sizeof(struct snd_kcontrol *),
                                                GFP_KERNEL);
                        if (!w->kcontrols) {
index 3fd5d9c867b9b5d30c39eee8d615849d094630b6..53f121a50c97bd6858a2b846b1a3f53e03026dd6 100644 (file)
@@ -885,7 +885,7 @@ static int soc_tplg_denum_create_texts(struct soc_enum *se,
        int i, ret;
 
        se->dobj.control.dtexts =
-               kzalloc(sizeof(char *) * ec->items, GFP_KERNEL);
+               kcalloc(ec->items, sizeof(char *), GFP_KERNEL);
        if (se->dobj.control.dtexts == NULL)
                return -ENOMEM;
 
index 224a6a5d1c0e7a6d9b2b359ea7b94b9588bf360c..2dd2518a71d3e2b7ecffbbe1df5d6d98de8ae14d 100644 (file)
@@ -591,12 +591,14 @@ static int usb6fire_pcm_buffers_init(struct pcm_runtime *rt)
        int i;
 
        for (i = 0; i < PCM_N_URBS; i++) {
-               rt->out_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB
-                               * PCM_MAX_PACKET_SIZE, GFP_KERNEL);
+               rt->out_urbs[i].buffer = kcalloc(PCM_MAX_PACKET_SIZE,
+                                                PCM_N_PACKETS_PER_URB,
+                                                GFP_KERNEL);
                if (!rt->out_urbs[i].buffer)
                        return -ENOMEM;
-               rt->in_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB
-                               * PCM_MAX_PACKET_SIZE, GFP_KERNEL);
+               rt->in_urbs[i].buffer = kcalloc(PCM_MAX_PACKET_SIZE,
+                                               PCM_N_PACKETS_PER_URB,
+                                               GFP_KERNEL);
                if (!rt->in_urbs[i].buffer)
                        return -ENOMEM;
        }
index 947d6168f24abe477e7ec9456e7c4fe293138707..d8a14d769f482732e9ecdd9fb2473b9e787420e0 100644 (file)
@@ -264,8 +264,8 @@ int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm)
        struct usb_line6 *line6 = line6pcm->line6;
        int i;
 
-       line6pcm->in.urbs = kzalloc(
-               sizeof(struct urb *) * line6->iso_buffers, GFP_KERNEL);
+       line6pcm->in.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *),
+                                   GFP_KERNEL);
        if (line6pcm->in.urbs == NULL)
                return -ENOMEM;
 
index 819e9b2d1d6e5ea4376c2d85829311937ef9958a..dec89d2beb57807175fa3806ac68e1fd92f340fe 100644 (file)
@@ -409,8 +409,8 @@ int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)
        struct usb_line6 *line6 = line6pcm->line6;
        int i;
 
-       line6pcm->out.urbs = kzalloc(
-               sizeof(struct urb *) * line6->iso_buffers, GFP_KERNEL);
+       line6pcm->out.urbs = kcalloc(line6->iso_buffers, sizeof(struct urb *),
+                                    GFP_KERNEL);
        if (line6pcm->out.urbs == NULL)
                return -ENOMEM;
 
index bc4265154bacf0665e2cf450641ab8839e35a1f6..1ed5f2286b8e1511782404b1bfc2ea606ccde8e0 100644 (file)
@@ -126,7 +126,7 @@ int vgic_v4_init(struct kvm *kvm)
 
        nr_vcpus = atomic_read(&kvm->online_vcpus);
 
-       dist->its_vm.vpes = kzalloc(sizeof(*dist->its_vm.vpes) * nr_vcpus,
+       dist->its_vm.vpes = kcalloc(nr_vcpus, sizeof(*dist->its_vm.vpes),
                                    GFP_KERNEL);
        if (!dist->its_vm.vpes)
                return -ENOMEM;