summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-21 23:46:04 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-22 08:26:33 -0800
commit189f164e573e18d9f8876dbd3ad8fcbe11f93037 (patch)
tree733382723a15ea29b7c9f3dde3bcb281f0b3c287 /drivers/iommu
parent32a92f8c89326985e05dce8b22d3f0aa07a3e1bd (diff)
Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses
Conversion performed via this Coccinelle script: // SPDX-License-Identifier: GPL-2.0-only // Options: --include-headers-for-types --all-includes --include-headers --keep-comments virtual patch @gfp depends on patch && !(file in "tools") && !(file in "samples")@ identifier ALLOC = {kmalloc_obj,kmalloc_objs,kmalloc_flex, kzalloc_obj,kzalloc_objs,kzalloc_flex, kvmalloc_obj,kvmalloc_objs,kvmalloc_flex, kvzalloc_obj,kvzalloc_objs,kvzalloc_flex}; @@ ALLOC(... - , GFP_KERNEL ) $ make coccicheck MODE=patch COCCI=gfp.cocci Build and boot tested x86_64 with Fedora 42's GCC and Clang: Linux version 6.19.0+ (user@host) (gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7), GNU ld version 2.44-12.fc42) #1 SMP PREEMPT_DYNAMIC 1970-01-01 Linux version 6.19.0+ (user@host) (clang version 20.1.8 (Fedora 20.1.8-4.fc42), LLD 20.1.8) #1 SMP PREEMPT_DYNAMIC 1970-01-01 Signed-off-by: Kees Cook <kees@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd/init.c8
-rw-r--r--drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c3
-rw-r--r--drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c2
-rw-r--r--drivers/iommu/iova.c2
4 files changed, 6 insertions, 9 deletions
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index a05aed1fe5e9..f3fd7f39efb4 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -660,8 +660,7 @@ static inline void free_dev_table(struct amd_iommu_pci_seg *pci_seg)
static inline int __init alloc_rlookup_table(struct amd_iommu_pci_seg *pci_seg)
{
pci_seg->rlookup_table = kvzalloc_objs(*pci_seg->rlookup_table,
- pci_seg->last_bdf + 1,
- GFP_KERNEL);
+ pci_seg->last_bdf + 1);
if (pci_seg->rlookup_table == NULL)
return -ENOMEM;
@@ -677,8 +676,7 @@ static inline void free_rlookup_table(struct amd_iommu_pci_seg *pci_seg)
static inline int __init alloc_irq_lookup_table(struct amd_iommu_pci_seg *pci_seg)
{
pci_seg->irq_lookup_table = kvzalloc_objs(*pci_seg->irq_lookup_table,
- pci_seg->last_bdf + 1,
- GFP_KERNEL);
+ pci_seg->last_bdf + 1);
if (pci_seg->irq_lookup_table == NULL)
return -ENOMEM;
@@ -696,7 +694,7 @@ static int __init alloc_alias_table(struct amd_iommu_pci_seg *pci_seg)
int i;
pci_seg->alias_table = kvmalloc_objs(*pci_seg->alias_table,
- pci_seg->last_bdf + 1, GFP_KERNEL);
+ pci_seg->last_bdf + 1);
if (!pci_seg->alias_table)
return -ENOMEM;
diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index d60ba624105c..4d00d796f078 100644
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
@@ -1515,8 +1515,7 @@ static int arm_smmu_alloc_cd_tables(struct arm_smmu_master *master)
DIV_ROUND_UP(max_contexts, CTXDESC_L2_ENTRIES);
cd_table->l2.l2ptrs = kzalloc_objs(*cd_table->l2.l2ptrs,
- cd_table->l2.num_l1_ents,
- GFP_KERNEL);
+ cd_table->l2.num_l1_ents);
if (!cd_table->l2.l2ptrs)
return -ENOMEM;
diff --git a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
index 8dcde926794d..6fe5563eaf9e 100644
--- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
+++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
@@ -743,7 +743,7 @@ static int tegra241_cmdqv_init_vintf(struct tegra241_cmdqv *cmdqv, u16 max_idx,
vintf->base = cmdqv->base + TEGRA241_VINTF(idx);
vintf->lvcmdqs = kzalloc_objs(*vintf->lvcmdqs,
- cmdqv->num_lvcmdqs_per_vintf, GFP_KERNEL);
+ cmdqv->num_lvcmdqs_per_vintf);
if (!vintf->lvcmdqs) {
ida_free(&cmdqv->vintf_ids, idx);
return -ENOMEM;
diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index ac9d6a4c1432..f9cd18316d16 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -716,7 +716,7 @@ int iova_domain_init_rcaches(struct iova_domain *iovad)
int i, ret;
iovad->rcaches = kzalloc_objs(struct iova_rcache,
- IOVA_RANGE_CACHE_MAX_SIZE, GFP_KERNEL);
+ IOVA_RANGE_CACHE_MAX_SIZE);
if (!iovad->rcaches)
return -ENOMEM;