android_kernel_motorola_sm6375/fs/btrfs
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Josef Bacik 9cae05233b btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c
[ Upstream commit 9147b9ded499d9853bdf0e9804b7eaa99c4429ed ]

Jens reported the following warnings from -Wmaybe-uninitialized recent
Linus' branch.

  In file included from ./include/asm-generic/rwonce.h:26,
		   from ./arch/arm64/include/asm/rwonce.h:71,
		   from ./include/linux/compiler.h:246,
		   from ./include/linux/export.h:5,
		   from ./include/linux/linkage.h:7,
		   from ./include/linux/kernel.h:17,
		   from fs/btrfs/ioctl.c:6:
  In function ‘instrument_copy_from_user_before’,
      inlined from ‘_copy_from_user’ at ./include/linux/uaccess.h:148:3,
      inlined from ‘copy_from_user’ at ./include/linux/uaccess.h:183:7,
      inlined from ‘btrfs_ioctl_space_info’ at fs/btrfs/ioctl.c:2999:6,
      inlined from ‘btrfs_ioctl’ at fs/btrfs/ioctl.c:4616:10:
  ./include/linux/kasan-checks.h:38:27: warning: ‘space_args’ may be used
  uninitialized [-Wmaybe-uninitialized]
     38 | #define kasan_check_write __kasan_check_write
  ./include/linux/instrumented.h:129:9: note: in expansion of macro
  ‘kasan_check_write’
    129 |         kasan_check_write(to, n);
	|         ^~~~~~~~~~~~~~~~~
  ./include/linux/kasan-checks.h: In function ‘btrfs_ioctl’:
  ./include/linux/kasan-checks.h:20:6: note: by argument 1 of type ‘const
  volatile void *’ to ‘__kasan_check_write’ declared here
     20 | bool __kasan_check_write(const volatile void *p, unsigned int
	size);
	|      ^~~~~~~~~~~~~~~~~~~
  fs/btrfs/ioctl.c:2981:39: note: ‘space_args’ declared here
   2981 |         struct btrfs_ioctl_space_args space_args;
	|                                       ^~~~~~~~~~
  In function ‘instrument_copy_from_user_before’,
      inlined from ‘_copy_from_user’ at ./include/linux/uaccess.h:148:3,
      inlined from ‘copy_from_user’ at ./include/linux/uaccess.h:183:7,
      inlined from ‘_btrfs_ioctl_send’ at fs/btrfs/ioctl.c:4343:9,
      inlined from ‘btrfs_ioctl’ at fs/btrfs/ioctl.c:4658:10:
  ./include/linux/kasan-checks.h:38:27: warning: ‘args32’ may be used
  uninitialized [-Wmaybe-uninitialized]
     38 | #define kasan_check_write __kasan_check_write
  ./include/linux/instrumented.h:129:9: note: in expansion of macro
  ‘kasan_check_write’
    129 |         kasan_check_write(to, n);
	|         ^~~~~~~~~~~~~~~~~
  ./include/linux/kasan-checks.h: In function ‘btrfs_ioctl’:
  ./include/linux/kasan-checks.h:20:6: note: by argument 1 of type ‘const
  volatile void *’ to ‘__kasan_check_write’ declared here
     20 | bool __kasan_check_write(const volatile void *p, unsigned int
	size);
	|      ^~~~~~~~~~~~~~~~~~~
  fs/btrfs/ioctl.c:4341:49: note: ‘args32’ declared here
   4341 |                 struct btrfs_ioctl_send_args_32 args32;
	|                                                 ^~~~~~

This was due to his config options and having KASAN turned on,
which adds some extra checks around copy_from_user(), which then
triggered the -Wmaybe-uninitialized checker for these cases.

