kernel_samsung_a53x/fs/btrfs
Josef Bacik 557ad5fb09 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>
2024-11-08 11:26:17 +01:00
..
tests Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
acl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
async-thread.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
async-thread.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
backref.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
backref.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-group.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-group.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-rsv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
block-rsv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
btrfs_inode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
check-integrity.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
check-integrity.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compression.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compression.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ctree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ctree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delalloc-space.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delalloc-space.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-inode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-inode.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-ref.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delayed-ref.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dev-replace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dev-replace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dir-item.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
discard.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
discard.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
disk-io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
disk-io.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
export.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
export.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent-io-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent-tree.c btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1 2024-11-08 11:26:15 +01:00
extent_io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_io.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_map.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extent_map.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file-item.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-cache.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
free-space-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-item.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-map.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode-map.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
inode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ioctl.c btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c 2024-11-08 11:26:17 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locking.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
locking.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lzo.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
misc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ordered-data.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ordered-data.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
orphan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
print-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
print-tree.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
props.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
props.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qgroup.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qgroup.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid56.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
raid56.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rcu-string.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reada.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ref-verify.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ref-verify.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reflink.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reflink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
relocation.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
root-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scrub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
send.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
send.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
space-info.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
space-info.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
struct-funcs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
super.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sysfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sysfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transaction.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
transaction.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-checker.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-checker.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-defrag.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tree-log.c btrfs: initialize start_slot in btrfs_log_prealloc_extents 2024-11-08 11:26:15 +01:00
tree-log.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ulist.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ulist.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uuid-tree.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
volumes.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
volumes.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xattr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zlib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
zstd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00