linux/fs/btrfs
Kees Cook 189f164e57 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>
2026-02-22 08:26:33 -08:00
..
tests Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
accessors.c btrfs: fix typos in comments and strings 2025-09-23 08:49:16 +02:00
accessors.h btrfs: allow mounting filesystems with remap-tree incompat flag 2026-02-03 07:54:35 +01:00
acl.c posix_acl: make posix_acl_to_xattr() alloc the buffer 2026-01-16 10:51:12 +01:00
acl.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
async-thread.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
async-thread.h
backref.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
backref.h btrfs: declare free_ipath() via DEFINE_FREE() 2025-11-24 22:34:51 +01:00
bio.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
bio.h btrfs: move existing remaps before relocating block group 2026-02-03 07:54:35 +01:00
block-group.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
block-group.h btrfs: populate fully_remapped_bgs_list on mount 2026-02-03 07:54:36 +01:00
block-rsv.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
block-rsv.h btrfs: add METADATA_REMAP chunk type 2026-02-03 07:54:27 +01:00
btrfs_inode.h fsverity: use a hashtable to find the fsverity_info 2026-02-04 11:31:54 -08:00
compression.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
compression.h btrfs: get rid of compressed_bio::compressed_folios[] 2026-02-03 07:59:07 +01:00
ctree.c btrfs: merge setting ret and return ret 2026-02-03 06:38:33 +01:00
ctree.h btrfs: introduce BTRFS_PATH_AUTO_RELEASE() helper 2026-02-03 06:38:32 +01:00
defrag.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
defrag.h btrfs: pass struct btrfs_inode to btrfs_defrag_file() 2025-03-18 20:35:43 +01:00
delalloc-space.c btrfs: remove fs_info argument from btrfs_reserve_metadata_bytes() 2025-11-24 21:59:11 +01:00
delalloc-space.h btrfs: pass struct btrfs_inode to btrfs_free_reserved_data_space_noquota() 2025-05-15 14:30:52 +02:00
delayed-inode.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
delayed-inode.h btrfs: embed delayed root to struct btrfs_fs_info 2026-02-03 07:56:20 +01:00
delayed-ref.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
delayed-ref.h btrfs: move ref-verify under CONFIG_BTRFS_DEBUG 2025-09-22 10:54:32 +02:00
dev-replace.c btrfs: use bool type for btrfs_path members used as booleans 2025-11-24 22:42:25 +01:00
dev-replace.h btrfs: trivial conversion to return bool instead of int 2025-05-15 14:30:49 +02:00
dir-item.c btrfs: remaining BTRFS_PATH_AUTO_FREE conversions 2025-11-25 01:53:33 +01:00
dir-item.h btrfs: rename inode number parameter passed to btrfs_check_dir_item_collision() 2025-07-22 00:05:00 +02:00
direct-io.c btrfs: fallback to buffered IO if the data profile has duplication 2026-02-03 07:56:19 +01:00
direct-io.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
discard.c btrfs: handle discarding fully-remapped block groups 2026-02-03 07:54:36 +01:00
discard.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
disk-io.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
disk-io.h btrfs: headers cleanup to remove unnecessary local includes 2025-11-24 22:34:52 +01:00
export.c btrfs: avoid potential out-of-bounds in btrfs_encode_fh() 2025-09-26 08:48:30 +02:00
export.h
extent-io-tree.c btrfs: merge setting ret and return ret 2026-02-03 06:38:33 +01:00
extent-io-tree.h btrfs: convert several int parameters to bool 2025-09-22 10:54:32 +02:00
extent-tree.c btrfs: fix transaction commit blocking during trim of unallocated space 2026-02-03 07:56:25 +01:00
extent-tree.h btrfs: add do_remap parameter to btrfs_discard_extent() 2026-02-03 07:54:35 +01:00
extent_io.c fsverity updates for 7.0 2026-02-12 10:41:34 -08:00
extent_io.h Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
extent_map.c btrfs: add strict extent map alignment checks 2026-02-03 07:56:19 +01:00
extent_map.h btrfs: headers cleanup to remove unnecessary local includes 2025-11-24 22:34:52 +01:00
fiemap.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
fiemap.h btrfs: move fiemap code into its own file 2024-07-11 15:33:20 +02:00
file-item.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
file-item.h btrfs: introduce btrfs_bio::async_csum 2025-11-24 22:42:21 +01:00
file.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
file.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
free-space-cache.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
free-space-cache.h btrfs: handle discarding fully-remapped block groups 2026-02-03 07:54:36 +01:00
free-space-tree.c btrfs: use the btrfs_block_group_end() helper everywhere 2026-02-03 07:54:36 +01:00
free-space-tree.h btrfs: handle setting up relocation of block group with remap-tree 2026-02-03 07:54:35 +01:00
fs.c btrfs: switch to library APIs for checksums 2026-02-03 06:38:32 +01:00
fs.h btrfs: fix transaction commit blocking during trim of unallocated space 2026-02-03 07:56:25 +01:00
inode-item.c btrfs: merge setting ret and return ret 2026-02-03 06:38:33 +01:00
inode-item.h btrfs: remove unused parameters from btrfs_lookup_inode_extref() 2025-07-21 23:58:03 +02:00
inode.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ioctl.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
ioctl.h tree-wide: s/struct fileattr/struct file_kattr/g 2025-07-04 16:14:39 +02:00
Kconfig btrfs: allow mounting filesystems with remap-tree incompat flag 2026-02-03 07:54:35 +01:00
locking.c btrfs: add definitions and constants for remap-tree 2026-02-03 07:54:02 +01:00
locking.h btrfs: fix typos in comments and strings 2025-09-23 08:49:16 +02:00
lru_cache.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
lru_cache.h btrfs: cleanup recursive include of the same header 2024-07-11 15:33:22 +02:00
lzo.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
Makefile Kbuild/Kconfig updates for 7.0 2026-02-11 13:40:35 -08:00
messages.c btrfs: pass level to _btrfs_printk() to avoid parsing level from string 2026-02-03 07:49:10 +01:00
messages.h btrfs: remove ASSERT compatibility for gcc < 8.x 2026-02-03 07:49:10 +01:00
misc.h for-6.19-tag 2025-12-03 20:03:46 -08:00
ordered-data.c for-6.19-tag 2025-12-03 20:03:46 -08:00
ordered-data.h btrfs: introduce a read path dedicated extent lock helper 2025-03-18 20:35:48 +01:00
orphan.c btrfs: BTRFS_PATH_AUTO_FREE in orphan.c 2024-09-10 16:51:22 +02:00
orphan.h
print-tree.c btrfs: use the key format macros when printing keys 2025-11-24 22:03:02 +01:00
print-tree.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
props.c btrfs: props: switch prop_handler::extract to struct btrfs_inode 2025-03-18 20:35:44 +01:00
props.h btrfs: pass struct btrfs_inode to btrfs_inode_inherit_props() 2025-03-18 20:35:44 +01:00
qgroup.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
qgroup.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
raid-stripe-tree.c btrfs: use bool type for btrfs_path members used as booleans 2025-11-24 22:42:25 +01:00
raid-stripe-tree.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
raid56.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
raid56.h btrfs: raid56: introduce a new parameter to locate a sector 2025-11-25 01:46:58 +01:00
ref-verify.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
ref-verify.h btrfs: move ref-verify under CONFIG_BTRFS_DEBUG 2025-09-22 10:54:32 +02:00
reflink.c btrfs: update comment for delalloc flush and oe wait in btrfs_clone_files() 2026-02-03 07:51:43 +01:00
reflink.h
relocation.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
relocation.h btrfs: handle setting up relocation of block group with remap-tree 2026-02-03 07:54:35 +01:00
root-tree.c btrfs: fix lost error return in btrfs_find_orphan_roots() 2026-02-18 15:25:54 +01:00
root-tree.h
scrub.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
scrub.h btrfs: convert several int parameters to bool 2025-09-22 10:54:32 +02:00
send.c Convert remaining multi-line kmalloc_obj/flex GFP_KERNEL uses 2026-02-22 08:26:33 -08:00
send.h btrfs: pass btrfs_root pointers to send ioctl parameters 2025-03-18 20:35:49 +01:00
space-info.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
space-info.h btrfs: move space_info_flag_to_str() to space-info.h 2026-02-03 07:49:12 +01:00
subpage.c for-6.19-tag 2025-12-03 20:03:46 -08:00
subpage.h btrfs: headers cleanup to remove unnecessary local includes 2025-11-24 22:34:52 +01:00
super.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
super.h btrfs: change BTRFS_MOUNT_* flags to 64bit type 2024-07-19 17:20:23 +02:00
sysfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sysfs.h btrfs: remove fs_info argument from btrfs_sysfs_add_space_info_type() 2025-11-24 22:02:30 +01:00
transaction.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
transaction.h btrfs: headers cleanup to remove unnecessary local includes 2025-11-24 22:34:52 +01:00
tree-checker.c btrfs: add extended version of struct block_group_item 2026-02-03 07:54:34 +01:00
tree-checker.h btrfs: add definitions and constants for remap-tree 2026-02-03 07:54:02 +01:00
tree-log.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
tree-log.h btrfs: reduce arguments to btrfs_del_inode_ref_in_log() 2025-11-25 01:53:33 +01:00
tree-mod-log.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
tree-mod-log.h btrfs: drop unused parameter path from btrfs_tree_mod_log_rewind() 2024-11-11 14:34:15 +01:00
ulist.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
ulist.h btrfs: preallocate ulist memory for qgroup rsv 2024-07-11 15:33:26 +02:00
uuid-tree.c btrfs: remove pointless out labels from uuid-tree.c 2026-02-03 07:56:21 +01:00
uuid-tree.h btrfs: move uuid tree related code to uuid-tree.[ch] 2024-09-10 16:51:12 +02:00
verity.c for-7.0-rc1-tag 2026-02-20 14:57:09 -08:00
verity.h
volumes.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
volumes.h btrfs: add cleanup function for btrfs_free_chunk_map 2026-02-03 07:59:06 +01:00
xattr.c btrfs: remaining BTRFS_PATH_AUTO_FREE conversions 2025-11-25 01:53:33 +01:00
xattr.h btrfs: update include and forward declarations in headers 2025-03-18 20:35:43 +01:00
zlib.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
zoned.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
zoned.h btrfs: zoned: factor out the zone loading part into a testable function 2026-02-03 07:59:06 +01:00
zstd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00