summaryrefslogtreecommitdiff
path: root/drivers/md
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/md
parent32a92f8c89326985e05dce8b22d3f0aa07a3e1bd (diff)
Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL usesHEADtorvalds/mastertorvalds/HEADmaster
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/md')
-rw-r--r--drivers/md/dm-crypt.c2
-rw-r--r--drivers/md/dm-integrity.c4
-rw-r--r--drivers/md/dm-pcache/cache.c2
-rw-r--r--drivers/md/dm-pcache/cache_key.c2
-rw-r--r--drivers/md/dm-stats.c2
-rw-r--r--drivers/md/md-cluster.c2
-rw-r--r--drivers/md/raid10.c6
7 files changed, 9 insertions, 11 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 00d36d4aca52..54823341c9fd 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -2335,7 +2335,7 @@ static int crypt_alloc_tfms_skcipher(struct crypt_config *cc, char *ciphermode)
int err;
cc->cipher_tfm.tfms = kzalloc_objs(struct crypto_skcipher *,
- cc->tfms_count, GFP_KERNEL);
+ cc->tfms_count);
if (!cc->cipher_tfm.tfms)
return -ENOMEM;
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index a52ee38dc30c..06e805902151 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -4500,7 +4500,7 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
}
sg = kvmalloc_objs(struct scatterlist,
- ic->journal_pages + 1, GFP_KERNEL);
+ ic->journal_pages + 1);
if (!sg) {
*error = "Unable to allocate sg list";
r = -ENOMEM;
@@ -5271,7 +5271,7 @@ try_smaller_buffer:
goto bad;
}
ic->bbs = kvmalloc_objs(struct bitmap_block_status,
- ic->n_bitmap_blocks, GFP_KERNEL);
+ ic->n_bitmap_blocks);
if (!ic->bbs) {
ti->error = "Could not allocate memory for bitmap";
r = -ENOMEM;
diff --git a/drivers/md/dm-pcache/cache.c b/drivers/md/dm-pcache/cache.c
index a616255b83e2..bb1ada31e483 100644
--- a/drivers/md/dm-pcache/cache.c
+++ b/drivers/md/dm-pcache/cache.c
@@ -139,7 +139,7 @@ static int cache_init(struct dm_pcache *pcache)
int ret;
cache->segments = kvzalloc_objs(struct pcache_cache_segment,
- cache_dev->seg_num, GFP_KERNEL);
+ cache_dev->seg_num);
if (!cache->segments) {
ret = -ENOMEM;
goto err;
diff --git a/drivers/md/dm-pcache/cache_key.c b/drivers/md/dm-pcache/cache_key.c
index 3de356abf952..e068e878231b 100644
--- a/drivers/md/dm-pcache/cache_key.c
+++ b/drivers/md/dm-pcache/cache_key.c
@@ -838,7 +838,7 @@ int cache_tree_init(struct pcache_cache *cache, struct pcache_cache_tree *cache_
* an RB tree root and a spinlock for protecting its contents.
*/
cache_tree->subtrees = kvzalloc_objs(struct pcache_cache_subtree,
- cache_tree->n_subtrees, GFP_KERNEL);
+ cache_tree->n_subtrees);
if (!cache_tree->subtrees) {
ret = -ENOMEM;
goto key_pool_exit;
diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
index b26656dea4ec..c53cf07ab7b0 100644
--- a/drivers/md/dm-stats.c
+++ b/drivers/md/dm-stats.c
@@ -972,7 +972,7 @@ static int parse_histogram(const char *h, unsigned int *n_histogram_entries,
(*n_histogram_entries)++;
*histogram_boundaries = kmalloc_objs(unsigned long long,
- *n_histogram_entries, GFP_KERNEL);
+ *n_histogram_entries);
if (!*histogram_boundaries)
return -ENOMEM;
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 856e4b3c2bde..24dac6f09da8 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -1544,7 +1544,7 @@ static int lock_all_bitmaps(struct mddev *mddev)
cinfo->other_bitmap_lockres =
kzalloc_objs(struct dlm_lock_resource *,
- mddev->bitmap_info.nodes - 1, GFP_KERNEL);
+ mddev->bitmap_info.nodes - 1);
if (!cinfo->other_bitmap_lockres) {
pr_err("md: can't alloc mem for other bitmap locks\n");
return 0;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 968bc83b8597..0653b5d8545a 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3858,8 +3858,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
/* FIXME calc properly */
conf->mirrors = kzalloc_objs(struct raid10_info,
- mddev->raid_disks + max(0, -mddev->delta_disks),
- GFP_KERNEL);
+ mddev->raid_disks + max(0, -mddev->delta_disks));
if (!conf->mirrors)
goto out;
@@ -4282,8 +4281,7 @@ static int raid10_check_reshape(struct mddev *mddev)
/* allocate new 'mirrors' list */
conf->mirrors_new =
kzalloc_objs(struct raid10_info,
- mddev->raid_disks + mddev->delta_disks,
- GFP_KERNEL);
+ mddev->raid_disks + mddev->delta_disks);
if (!conf->mirrors_new)
return -ENOMEM;
}