Fix the warnings by initializing the different structs we're copying
into.

Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-10-25 11:53:23 +02:00
..
tests btrfs: remove pointless and double ulist frees in error paths of qgroup tests 2022-11-25 17:42:13 +01:00
acl.c
async-thread.c btrfs: fix memory ordering between normal and ordered work functions 2021-11-26 10:47:21 +01:00
async-thread.h
backref.c btrfs: fix resolving backrefs for inline extent followed by prealloc 2023-01-18 11:41:46 +01:00
backref.h
block-group.c btrfs: reset block group chunk force if we have to wait 2022-08-25 11:18:11 +02:00
block-group.h
block-rsv.c btrfs: don't free qgroup space unless specified 2023-05-17 11:36:00 +02:00
block-rsv.h
btrfs_inode.h btrfs: fix race between marking inode needs to be logged and log syncing 2021-09-03 10:08:15 +02:00
check-integrity.c
check-integrity.h
compression.c
compression.h
ctree.c btrfs: fix extent buffer leak after tree mod log failure at split_node() 2023-08-11 11:53:44 +02:00
ctree.h btrfs: move btrfs_pinned_by_swapfile prototype into volumes.h 2023-09-23 11:00:05 +02:00
delalloc-space.c
delalloc-space.h
delayed-inode.c btrfs: fix lockdep splat and potential deadlock after failure running delayed items 2023-09-23 11:00:06 +02:00
delayed-inode.h
delayed-ref.c
delayed-ref.h
dev-replace.c btrfs: add info when mount fails due to stale replace target 2022-09-05 10:27:43 +02:00
dev-replace.h
dir-item.c btrfs: unify lookup return value when dir entry is missing 2022-09-05 10:27:46 +02:00
disk-io.c btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super 2023-09-23 11:00:05 +02:00
disk-io.h
export.c btrfs: fix type of parameter generation in btrfs_get_dentry 2022-11-10 17:57:55 +01:00
export.h btrfs: fix type of parameter generation in btrfs_get_dentry 2022-11-10 17:57:55 +01:00
extent-tree.c btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1 2023-10-25 11:53:22 +02:00
extent_io.c btrfs: don't stop integrity writeback too early 2023-08-16 18:19:24 +02:00
extent_io.h btrfs: fix qgroup reserve overflow the qgroup limit 2022-04-15 14:18:39 +02:00
extent_map.c
extent_map.h
file-item.c btrfs: handle memory allocation failure in btrfs_csum_one_bio 2023-06-21 15:44:09 +02:00
file.c btrfs: fix race between marking inode needs to be logged and log syncing 2021-09-03 10:08:15 +02:00
free-space-cache.c btrfs: fix space cache inconsistency after error loading it from disk 2023-05-30 12:44:04 +01:00
free-space-cache.h
free-space-tree.c
free-space-tree.h
inode-item.c
inode-map.c
inode-map.h
inode.c btrfs: replace calls to btrfs_find_free_ino with btrfs_find_free_objectid 2023-05-30 12:44:04 +01:00
ioctl.c btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c 2023-10-25 11:53:23 +02:00
Kconfig
locking.c
locking.h
lzo.c
Makefile
misc.h
ordered-data.c
ordered-data.h
orphan.c
print-tree.c btrfs: print-tree: parent bytenr must be aligned to sector size 2023-05-17 11:36:00 +02:00
print-tree.h
props.c
props.h
qgroup.c btrfs: fix race between quota disable and quota assign ioctls 2023-08-11 11:53:54 +02:00
qgroup.h btrfs: qgroup: catch reserved space leaks at unmount time 2023-08-11 11:53:44 +02:00
raid56.c btrfs: raid56: don't trust any cached sector in __raid56_parity_recover() 2022-08-25 11:18:40 +02:00
raid56.h
rcu-string.h btrfs: replace strncpy() with strscpy() 2023-01-18 11:41:52 +01:00
reada.c
ref-verify.c
ref-verify.h
relocation.c btrfs: unset reloc control if transaction commit fails in prepare_to_relocate() 2023-06-14 10:59:59 +02:00
root-tree.c btrfs: fix silent failure when deleting root reference 2022-09-05 10:27:43 +02:00
scrub.c btrfs: scrub: try to fix super block errors 2022-10-26 13:22:55 +02:00
send.c btrfs: send: limit number of clones and allocated memory size 2023-03-03 11:41:48 +01:00
send.h
space-info.c btrfs: prevent __btrfs_dump_space_info() to underflow its free space 2021-09-30 10:09:22 +02:00
space-info.h
struct-funcs.c
super.c btrfs: properly report 0 avail for very full file systems 2023-10-10 21:46:41 +02:00
sysfs.c btrfs: sysfs: normalize the error handling branch in btrfs_init_sysfs() 2022-12-08 11:23:01 +01:00
sysfs.h
transaction.c btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART 2023-09-23 11:00:00 +02:00
transaction.h btrfs: fix race between marking inode needs to be logged and log syncing 2021-09-03 10:08:15 +02:00
tree-checker.c btrfs: tree-checker: check for overlapping extent items 2022-09-05 10:27:47 +02:00
tree-checker.h
tree-defrag.c
tree-log.c btrfs: initialize start_slot in btrfs_log_prealloc_extents 2023-10-25 11:53:22 +02:00
tree-log.h
ulist.c
ulist.h
uuid-tree.c
volumes.c btrfs: add a helper to read the superblock metadata_uuid 2023-09-23 11:00:05 +02:00
volumes.h btrfs: add a helper to read the superblock metadata_uuid 2023-09-23 11:00:05 +02:00
xattr.c btrfs: check if root is readonly while setting security xattr 2022-09-05 10:27:43 +02:00
xattr.h
zlib.c btrfs: zlib: zero-initialize zlib workspace 2023-02-22 12:50:30 +01:00
zstd.c