Open GustavoARSilva opened 2 years ago
Audit and replace calls to kvzalloc() with its 2-factor multiplication argument form, kvcalloc(), when appropriate.
git grep -n kvzalloc | grep ' \ ' | grep -v ':\s\+\*' drivers/gpu/drm/nouveau/nouveau_svm.c:995: buffer->fault = kvzalloc(sizeof(buffer->fault) buffer->entries, GFP_KERNEL); drivers/iommu/dma-iommu.c:619: pages = kvzalloc(count sizeof(pages), GFP_KERNEL); drivers/net/ethernet/google/gve/gve_main.c:631: priv->tx = kvzalloc(priv->tx_cfg.num_queues sizeof(priv->tx), drivers/net/ethernet/google/gve/gve_main.c:644: priv->rx = kvzalloc(priv->rx_cfg.num_queues sizeof(priv->rx), drivers/net/ethernet/google/gve/gve_main.c:767: qpl->pages = kvzalloc(pages sizeof(qpl->pages), GFP_KERNEL); drivers/net/ethernet/google/gve/gve_main.c:771: qpl->page_buses = kvzalloc(pages sizeof(qpl->page_buses), drivers/net/ethernet/google/gve/gve_main.c:831: priv->qpls = kvzalloc(num_qpls sizeof(priv->qpls), GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/cmd.c:2061: cmd->stats = kvzalloc(MLX5_CMD_OP_MAX sizeof(cmd->stats), GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/en_main.c:934: xdpi_fifo->xi = kvzalloc_node(sizeof(xdpi_fifo->xi) dsegs_per_wq, drivers/net/ethernet/mellanox/mlx5/core/en_main.c:951: sq->db.wqe_info = kvzalloc_node(sizeof(sq->db.wqe_info) wq_sz, drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c:1012: flows = kvzalloc(num_vfs sizeof(flows), GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c:1191: flows = kvzalloc(nvports sizeof(flows), GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c:500: bulk = kvzalloc(sizeof(bulk) + bulk_len sizeof(struct mlx5_fc), drivers/net/wireguard/ratelimiter.c:179: table_v4 = kvzalloc(table_size sizeof(table_v4), GFP_KERNEL); drivers/net/wireguard/ratelimiter.c:184: table_v6 = kvzalloc(table_size sizeof(table_v6), GFP_KERNEL); fs/xfs/xfs_ioctl.c:1550: buf = kvzalloc(bmx.bmv_count sizeof(buf), GFP_KERNEL); fs/xfs/xfs_ioctl.c:1604: recs = kvzalloc(count sizeof(struct fsmap), GFP_KERNEL); fs/xfs/xfs_ioctl.c:1608: recs = kvzalloc(count sizeof(struct fsmap), GFP_KERNEL); net/netfilter/nft_set_pipapo.c:641: new_lt = kvzalloc(f->groups NFT_PIPAPO_BUCKETS(f->bb) net/netfilter/nft_set_pipapo.c:1304: new_lt = kvzalloc(src->groups NFT_PIPAPO_BUCKETS(src->bb) *
git grep -n kzalloc | grep ' \ ' | grep -v ':\s\+\*' arch/alpha/kernel/pci-sysfs.c:206: attr = kzalloc(sizeof(attr) res_count + nlen1 + nlen2, GFP_ATOMIC); arch/mips/alchemy/common/clock.c:774: a = kzalloc((sizeof(a)) 6, GFP_KERNEL); arch/mips/n64/init.c:122: orig = kzalloc(W H 2 + 63, GFP_DMA | GFP_KERNEL); arch/powerpc/kvm/book3s_64_vio.c:298: stt = kzalloc(sizeof(stt) + npages sizeof(struct page ), arch/x86/kvm/x86.c:10664: vcpu->arch.mce_banks = kzalloc(KVM_MAX_MCE_BANKS sizeof(u64) 4, drivers/base/power/qos.c:204: n = kzalloc(3 sizeof(n), GFP_KERNEL); drivers/char/agp/frontend.c:168: seg = kzalloc((sizeof(struct agp_segment_priv) region->seg_count), GFP_KERNEL); drivers/clk/hisilicon/clk-hi3559a.c:464: p_clk = devm_kzalloc(dev, sizeof(p_clk) nums, GFP_KERNEL); drivers/clk/ti/composite.c:256: parent_names = kzalloc((sizeof(char ) num_parents), GFP_KERNEL); drivers/clk/ti/mux.c:190: parent_names = kzalloc((sizeof(char ) num_parents), GFP_KERNEL); drivers/cpufreq/cpufreq.c:1397: policy->min_freq_req = kzalloc(2 sizeof(policy->min_freq_req), drivers/cpufreq/sparc-us2e-cpufreq.c:329: us2e_freq_table = kzalloc((NR_CPUS sizeof(us2e_freq_table)), drivers/cpufreq/sparc-us3-cpufreq.c:177: us3_freq_table = kzalloc((NR_CPUS sizeof(us3_freq_table)), drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c:288: buf = kzalloc(bs 2, GFP_KERNEL | GFP_DMA); drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c:345: pad = kzalloc(algt->alg.hash.halg.base.cra_blocksize 2, GFP_KERNEL | GFP_DMA); drivers/crypto/axis/artpec6_crypto.c:2906: ac->pad_buffer = devm_kzalloc(&pdev->dev, 2 ARTPEC_CACHE_LINE_MAX, drivers/crypto/axis/artpec6_crypto.c:2912: ac->zero_buffer = devm_kzalloc(&pdev->dev, 2 ARTPEC_CACHE_LINE_MAX, drivers/crypto/hisilicon/qm.c:1738: sqe = kzalloc(qm->sqe_size QM_Q_DEPTH, GFP_KERNEL); drivers/crypto/qat/qat_common/adf_isr.c:232: irqs = kzalloc_node(msix_num_entries sizeof(irqs), drivers/dma/amba-pl08x.c:2869: pl08x->phy_chans = kzalloc((vd->channels sizeof(pl08x->phy_chans)), drivers/dma/milbeaut-hdmac.c:272: md->sgl = kzalloc(sizeof(sgl) sg_len, GFP_NOWAIT); drivers/dma/stm32-mdma.c:1569: dmadev = devm_kzalloc(&pdev->dev, sizeof(dmadev) + sizeof(u32) count, drivers/firmware/efi/apple-properties.c:82: key = kzalloc((key_len - sizeof(key_len)) 4 + 1, GFP_KERNEL); drivers/gpu/drm/amd/amdgpu/atom.c:1291: ctx->iio = kzalloc(2 256, GFP_KERNEL); drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c:3200: display_e2e_pipe_params_st pipes = kzalloc(dc->res_pool->pipe_count sizeof(display_e2e_pipe_params_st), GFP_ATOMIC); drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c:1343: display_e2e_pipe_params_st pipes = kzalloc(dc->res_pool->pipe_count sizeof(display_e2e_pipe_params_st), GFP_ATOMIC); drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c:2306: display_e2e_pipe_params_st pipes = kzalloc(dc->res_pool->pipe_count sizeof(display_e2e_pipe_params_st), GFP_KERNEL); drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c:1992: display_e2e_pipe_params_st pipes = kzalloc(dc->res_pool->pipe_count sizeof(display_e2e_pipe_params_st), GFP_KERNEL); drivers/gpu/drm/i915/display/intel_sdvo.c:472: buf = kzalloc(args_len 2 + 2, GFP_KERNEL); drivers/gpu/drm/i915/i915_syncmap.c:285: next = kzalloc(sizeof(next) + KSYNCMAP sizeof(next), drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c:86: kzalloc((nr objsize) + sizeof(obj), GFP_KERNEL); drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c:922: pstates = kzalloc(sizeof(pstates) DPU_STAGE_MAX 4, GFP_KERNEL); drivers/gpu/drm/radeon/atom.c:1252: ctx->iio = kzalloc(2 256, GFP_KERNEL); drivers/gpu/drm/radeon/radeon_display.c:680: radeon_crtc = kzalloc(sizeof(struct radeon_crtc) + (RADEONFB_CONN_LIMIT sizeof(struct drm_connector )), GFP_KERNEL); drivers/gpu/drm/tiny/repaper.c:1106: epd->current_frame = devm_kzalloc(dev, epd->width epd->height / 8, drivers/gpu/drm/tiny/simpledrm.c:287: sdev->clks = drmm_kzalloc(dev, sdev->clk_count sizeof(sdev->clks[0]), drivers/gpu/drm/vmwgfx/vmwgfx_surface.c:855: srf->snooper.image = kzalloc(64 64 4, GFP_KERNEL); drivers/hwmon/occ/common.c:867: occ->attrs = devm_kzalloc(dev, sizeof(occ->attrs) num_attrs, drivers/input/keyboard/gpio_keys_polled.c:154: pdata = devm_kzalloc(dev, sizeof(pdata) + nbuttons sizeof(button), drivers/input/rmi4/rmi_f11.c:1085: f11 = devm_kzalloc(&fn->dev, sizeof(struct f11_data) + mask_size 2, drivers/input/rmi4/rmi_f12.c:350: f12 = devm_kzalloc(&fn->dev, sizeof(struct f12_data) + mask_size 2, drivers/iommu/intel/perf.c:36: iommu->perf_statistic = kzalloc(sizeof(lstat) DMAR_LATENCY_NUM, drivers/iommu/mtk_iommu.c:783: protect = devm_kzalloc(dev, MTK_PROTECT_PA_ALIGN 2, GFP_KERNEL); drivers/iommu/mtk_iommu_v1.c:558: protect = devm_kzalloc(dev, MTK_PROTECT_PA_ALIGN 2, drivers/irqchip/irq-bcm6345-l1.c:255: cpu = intc->cpus[idx] = kzalloc(sizeof(cpu) + n_words sizeof(u32), drivers/irqchip/irq-bcm7038-l1.c:281: cpu = intc->cpus[idx] = kzalloc(sizeof(cpu) + n_words sizeof(u32), drivers/mailbox/arm_mhuv2.c:356: msg = kzalloc(sizeof(msg) + windows MHUV2_STAT_BYTES, GFP_KERNEL); drivers/mailbox/zynqmp-ipi-mailbox.c:589: chans = devm_kzalloc(mdev, 2 sizeof(chans), GFP_KERNEL); drivers/mailbox/zynqmp-ipi-mailbox.c:636: pdata = devm_kzalloc(dev, sizeof(pdata) + (num_mboxes sizeof(mbox)), drivers/md/dm-ps-io-affinity.c:119: s->path_map = kzalloc(nr_cpu_ids sizeof(struct path_info ), drivers/media/pci/ivtv/ivtv-yuv.c:922: yi->blanking_ptr = kzalloc(720 16, GFP_ATOMIC|GFP_NOWARN); drivers/media/pci/saa7164/saa7164-fw.c:82: srcbuf = kzalloc(4 1048576, GFP_KERNEL); drivers/media/platform/coda/coda-jpeg.c:740: kzalloc(sizeof(u32) CODA9_JPEG_ENC_HUFF_DATA_SIZE, drivers/media/usb/uvc/uvc_ctrl.c:2159: ctrl->uvc_data = kzalloc(ctrl->info.size UVC_CTRL_DATA_LAST + 1, drivers/misc/bcm-vk/bcm_vk_msg.c:838: data = kzalloc(num_blks VK_MSGQ_BLK_SIZE, GFP_KERNEL); drivers/misc/habanalabs/common/mmu/mmu_v1.c:277: ctx->dram_default_hops = kzalloc(HL_PTE_SIZE total_hops, GFP_KERNEL); drivers/misc/hi6421v600-irq.c:257: priv->irqs = devm_kzalloc(dev, PMIC_IRQ_LIST_MAX sizeof(int), GFP_KERNEL); drivers/mmc/core/sdio_cis.c:55: buffer = kzalloc(sizeof(char) nr_strings + size, GFP_KERNEL); drivers/mtd/nand/raw/mtk_nand.c:1386: chip = devm_kzalloc(dev, sizeof(chip) + nsels sizeof(u8), drivers/mtd/nand/raw/nand_base.c:1706: ddrbuf = kzalloc(len 2, GFP_KERNEL); drivers/mtd/nand/raw/nand_base.c:2074: ddrbuf = kzalloc(len 2, GFP_KERNEL); drivers/mtd/nand/raw/nand_hynix.c:315: rr = kzalloc(sizeof(rr) + (nregs nmodes), GFP_KERNEL); drivers/mtd/nand/raw/nand_onfi.c:165: pbuf = kzalloc((sizeof(pbuf) ONFI_PARAM_PAGES), GFP_KERNEL); drivers/mtd/nand/raw/rockchip-nand-controller.c:1120: rknand = devm_kzalloc(dev, sizeof(rknand) + nsels sizeof(u8), drivers/mtd/parsers/bcm63xxpart.c:96: parts = kzalloc(sizeof(parts) nrparts + 10 nrparts, GFP_KERNEL); drivers/mtd/parsers/parser_imagetag.c:153: parts = kzalloc(sizeof(parts) nrparts + 10 nrparts, GFP_KERNEL); drivers/mtd/parsers/redboot.c:241: parts = kzalloc(sizeof(parts) nrparts + nulllen + namelen, GFP_KERNEL); drivers/net/arcnet/com90xx.c:110: shmems = kzalloc(((0x100000 - 0xa0000) / 0x800) sizeof(unsigned long), drivers/net/arcnet/com90xx.c:114: iomem = kzalloc(((0x100000 - 0xa0000) / 0x800) sizeof(void __iomem ), drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c:474: rx_ring = kzalloc(sizeof(rx_ring) + rx_obj_size rx_obj_num, drivers/net/ethernet/broadcom/bcm4908_enet.c:173: ring->slots = kzalloc(ring->length sizeof(ring->slots), GFP_KERNEL); drivers/net/ethernet/broadcom/bnxt/bnxt.c:4389: bnapi = kzalloc(arr_size + size bp->cp_nr_rings, GFP_KERNEL); drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c:3245: key = kzalloc(key_size 2, GFP_KERNEL); drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c:560: key_buf = kzalloc(rule_cfg.key_size 2, GFP_KERNEL); drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:1085: data = devm_kzalloc(&handle->pdev->dev, max_queue_num sizeof(data), drivers/net/ethernet/huawei/hinic/hinic_ethtool.c:1065: kzalloc(sizeof(u32) HINIC_RSS_INDIR_SIZE, drivers/net/ethernet/huawei/hinic/hinic_ethtool.c:1083: kzalloc(HINIC_RSS_KEY_SIZE 2, GFP_KERNEL); drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c:709: tun_seg = devm_kzalloc(dev, sizeof(seg) ICE_FD_HW_SEG_MAX, drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c:1071: tun_seg = devm_kzalloc(dev, sizeof(seg) ICE_FD_HW_SEG_MAX, drivers/net/ethernet/intel/ice/ice_txrx.c:343: devm_kzalloc(dev, sizeof(tx_ring->tx_buf) tx_ring->count, drivers/net/ethernet/intel/ice/ice_txrx.c:467: devm_kzalloc(dev, sizeof(rx_ring->rx_buf) rx_ring->count, drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c:864: hw_dests = kzalloc(sizeof(hw_dests) num_of_dests, GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c:868: ref_actions = kzalloc(sizeof(ref_actions) num_of_dests 2, GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c:1088: hw_ste_arr = kzalloc(DR_RULE_MAX_STE_CHAIN DR_STE_SIZE, GFP_KERNEL); drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c:254: bf = kzalloc(struct_size(bf, refcnt, bf_bank_size num_erp_banks), drivers/net/ethernet/microsoft/mana/hw_channel.c:583: ctx = kzalloc(q_depth sizeof(struct hwc_caller_ctx), GFP_KERNEL); drivers/net/ethernet/qlogic/qed/qed_init_ops.c:545: p_hwfn->unzip_buf = kzalloc(MAX_ZIPPED_SIZE 4, GFP_ATOMIC); drivers/net/ethernet/rocker/rocker_main.c:196: alloc = kzalloc(ROCKER_TEST_DMA_BUF_SIZE 2 + offset, drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1107: actions = kzalloc(nk sizeof(actions), GFP_KERNEL); drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1113: act = kzalloc(nk sizeof(act), GFP_KERNEL); drivers/net/ethernet/ti/cpts.c:672: parent_names = devm_kzalloc(cpts->dev, (sizeof(char ) num_parents), drivers/net/ethernet/ti/cpts.c:675: mux_table = devm_kzalloc(cpts->dev, sizeof(mux_table) num_parents, drivers/net/virtio_net.c:1994: buf = kzalloc(((uc_count + mc_count) ETH_ALEN) + drivers/net/wireless/ath/ath11k/wmi.c:4049: svc_rdy_ext->mac_phy_caps = kzalloc((svc_rdy_ext->tot_phy_id) len, drivers/net/wireless/ath/ath11k/wmi.c:4450: reg_rule_ptr = kzalloc((num_reg_rules sizeof(reg_rule_ptr)), drivers/net/wireless/ath/wil6210/cfg80211.c:2744: kzalloc(n_combos sizeof(struct ieee80211_iface_combination) + drivers/net/wireless/intel/iwlegacy/common.c:3439: kzalloc((sizeof(struct ieee80211_rate) RATE_COUNT_LEGACY), drivers/net/wireless/mediatek/mt76/mt7615/testmode.c:119: b = devm_kzalloc(dev->mt76.dev, 4 (n_regs + n_rf_regs), drivers/net/wireless/mediatek/mt76/mt7915/testmode.c:351: b = devm_kzalloc(dev->mt76.dev, 4 n_regs, GFP_KERNEL); drivers/net/wireless/ralink/rt2x00/rt2x00debug.c:585: data = kzalloc(3 MAX_LINE_LENGTH, GFP_KERNEL); drivers/net/wireless/ralink/rt2x00/rt2x00debug.c:604: data = kzalloc(9 MAX_LINE_LENGTH, GFP_KERNEL); drivers/net/wireless/rsi/rsi_91x_mgmt.c:1333: selected_rates = kzalloc(2 RSI_TBL_SZ, GFP_KERNEL); drivers/net/wireless/ti/wlcore/spi.c:310: t = kzalloc(sizeof(t) 2 WSPI_MAX_NUM_OF_CHUNKS, GFP_KERNEL); drivers/nvme/target/passthru.c:317: host = kzalloc(sizeof(host) 2, GFP_KERNEL); drivers/pci/controller/dwc/pci-keystone.c:1162: phy = devm_kzalloc(dev, sizeof(phy) num_lanes, GFP_KERNEL); drivers/pci/controller/dwc/pci-keystone.c:1166: link = devm_kzalloc(dev, sizeof(link) num_lanes, GFP_KERNEL); drivers/phy/cadence/phy-cadence-sierra.c:492: parent_names = devm_kzalloc(dev, (sizeof(char ) num_parents), GFP_KERNEL); drivers/phy/ti/phy-am654-serdes.c:684: parent_names = devm_kzalloc(dev, (sizeof(char ) num_parents), drivers/phy/ti/phy-j721e-wiz.c:662: parent_names = kzalloc((sizeof(char ) num_parents), GFP_KERNEL); drivers/phy/ti/phy-j721e-wiz.c:727: parent_names = devm_kzalloc(dev, (sizeof(char ) num_parents), drivers/pinctrl/pinctrl-zynqmp.c:551: fgroups = devm_kzalloc(dev, sizeof(fgroups) func->ngroups, GFP_KERNEL); drivers/pinctrl/pinctrl-zynqmp.c:743: funcs = devm_kzalloc(dev, sizeof(funcs) pctrl->nfuncs, GFP_KERNEL); drivers/pinctrl/pinctrl-zynqmp.c:757: groups = devm_kzalloc(dev, sizeof(groups) pctrl->ngroups, GFP_KERNEL); drivers/pinctrl/pinctrl-zynqmp.c:819: pins = devm_kzalloc(dev, sizeof(pins) npins, GFP_KERNEL); drivers/pinctrl/qcom/pinctrl-sc8180x.c:1644: nres = devm_kzalloc(&pdev->dev, sizeof(nres) nres_num, GFP_KERNEL); drivers/platform/x86/intel/pmc/core.c:636: lpm_req_regs = devm_kzalloc(&pdev->dev, lpm_size sizeof(u32), drivers/s390/net/qeth_core_main.c:898: iob->data = kzalloc(ALIGN(length, 8) + ccws sizeof(struct ccw1), drivers/scsi/bnx2fc/bnx2fc_hwi.c:1892: hba->task_ctx = kzalloc((task_ctx_arr_sz sizeof(void )), drivers/scsi/csiostor/csio_init.c:701: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/csiostor/csio_init.c:740: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/csiostor/csio_init.c:778: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/csiostor/csio_init.c:819: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/csiostor/csio_init.c:858: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/cxlflash/superpipe.c:787: lli = kzalloc((MAX_RHT_PER_CONTEXT sizeof(lli)), GFP_KERNEL); drivers/scsi/cxlflash/superpipe.c:788: ws = kzalloc((MAX_RHT_PER_CONTEXT sizeof(ws)), GFP_KERNEL); drivers/scsi/cxlflash/vlun.c:92: bali->lun_alloc_map = kzalloc((bali->lun_bmap_size sizeof(u64)), drivers/scsi/cxlflash/vlun.c:122: bali->aun_clone_map = kzalloc((bali->total_aus sizeof(u8)), drivers/scsi/cxlflash/vlun.c:544: lxt = kzalloc((sizeof(lxt) LXT_GROUP_SIZE ngrps), drivers/scsi/cxlflash/vlun.c:647: lxt = kzalloc((sizeof(lxt) LXT_GROUP_SIZE ngrps), drivers/scsi/cxlflash/vlun.c:1112: lxt = kzalloc((sizeof(lxt) LXT_GROUP_SIZE ngrps), drivers/scsi/elx/efct/efct_hw.c:503: hw->wqe_buffs = kzalloc((hw->config.n_io hw->sli.wqe_size), drivers/scsi/elx/efct/efct_io.c:59: io->sgl = kzalloc(sizeof(io->sgl) num_sgl, GFP_KERNEL); drivers/scsi/lpfc/lpfc_sli.c:15903: queue = kzalloc_node(sizeof(queue) + (sizeof(void ) pgcnt), drivers/scsi/mpi3mr/mpi3mr_fw.c:709: mrioc->intr_info = kzalloc(sizeof(struct mpi3mr_intr_info) * max_vectors, drivers/soc/fsl/qbman/dpaa_sys.c:71: prop->value = res_array = devm_kzalloc(dev, sizeof(be32) 4, drivers/staging/r8188eu/core/rtw_xmit.c:1507: pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) pxmitpriv->hwxmit_entry, GFP_KERNEL); drivers/staging/r8188eu/hal/rtl8188eu_recv.c:44: precvpriv->pallocated_recv_buf = kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, drivers/staging/r8188eu/os_dep/osdep_service.c:26: void *a = kzalloc(h sizeof(void ) + h w size, GFP_KERNEL); drivers/staging/rtl8712/rtl8712_recv.c:45: kzalloc(NR_RECVBUFF sizeof(struct recv_buf) + 4, GFP_ATOMIC); drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1389: ssid = kzalloc(RTW_SSID_SCAN_AMOUNT sizeof(struct ndis_802_11_ssid), drivers/target/iscsi/iscsi_target_auth.c:47: challenge_asciihex = kzalloc(chap->challenge_len 2 + 1, GFP_KERNEL); drivers/target/iscsi/iscsi_target_auth.c:237: response = kzalloc(chap->digest_size 2 + 2, GFP_KERNEL); drivers/thunderbolt/property.c:549: p->value.text = kzalloc(p->length 4, GFP_KERNEL); drivers/thunderbolt/test.c:2568: block = kunit_kzalloc(test, block_len sizeof(u32), GFP_KERNEL); drivers/usb/atm/usbatm.c:1020: instance = kzalloc(sizeof(instance) + sizeof(struct urb ) (num_rcv_urbs + num_snd_urbs), GFP_KERNEL); drivers/usb/gadget/udc/pch_udc.c:2896: ep0out_buf = devm_kzalloc(&dev->pdev->dev, UDC_EP0OUT_BUFF_SIZE 4, drivers/usb/storage/isd200.c:1462: info->id = kzalloc(ATA_ID_WORDS 2, GFP_KERNEL); drivers/video/backlight/led_bl.c:92: leds = devm_kzalloc(dev, sizeof(struct led_classdev ) nb_leds, drivers/video/backlight/led_bl.c:140: levels = devm_kzalloc(dev, sizeof(u32) num_levels, drivers/video/fbdev/intelfb/intelfbdrv.c:508: info->pixmap.addr = kzalloc(64 1024, GFP_KERNEL); drivers/video/fbdev/nvidia/nvidia.c:1291: info->pixmap.addr = kzalloc(8 1024, GFP_KERNEL); drivers/video/fbdev/pxafb.c:1800: fbi = devm_kzalloc(dev, sizeof(struct pxafb_info) + sizeof(u32) 16, drivers/video/fbdev/riva/fbdev.c:1909: info->pixmap.addr = kzalloc(8 1024, GFP_KERNEL); fs/btrfs/scrub.c:2926: sparity = kzalloc(sizeof(struct scrub_parity) + 2 bitmap_len, fs/cifs/link.c:398: pfile_info = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX 2, fs/cifs/smb2file.c:41: smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX 2, fs/cifs/smb2inode.c:508: smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX 2, fs/cifs/smb2ops.c:1079: smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX 2, fs/cifs/smb2ops.c:3680: buf = kzalloc(1024 1024, GFP_KERNEL); fs/ext4/hash.c:301: buff = kzalloc(sizeof(char) PATH_MAX, GFP_KERNEL); fs/fs-writeback.c:569: isw = kzalloc(sizeof(isw) + 2 sizeof(struct inode ), GFP_ATOMIC); fs/fuse/fuse_i.h:900: pages = kzalloc(npages (sizeof(struct page ) + fs/nfsd/nfs4recover.c:1842: buf = kzalloc((srclen 2) + 1, GFP_KERNEL); fs/nfsd/nfs4xdr.c:2367: argp->ops = kzalloc(argp->opcnt sizeof(argp->ops), GFP_KERNEL); fs/ntfs3/frecord.c:2547: pages_disk = kzalloc(npages_disk sizeof(struct page ), GFP_NOFS); fs/ntfs3/inode.c:1112: rp = kzalloc(ntfs_reparse_bytes(2 size + 2), GFP_NOFS); fs/ocfs2/super.c:1964: osb->uuid_str = kzalloc(OCFS2_VOL_UUID_LEN 2 + 1, GFP_KERNEL); fs/xfs/xfs_buf.c:362: bp->b_pages = kzalloc(sizeof(struct page ) bp->b_page_count, include/rdma/ib_verbs.h:590: stats = kzalloc(sizeof(stats) + num_counters sizeof(u64), kernel/rcu/refscale.c:650: result_avg = kzalloc(nruns sizeof(result_avg), GFP_KERNEL); kernel/rcu/refscale.c:651: buf = kzalloc(64 + nruns 32, GFP_KERNEL); kernel/sched/topology.c:1828: sched_domains_numa_masks = kzalloc(sizeof(void ) nr_levels, GFP_KERNEL); kernel/sched/topology.c:1838: kzalloc(nr_node_ids sizeof(void ), GFP_KERNEL); lib/cpu_rmap.c:39: rmap = kzalloc(obj_offset + size sizeof(rmap->obj[0]), flags); lib/sbitmap.c:445: sbq->ws = kzalloc_node(SBQ_WAIT_QUEUES sizeof(sbq->ws), flags, node); lib/test_bpf.c:12359: progs = kzalloc(sizeof(progs) + (ntests + 1) sizeof(progs->ptrs[0]), net/ipv4/proc.c:480: buff = kzalloc(max(tcp_cnt sizeof(long), ip_cnt sizeof(u64)), net/mac80211/debugfs_sta.c:324: buf = kzalloc(71 + IEEE80211_NUM_TIDS 40, GFP_KERNEL); net/netfilter/ipset/ip_set_hash_gen.h:883: n = kzalloc(sizeof(n) + AHASH_INIT_SIZE set->dsize, net/netfilter/nft_set_pipapo.c:1117: scratch = kzalloc_node(bsize_max sizeof(scratch) 2 + security/apparmor/include/label.h:36: (V) = kzalloc(sizeof(struct aa_ ## T ) (N), (GFP)); \ security/apparmor/label.c:428: new = kzalloc(sizeof(new) + sizeof(struct aa_profile ) (size + 1), security/apparmor/policy.c:263: profile = kzalloc(sizeof(profile) + sizeof(struct aa_profile ) 2, security/integrity/ima/ima_api.c:355: hash = kzalloc((iint->ima_hash->length 2) + 1, GFP_KERNEL); sound/pci/cs46xx/dsp_spos.c:224: struct dsp_spos_instance ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL); sound/pci/ctxfi/ctdaio.c:162: entry = kzalloc((sizeof(entry) daio->rscl.msr), GFP_KERNEL); sound/pci/ctxfi/ctdaio.c:191: entry = kzalloc((sizeof(entry) daio->rscr.msr), GFP_KERNEL); sound/soc/atmel/atmel-classd.c:476: comp = devm_kzalloc(dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/atmel/atmel-pdmic.c:499: comp = devm_kzalloc(dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/atmel/mikroe-proto.c:89: comp = devm_kzalloc(&pdev->dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/atmel/sam9x5_wm8731.c:91: comp = devm_kzalloc(&pdev->dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/codecs/hdac_hdmi.c:1138: route = devm_kzalloc(dapm->dev, (sizeof(route) num_routes), sound/soc/fsl/imx-audmux.c:316: regcache = devm_kzalloc(&pdev->dev, sizeof(u32) reg_max, GFP_KERNEL); sound/soc/fsl/imx-card.c:519: dlc = devm_kzalloc(dev, 2 sizeof(dlc), GFP_KERNEL); sound/soc/fsl/imx-es8328.c:151: comp = devm_kzalloc(dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/fsl/imx-hdmi.c:108: dlc = devm_kzalloc(&pdev->dev, 3 sizeof(dlc), GFP_KERNEL); sound/soc/fsl/imx-rpmsg.c:42: dlc = devm_kzalloc(&pdev->dev, 3 sizeof(dlc), GFP_KERNEL); sound/soc/fsl/imx-sgtl5000.c:126: comp = devm_kzalloc(&pdev->dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/fsl/imx-spdif.c:29: comp = devm_kzalloc(&pdev->dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/fsl/mpc8610_hpcd.c:210: comp = devm_kzalloc(&pdev->dev, 6 sizeof(comp), GFP_KERNEL); sound/soc/fsl/p1022_ds.c:220: comp = devm_kzalloc(&pdev->dev, 6 sizeof(comp), GFP_KERNEL); sound/soc/fsl/p1022_rdk.c:223: comp = devm_kzalloc(&pdev->dev, 6 sizeof(comp), GFP_KERNEL); sound/soc/intel/boards/sof_sdw.c:991: c_conf = devm_kzalloc(dev, num_codecs sizeof(c_conf), GFP_KERNEL); sound/soc/meson/axg-card.c:123: dlc = devm_kzalloc(card->dev, 2 sizeof(dlc), GFP_KERNEL); sound/soc/qcom/common.c:58: dlc = devm_kzalloc(dev, 2 sizeof(dlc), GFP_KERNEL); sound/soc/qcom/qdsp6/q6asm.c:516: buf = kzalloc(((sizeof(struct audio_buffer)) periods), GFP_ATOMIC); sound/soc/soc-topology.c:635: p = devm_kzalloc(tplg->dev, item_len + 2 sizeof(unsigned int), GFP_KERNEL); sound/soc/soc-topology.c:1772: link = devm_kzalloc(tplg->dev, sizeof(link) + (3 sizeof(dlc)), GFP_KERNEL); sound/soc/sof/nocodec.c:35: dlc = devm_kzalloc(dev, 3 sizeof(dlc), GFP_KERNEL); sound/soc/sof/nocodec.c:81: links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) num_dai_drivers, GFP_KERNEL); sound/soc/ti/j721e-evm.c:655: compnent = devm_kzalloc(priv->dev, comp_count sizeof(compnent), sound/soc/ti/j721e-evm.c:759: compnent = devm_kzalloc(priv->dev, comp_count sizeof(compnent), sound/soc/ti/omap-hdmi.c:367: compnent = devm_kzalloc(dev, 3 sizeof(*compnent), GFP_KERNEL);
Why is this being done? It is to avoid wraparound from 32-bit multiplications occurring before a 64-bit promotion?
Audit and replace calls to kvzalloc() with its 2-factor multiplication argument form, kvcalloc(), when appropriate.
git grep -n kvzalloc | grep ' \ ' | grep -v ':\s\+\*' drivers/gpu/drm/nouveau/nouveau_svm.c:995: buffer->fault = kvzalloc(sizeof(buffer->fault) buffer->entries, GFP_KERNEL); drivers/iommu/dma-iommu.c:619: pages = kvzalloc(count sizeof(pages), GFP_KERNEL); drivers/net/ethernet/google/gve/gve_main.c:631: priv->tx = kvzalloc(priv->tx_cfg.num_queues sizeof(priv->tx), drivers/net/ethernet/google/gve/gve_main.c:644: priv->rx = kvzalloc(priv->rx_cfg.num_queues sizeof(priv->rx), drivers/net/ethernet/google/gve/gve_main.c:767: qpl->pages = kvzalloc(pages sizeof(qpl->pages), GFP_KERNEL); drivers/net/ethernet/google/gve/gve_main.c:771: qpl->page_buses = kvzalloc(pages sizeof(qpl->page_buses), drivers/net/ethernet/google/gve/gve_main.c:831: priv->qpls = kvzalloc(num_qpls sizeof(priv->qpls), GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/cmd.c:2061: cmd->stats = kvzalloc(MLX5_CMD_OP_MAX sizeof(cmd->stats), GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/en_main.c:934: xdpi_fifo->xi = kvzalloc_node(sizeof(xdpi_fifo->xi) dsegs_per_wq, drivers/net/ethernet/mellanox/mlx5/core/en_main.c:951: sq->db.wqe_info = kvzalloc_node(sizeof(sq->db.wqe_info) wq_sz, drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c:1012: flows = kvzalloc(num_vfs sizeof(flows), GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c:1191: flows = kvzalloc(nvports sizeof(flows), GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/fs_counters.c:500: bulk = kvzalloc(sizeof(bulk) + bulk_len sizeof(struct mlx5_fc), drivers/net/wireguard/ratelimiter.c:179: table_v4 = kvzalloc(table_size sizeof(table_v4), GFP_KERNEL); drivers/net/wireguard/ratelimiter.c:184: table_v6 = kvzalloc(table_size sizeof(table_v6), GFP_KERNEL); fs/xfs/xfs_ioctl.c:1550: buf = kvzalloc(bmx.bmv_count sizeof(buf), GFP_KERNEL); fs/xfs/xfs_ioctl.c:1604: recs = kvzalloc(count sizeof(struct fsmap), GFP_KERNEL); fs/xfs/xfs_ioctl.c:1608: recs = kvzalloc(count sizeof(struct fsmap), GFP_KERNEL); net/netfilter/nft_set_pipapo.c:641: new_lt = kvzalloc(f->groups NFT_PIPAPO_BUCKETS(f->bb) net/netfilter/nft_set_pipapo.c:1304: new_lt = kvzalloc(src->groups NFT_PIPAPO_BUCKETS(src->bb) *
git grep -n kzalloc | grep ' \ ' | grep -v ':\s\+\*' arch/alpha/kernel/pci-sysfs.c:206: attr = kzalloc(sizeof(attr) res_count + nlen1 + nlen2, GFP_ATOMIC); arch/mips/alchemy/common/clock.c:774: a = kzalloc((sizeof(a)) 6, GFP_KERNEL); arch/mips/n64/init.c:122: orig = kzalloc(W H 2 + 63, GFP_DMA | GFP_KERNEL); arch/powerpc/kvm/book3s_64_vio.c:298: stt = kzalloc(sizeof(stt) + npages sizeof(struct page ), arch/x86/kvm/x86.c:10664: vcpu->arch.mce_banks = kzalloc(KVM_MAX_MCE_BANKS sizeof(u64) 4, drivers/base/power/qos.c:204: n = kzalloc(3 sizeof(n), GFP_KERNEL); drivers/char/agp/frontend.c:168: seg = kzalloc((sizeof(struct agp_segment_priv) region->seg_count), GFP_KERNEL); drivers/clk/hisilicon/clk-hi3559a.c:464: p_clk = devm_kzalloc(dev, sizeof(p_clk) nums, GFP_KERNEL); drivers/clk/ti/composite.c:256: parent_names = kzalloc((sizeof(char ) num_parents), GFP_KERNEL); drivers/clk/ti/mux.c:190: parent_names = kzalloc((sizeof(char ) num_parents), GFP_KERNEL); drivers/cpufreq/cpufreq.c:1397: policy->min_freq_req = kzalloc(2 sizeof(policy->min_freq_req), drivers/cpufreq/sparc-us2e-cpufreq.c:329: us2e_freq_table = kzalloc((NR_CPUS sizeof(us2e_freq_table)), drivers/cpufreq/sparc-us3-cpufreq.c:177: us3_freq_table = kzalloc((NR_CPUS sizeof(us3_freq_table)), drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c:288: buf = kzalloc(bs 2, GFP_KERNEL | GFP_DMA); drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c:345: pad = kzalloc(algt->alg.hash.halg.base.cra_blocksize 2, GFP_KERNEL | GFP_DMA); drivers/crypto/axis/artpec6_crypto.c:2906: ac->pad_buffer = devm_kzalloc(&pdev->dev, 2 ARTPEC_CACHE_LINE_MAX, drivers/crypto/axis/artpec6_crypto.c:2912: ac->zero_buffer = devm_kzalloc(&pdev->dev, 2 ARTPEC_CACHE_LINE_MAX, drivers/crypto/hisilicon/qm.c:1738: sqe = kzalloc(qm->sqe_size QM_Q_DEPTH, GFP_KERNEL); drivers/crypto/qat/qat_common/adf_isr.c:232: irqs = kzalloc_node(msix_num_entries sizeof(irqs), drivers/dma/amba-pl08x.c:2869: pl08x->phy_chans = kzalloc((vd->channels sizeof(pl08x->phy_chans)), drivers/dma/milbeaut-hdmac.c:272: md->sgl = kzalloc(sizeof(sgl) sg_len, GFP_NOWAIT); drivers/dma/stm32-mdma.c:1569: dmadev = devm_kzalloc(&pdev->dev, sizeof(dmadev) + sizeof(u32) count, drivers/firmware/efi/apple-properties.c:82: key = kzalloc((key_len - sizeof(key_len)) 4 + 1, GFP_KERNEL); drivers/gpu/drm/amd/amdgpu/atom.c:1291: ctx->iio = kzalloc(2 256, GFP_KERNEL); drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c:3200: display_e2e_pipe_params_st pipes = kzalloc(dc->res_pool->pipe_count sizeof(display_e2e_pipe_params_st), GFP_ATOMIC); drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c:1343: display_e2e_pipe_params_st pipes = kzalloc(dc->res_pool->pipe_count sizeof(display_e2e_pipe_params_st), GFP_ATOMIC); drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c:2306: display_e2e_pipe_params_st pipes = kzalloc(dc->res_pool->pipe_count sizeof(display_e2e_pipe_params_st), GFP_KERNEL); drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c:1992: display_e2e_pipe_params_st pipes = kzalloc(dc->res_pool->pipe_count sizeof(display_e2e_pipe_params_st), GFP_KERNEL); drivers/gpu/drm/i915/display/intel_sdvo.c:472: buf = kzalloc(args_len 2 + 2, GFP_KERNEL); drivers/gpu/drm/i915/i915_syncmap.c:285: next = kzalloc(sizeof(next) + KSYNCMAP sizeof(next), drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c:86: kzalloc((nr objsize) + sizeof(obj), GFP_KERNEL); drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c:922: pstates = kzalloc(sizeof(pstates) DPU_STAGE_MAX 4, GFP_KERNEL); drivers/gpu/drm/radeon/atom.c:1252: ctx->iio = kzalloc(2 256, GFP_KERNEL); drivers/gpu/drm/radeon/radeon_display.c:680: radeon_crtc = kzalloc(sizeof(struct radeon_crtc) + (RADEONFB_CONN_LIMIT sizeof(struct drm_connector )), GFP_KERNEL); drivers/gpu/drm/tiny/repaper.c:1106: epd->current_frame = devm_kzalloc(dev, epd->width epd->height / 8, drivers/gpu/drm/tiny/simpledrm.c:287: sdev->clks = drmm_kzalloc(dev, sdev->clk_count sizeof(sdev->clks[0]), drivers/gpu/drm/vmwgfx/vmwgfx_surface.c:855: srf->snooper.image = kzalloc(64 64 4, GFP_KERNEL); drivers/hwmon/occ/common.c:867: occ->attrs = devm_kzalloc(dev, sizeof(occ->attrs) num_attrs, drivers/input/keyboard/gpio_keys_polled.c:154: pdata = devm_kzalloc(dev, sizeof(pdata) + nbuttons sizeof(button), drivers/input/rmi4/rmi_f11.c:1085: f11 = devm_kzalloc(&fn->dev, sizeof(struct f11_data) + mask_size 2, drivers/input/rmi4/rmi_f12.c:350: f12 = devm_kzalloc(&fn->dev, sizeof(struct f12_data) + mask_size 2, drivers/iommu/intel/perf.c:36: iommu->perf_statistic = kzalloc(sizeof(lstat) DMAR_LATENCY_NUM, drivers/iommu/mtk_iommu.c:783: protect = devm_kzalloc(dev, MTK_PROTECT_PA_ALIGN 2, GFP_KERNEL); drivers/iommu/mtk_iommu_v1.c:558: protect = devm_kzalloc(dev, MTK_PROTECT_PA_ALIGN 2, drivers/irqchip/irq-bcm6345-l1.c:255: cpu = intc->cpus[idx] = kzalloc(sizeof(cpu) + n_words sizeof(u32), drivers/irqchip/irq-bcm7038-l1.c:281: cpu = intc->cpus[idx] = kzalloc(sizeof(cpu) + n_words sizeof(u32), drivers/mailbox/arm_mhuv2.c:356: msg = kzalloc(sizeof(msg) + windows MHUV2_STAT_BYTES, GFP_KERNEL); drivers/mailbox/zynqmp-ipi-mailbox.c:589: chans = devm_kzalloc(mdev, 2 sizeof(chans), GFP_KERNEL); drivers/mailbox/zynqmp-ipi-mailbox.c:636: pdata = devm_kzalloc(dev, sizeof(pdata) + (num_mboxes sizeof(mbox)), drivers/md/dm-ps-io-affinity.c:119: s->path_map = kzalloc(nr_cpu_ids sizeof(struct path_info ), drivers/media/pci/ivtv/ivtv-yuv.c:922: yi->blanking_ptr = kzalloc(720 16, GFP_ATOMIC|GFP_NOWARN); drivers/media/pci/saa7164/saa7164-fw.c:82: srcbuf = kzalloc(4 1048576, GFP_KERNEL); drivers/media/platform/coda/coda-jpeg.c:740: kzalloc(sizeof(u32) CODA9_JPEG_ENC_HUFF_DATA_SIZE, drivers/media/usb/uvc/uvc_ctrl.c:2159: ctrl->uvc_data = kzalloc(ctrl->info.size UVC_CTRL_DATA_LAST + 1, drivers/misc/bcm-vk/bcm_vk_msg.c:838: data = kzalloc(num_blks VK_MSGQ_BLK_SIZE, GFP_KERNEL); drivers/misc/habanalabs/common/mmu/mmu_v1.c:277: ctx->dram_default_hops = kzalloc(HL_PTE_SIZE total_hops, GFP_KERNEL); drivers/misc/hi6421v600-irq.c:257: priv->irqs = devm_kzalloc(dev, PMIC_IRQ_LIST_MAX sizeof(int), GFP_KERNEL); drivers/mmc/core/sdio_cis.c:55: buffer = kzalloc(sizeof(char) nr_strings + size, GFP_KERNEL); drivers/mtd/nand/raw/mtk_nand.c:1386: chip = devm_kzalloc(dev, sizeof(chip) + nsels sizeof(u8), drivers/mtd/nand/raw/nand_base.c:1706: ddrbuf = kzalloc(len 2, GFP_KERNEL); drivers/mtd/nand/raw/nand_base.c:2074: ddrbuf = kzalloc(len 2, GFP_KERNEL); drivers/mtd/nand/raw/nand_hynix.c:315: rr = kzalloc(sizeof(rr) + (nregs nmodes), GFP_KERNEL); drivers/mtd/nand/raw/nand_onfi.c:165: pbuf = kzalloc((sizeof(pbuf) ONFI_PARAM_PAGES), GFP_KERNEL); drivers/mtd/nand/raw/rockchip-nand-controller.c:1120: rknand = devm_kzalloc(dev, sizeof(rknand) + nsels sizeof(u8), drivers/mtd/parsers/bcm63xxpart.c:96: parts = kzalloc(sizeof(parts) nrparts + 10 nrparts, GFP_KERNEL); drivers/mtd/parsers/parser_imagetag.c:153: parts = kzalloc(sizeof(parts) nrparts + 10 nrparts, GFP_KERNEL); drivers/mtd/parsers/redboot.c:241: parts = kzalloc(sizeof(parts) nrparts + nulllen + namelen, GFP_KERNEL); drivers/net/arcnet/com90xx.c:110: shmems = kzalloc(((0x100000 - 0xa0000) / 0x800) sizeof(unsigned long), drivers/net/arcnet/com90xx.c:114: iomem = kzalloc(((0x100000 - 0xa0000) / 0x800) sizeof(void __iomem ), drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c:474: rx_ring = kzalloc(sizeof(rx_ring) + rx_obj_size rx_obj_num, drivers/net/ethernet/broadcom/bcm4908_enet.c:173: ring->slots = kzalloc(ring->length sizeof(ring->slots), GFP_KERNEL); drivers/net/ethernet/broadcom/bnxt/bnxt.c:4389: bnapi = kzalloc(arr_size + size bp->cp_nr_rings, GFP_KERNEL); drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c:3245: key = kzalloc(key_size 2, GFP_KERNEL); drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c:560: key_buf = kzalloc(rule_cfg.key_size 2, GFP_KERNEL); drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c:1085: data = devm_kzalloc(&handle->pdev->dev, max_queue_num sizeof(data), drivers/net/ethernet/huawei/hinic/hinic_ethtool.c:1065: kzalloc(sizeof(u32) HINIC_RSS_INDIR_SIZE, drivers/net/ethernet/huawei/hinic/hinic_ethtool.c:1083: kzalloc(HINIC_RSS_KEY_SIZE 2, GFP_KERNEL); drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c:709: tun_seg = devm_kzalloc(dev, sizeof(seg) ICE_FD_HW_SEG_MAX, drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c:1071: tun_seg = devm_kzalloc(dev, sizeof(seg) ICE_FD_HW_SEG_MAX, drivers/net/ethernet/intel/ice/ice_txrx.c:343: devm_kzalloc(dev, sizeof(tx_ring->tx_buf) tx_ring->count, drivers/net/ethernet/intel/ice/ice_txrx.c:467: devm_kzalloc(dev, sizeof(rx_ring->rx_buf) rx_ring->count, drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c:864: hw_dests = kzalloc(sizeof(hw_dests) num_of_dests, GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c:868: ref_actions = kzalloc(sizeof(ref_actions) num_of_dests 2, GFP_KERNEL); drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c:1088: hw_ste_arr = kzalloc(DR_RULE_MAX_STE_CHAIN DR_STE_SIZE, GFP_KERNEL); drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_bloom_filter.c:254: bf = kzalloc(struct_size(bf, refcnt, bf_bank_size num_erp_banks), drivers/net/ethernet/microsoft/mana/hw_channel.c:583: ctx = kzalloc(q_depth sizeof(struct hwc_caller_ctx), GFP_KERNEL); drivers/net/ethernet/qlogic/qed/qed_init_ops.c:545: p_hwfn->unzip_buf = kzalloc(MAX_ZIPPED_SIZE 4, GFP_ATOMIC); drivers/net/ethernet/rocker/rocker_main.c:196: alloc = kzalloc(ROCKER_TEST_DMA_BUF_SIZE 2 + offset, drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1107: actions = kzalloc(nk sizeof(actions), GFP_KERNEL); drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1113: act = kzalloc(nk sizeof(act), GFP_KERNEL); drivers/net/ethernet/ti/cpts.c:672: parent_names = devm_kzalloc(cpts->dev, (sizeof(char ) num_parents), drivers/net/ethernet/ti/cpts.c:675: mux_table = devm_kzalloc(cpts->dev, sizeof(mux_table) num_parents, drivers/net/virtio_net.c:1994: buf = kzalloc(((uc_count + mc_count) ETH_ALEN) + drivers/net/wireless/ath/ath11k/wmi.c:4049: svc_rdy_ext->mac_phy_caps = kzalloc((svc_rdy_ext->tot_phy_id) len, drivers/net/wireless/ath/ath11k/wmi.c:4450: reg_rule_ptr = kzalloc((num_reg_rules sizeof(reg_rule_ptr)), drivers/net/wireless/ath/wil6210/cfg80211.c:2744: kzalloc(n_combos sizeof(struct ieee80211_iface_combination) + drivers/net/wireless/intel/iwlegacy/common.c:3439: kzalloc((sizeof(struct ieee80211_rate) RATE_COUNT_LEGACY), drivers/net/wireless/mediatek/mt76/mt7615/testmode.c:119: b = devm_kzalloc(dev->mt76.dev, 4 (n_regs + n_rf_regs), drivers/net/wireless/mediatek/mt76/mt7915/testmode.c:351: b = devm_kzalloc(dev->mt76.dev, 4 n_regs, GFP_KERNEL); drivers/net/wireless/ralink/rt2x00/rt2x00debug.c:585: data = kzalloc(3 MAX_LINE_LENGTH, GFP_KERNEL); drivers/net/wireless/ralink/rt2x00/rt2x00debug.c:604: data = kzalloc(9 MAX_LINE_LENGTH, GFP_KERNEL); drivers/net/wireless/rsi/rsi_91x_mgmt.c:1333: selected_rates = kzalloc(2 RSI_TBL_SZ, GFP_KERNEL); drivers/net/wireless/ti/wlcore/spi.c:310: t = kzalloc(sizeof(t) 2 WSPI_MAX_NUM_OF_CHUNKS, GFP_KERNEL); drivers/nvme/target/passthru.c:317: host = kzalloc(sizeof(host) 2, GFP_KERNEL); drivers/pci/controller/dwc/pci-keystone.c:1162: phy = devm_kzalloc(dev, sizeof(phy) num_lanes, GFP_KERNEL); drivers/pci/controller/dwc/pci-keystone.c:1166: link = devm_kzalloc(dev, sizeof(link) num_lanes, GFP_KERNEL); drivers/phy/cadence/phy-cadence-sierra.c:492: parent_names = devm_kzalloc(dev, (sizeof(char ) num_parents), GFP_KERNEL); drivers/phy/ti/phy-am654-serdes.c:684: parent_names = devm_kzalloc(dev, (sizeof(char ) num_parents), drivers/phy/ti/phy-j721e-wiz.c:662: parent_names = kzalloc((sizeof(char ) num_parents), GFP_KERNEL); drivers/phy/ti/phy-j721e-wiz.c:727: parent_names = devm_kzalloc(dev, (sizeof(char ) num_parents), drivers/pinctrl/pinctrl-zynqmp.c:551: fgroups = devm_kzalloc(dev, sizeof(fgroups) func->ngroups, GFP_KERNEL); drivers/pinctrl/pinctrl-zynqmp.c:743: funcs = devm_kzalloc(dev, sizeof(funcs) pctrl->nfuncs, GFP_KERNEL); drivers/pinctrl/pinctrl-zynqmp.c:757: groups = devm_kzalloc(dev, sizeof(groups) pctrl->ngroups, GFP_KERNEL); drivers/pinctrl/pinctrl-zynqmp.c:819: pins = devm_kzalloc(dev, sizeof(pins) npins, GFP_KERNEL); drivers/pinctrl/qcom/pinctrl-sc8180x.c:1644: nres = devm_kzalloc(&pdev->dev, sizeof(nres) nres_num, GFP_KERNEL); drivers/platform/x86/intel/pmc/core.c:636: lpm_req_regs = devm_kzalloc(&pdev->dev, lpm_size sizeof(u32), drivers/s390/net/qeth_core_main.c:898: iob->data = kzalloc(ALIGN(length, 8) + ccws sizeof(struct ccw1), drivers/scsi/bnx2fc/bnx2fc_hwi.c:1892: hba->task_ctx = kzalloc((task_ctx_arr_sz sizeof(void )), drivers/scsi/csiostor/csio_init.c:701: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/csiostor/csio_init.c:740: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/csiostor/csio_init.c:778: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/csiostor/csio_init.c:819: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/csiostor/csio_init.c:858: lnode_list = kzalloc((sizeof(struct csio_lnode ) hw->num_lns), drivers/scsi/cxlflash/superpipe.c:787: lli = kzalloc((MAX_RHT_PER_CONTEXT sizeof(lli)), GFP_KERNEL); drivers/scsi/cxlflash/superpipe.c:788: ws = kzalloc((MAX_RHT_PER_CONTEXT sizeof(ws)), GFP_KERNEL); drivers/scsi/cxlflash/vlun.c:92: bali->lun_alloc_map = kzalloc((bali->lun_bmap_size sizeof(u64)), drivers/scsi/cxlflash/vlun.c:122: bali->aun_clone_map = kzalloc((bali->total_aus sizeof(u8)), drivers/scsi/cxlflash/vlun.c:544: lxt = kzalloc((sizeof(lxt) LXT_GROUP_SIZE ngrps), drivers/scsi/cxlflash/vlun.c:647: lxt = kzalloc((sizeof(lxt) LXT_GROUP_SIZE ngrps), drivers/scsi/cxlflash/vlun.c:1112: lxt = kzalloc((sizeof(lxt) LXT_GROUP_SIZE ngrps), drivers/scsi/elx/efct/efct_hw.c:503: hw->wqe_buffs = kzalloc((hw->config.n_io hw->sli.wqe_size), drivers/scsi/elx/efct/efct_io.c:59: io->sgl = kzalloc(sizeof(io->sgl) num_sgl, GFP_KERNEL); drivers/scsi/lpfc/lpfc_sli.c:15903: queue = kzalloc_node(sizeof(queue) + (sizeof(void ) pgcnt), drivers/scsi/mpi3mr/mpi3mr_fw.c:709: mrioc->intr_info = kzalloc(sizeof(struct mpi3mr_intr_info) * max_vectors, drivers/soc/fsl/qbman/dpaa_sys.c:71: prop->value = res_array = devm_kzalloc(dev, sizeof(be32) 4, drivers/staging/r8188eu/core/rtw_xmit.c:1507: pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) pxmitpriv->hwxmit_entry, GFP_KERNEL); drivers/staging/r8188eu/hal/rtl8188eu_recv.c:44: precvpriv->pallocated_recv_buf = kzalloc(NR_RECVBUFF * sizeof(struct recv_buf) + 4, drivers/staging/r8188eu/os_dep/osdep_service.c:26: void *a = kzalloc(h sizeof(void ) + h w size, GFP_KERNEL); drivers/staging/rtl8712/rtl8712_recv.c:45: kzalloc(NR_RECVBUFF sizeof(struct recv_buf) + 4, GFP_ATOMIC); drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:1389: ssid = kzalloc(RTW_SSID_SCAN_AMOUNT sizeof(struct ndis_802_11_ssid), drivers/target/iscsi/iscsi_target_auth.c:47: challenge_asciihex = kzalloc(chap->challenge_len 2 + 1, GFP_KERNEL); drivers/target/iscsi/iscsi_target_auth.c:237: response = kzalloc(chap->digest_size 2 + 2, GFP_KERNEL); drivers/thunderbolt/property.c:549: p->value.text = kzalloc(p->length 4, GFP_KERNEL); drivers/thunderbolt/test.c:2568: block = kunit_kzalloc(test, block_len sizeof(u32), GFP_KERNEL); drivers/usb/atm/usbatm.c:1020: instance = kzalloc(sizeof(instance) + sizeof(struct urb ) (num_rcv_urbs + num_snd_urbs), GFP_KERNEL); drivers/usb/gadget/udc/pch_udc.c:2896: ep0out_buf = devm_kzalloc(&dev->pdev->dev, UDC_EP0OUT_BUFF_SIZE 4, drivers/usb/storage/isd200.c:1462: info->id = kzalloc(ATA_ID_WORDS 2, GFP_KERNEL); drivers/video/backlight/led_bl.c:92: leds = devm_kzalloc(dev, sizeof(struct led_classdev ) nb_leds, drivers/video/backlight/led_bl.c:140: levels = devm_kzalloc(dev, sizeof(u32) num_levels, drivers/video/fbdev/intelfb/intelfbdrv.c:508: info->pixmap.addr = kzalloc(64 1024, GFP_KERNEL); drivers/video/fbdev/nvidia/nvidia.c:1291: info->pixmap.addr = kzalloc(8 1024, GFP_KERNEL); drivers/video/fbdev/pxafb.c:1800: fbi = devm_kzalloc(dev, sizeof(struct pxafb_info) + sizeof(u32) 16, drivers/video/fbdev/riva/fbdev.c:1909: info->pixmap.addr = kzalloc(8 1024, GFP_KERNEL); fs/btrfs/scrub.c:2926: sparity = kzalloc(sizeof(struct scrub_parity) + 2 bitmap_len, fs/cifs/link.c:398: pfile_info = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX 2, fs/cifs/smb2file.c:41: smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX 2, fs/cifs/smb2inode.c:508: smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX 2, fs/cifs/smb2ops.c:1079: smb2_data = kzalloc(sizeof(struct smb2_file_all_info) + PATH_MAX 2, fs/cifs/smb2ops.c:3680: buf = kzalloc(1024 1024, GFP_KERNEL); fs/ext4/hash.c:301: buff = kzalloc(sizeof(char) PATH_MAX, GFP_KERNEL); fs/fs-writeback.c:569: isw = kzalloc(sizeof(isw) + 2 sizeof(struct inode ), GFP_ATOMIC); fs/fuse/fuse_i.h:900: pages = kzalloc(npages (sizeof(struct page ) + fs/nfsd/nfs4recover.c:1842: buf = kzalloc((srclen 2) + 1, GFP_KERNEL); fs/nfsd/nfs4xdr.c:2367: argp->ops = kzalloc(argp->opcnt sizeof(argp->ops), GFP_KERNEL); fs/ntfs3/frecord.c:2547: pages_disk = kzalloc(npages_disk sizeof(struct page ), GFP_NOFS); fs/ntfs3/inode.c:1112: rp = kzalloc(ntfs_reparse_bytes(2 size + 2), GFP_NOFS); fs/ocfs2/super.c:1964: osb->uuid_str = kzalloc(OCFS2_VOL_UUID_LEN 2 + 1, GFP_KERNEL); fs/xfs/xfs_buf.c:362: bp->b_pages = kzalloc(sizeof(struct page ) bp->b_page_count, include/rdma/ib_verbs.h:590: stats = kzalloc(sizeof(stats) + num_counters sizeof(u64), kernel/rcu/refscale.c:650: result_avg = kzalloc(nruns sizeof(result_avg), GFP_KERNEL); kernel/rcu/refscale.c:651: buf = kzalloc(64 + nruns 32, GFP_KERNEL); kernel/sched/topology.c:1828: sched_domains_numa_masks = kzalloc(sizeof(void ) nr_levels, GFP_KERNEL); kernel/sched/topology.c:1838: kzalloc(nr_node_ids sizeof(void ), GFP_KERNEL); lib/cpu_rmap.c:39: rmap = kzalloc(obj_offset + size sizeof(rmap->obj[0]), flags); lib/sbitmap.c:445: sbq->ws = kzalloc_node(SBQ_WAIT_QUEUES sizeof(sbq->ws), flags, node); lib/test_bpf.c:12359: progs = kzalloc(sizeof(progs) + (ntests + 1) sizeof(progs->ptrs[0]), net/ipv4/proc.c:480: buff = kzalloc(max(tcp_cnt sizeof(long), ip_cnt sizeof(u64)), net/mac80211/debugfs_sta.c:324: buf = kzalloc(71 + IEEE80211_NUM_TIDS 40, GFP_KERNEL); net/netfilter/ipset/ip_set_hash_gen.h:883: n = kzalloc(sizeof(n) + AHASH_INIT_SIZE set->dsize, net/netfilter/nft_set_pipapo.c:1117: scratch = kzalloc_node(bsize_max sizeof(scratch) 2 + security/apparmor/include/label.h:36: (V) = kzalloc(sizeof(struct aa_ ## T ) (N), (GFP)); \ security/apparmor/label.c:428: new = kzalloc(sizeof(new) + sizeof(struct aa_profile ) (size + 1), security/apparmor/policy.c:263: profile = kzalloc(sizeof(profile) + sizeof(struct aa_profile ) 2, security/integrity/ima/ima_api.c:355: hash = kzalloc((iint->ima_hash->length 2) + 1, GFP_KERNEL); sound/pci/cs46xx/dsp_spos.c:224: struct dsp_spos_instance ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL); sound/pci/ctxfi/ctdaio.c:162: entry = kzalloc((sizeof(entry) daio->rscl.msr), GFP_KERNEL); sound/pci/ctxfi/ctdaio.c:191: entry = kzalloc((sizeof(entry) daio->rscr.msr), GFP_KERNEL); sound/soc/atmel/atmel-classd.c:476: comp = devm_kzalloc(dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/atmel/atmel-pdmic.c:499: comp = devm_kzalloc(dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/atmel/mikroe-proto.c:89: comp = devm_kzalloc(&pdev->dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/atmel/sam9x5_wm8731.c:91: comp = devm_kzalloc(&pdev->dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/codecs/hdac_hdmi.c:1138: route = devm_kzalloc(dapm->dev, (sizeof(route) num_routes), sound/soc/fsl/imx-audmux.c:316: regcache = devm_kzalloc(&pdev->dev, sizeof(u32) reg_max, GFP_KERNEL); sound/soc/fsl/imx-card.c:519: dlc = devm_kzalloc(dev, 2 sizeof(dlc), GFP_KERNEL); sound/soc/fsl/imx-es8328.c:151: comp = devm_kzalloc(dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/fsl/imx-hdmi.c:108: dlc = devm_kzalloc(&pdev->dev, 3 sizeof(dlc), GFP_KERNEL); sound/soc/fsl/imx-rpmsg.c:42: dlc = devm_kzalloc(&pdev->dev, 3 sizeof(dlc), GFP_KERNEL); sound/soc/fsl/imx-sgtl5000.c:126: comp = devm_kzalloc(&pdev->dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/fsl/imx-spdif.c:29: comp = devm_kzalloc(&pdev->dev, 3 sizeof(comp), GFP_KERNEL); sound/soc/fsl/mpc8610_hpcd.c:210: comp = devm_kzalloc(&pdev->dev, 6 sizeof(comp), GFP_KERNEL); sound/soc/fsl/p1022_ds.c:220: comp = devm_kzalloc(&pdev->dev, 6 sizeof(comp), GFP_KERNEL); sound/soc/fsl/p1022_rdk.c:223: comp = devm_kzalloc(&pdev->dev, 6 sizeof(comp), GFP_KERNEL); sound/soc/intel/boards/sof_sdw.c:991: c_conf = devm_kzalloc(dev, num_codecs sizeof(c_conf), GFP_KERNEL); sound/soc/meson/axg-card.c:123: dlc = devm_kzalloc(card->dev, 2 sizeof(dlc), GFP_KERNEL); sound/soc/qcom/common.c:58: dlc = devm_kzalloc(dev, 2 sizeof(dlc), GFP_KERNEL); sound/soc/qcom/qdsp6/q6asm.c:516: buf = kzalloc(((sizeof(struct audio_buffer)) periods), GFP_ATOMIC); sound/soc/soc-topology.c:635: p = devm_kzalloc(tplg->dev, item_len + 2 sizeof(unsigned int), GFP_KERNEL); sound/soc/soc-topology.c:1772: link = devm_kzalloc(tplg->dev, sizeof(link) + (3 sizeof(dlc)), GFP_KERNEL); sound/soc/sof/nocodec.c:35: dlc = devm_kzalloc(dev, 3 sizeof(dlc), GFP_KERNEL); sound/soc/sof/nocodec.c:81: links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) num_dai_drivers, GFP_KERNEL); sound/soc/ti/j721e-evm.c:655: compnent = devm_kzalloc(priv->dev, comp_count sizeof(compnent), sound/soc/ti/j721e-evm.c:759: compnent = devm_kzalloc(priv->dev, comp_count sizeof(compnent), sound/soc/ti/omap-hdmi.c:367: compnent = devm_kzalloc(dev, 3 sizeof(*compnent), GFP_KERNEL);