* [osandov:btrfs-send-encoded 9/14] fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-10-29 4:11 kernel test robot
2021-10-29 7:16 ` kernel test robot
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-10-29 4:11 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 21117 bytes --]
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: Omar Sandoval <osandov@osandov.com>
CC: linux-kernel(a)vger.kernel.org
TO: Omar Sandoval <osandov@fb.com>
tree: https://github.com/osandov/linux.git btrfs-send-encoded
head: b460af84b8ddd4fd78e02fec6272b70326b87861
commit: 0aea17a6398e5a7ecab69537ff062b00f6b9c20f [9/14] btrfs: add BTRFS_IOC_ENCODED_WRITE
:::::: branch date: 7 days ago
:::::: commit date: 7 days ago
config: x86_64-randconfig-c007-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/osandov/linux/commit/0aea17a6398e5a7ecab69537ff062b00f6b9c20f
git remote add osandov https://github.com/osandov/linux.git
git fetch --no-tags osandov btrfs-send-encoded
git checkout 0aea17a6398e5a7ecab69537ff062b00f6b9c20f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
drivers/hid/hid-lg4ff.c:98:8: warning: Excessive padding in 'struct lg4ff_wheel' (8 padding bytes, where 0 is optimal).
Optimal fields order:
ff_effects,
set_range,
product_id,
min_range,
max_range,
consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
struct lg4ff_wheel {
~~~~~~~^~~~~~~~~~~~~
drivers/hid/hid-lg4ff.c:98:8: note: Excessive padding in 'struct lg4ff_wheel' (8 padding bytes, where 0 is optimal). Optimal fields order: ff_effects, set_range, product_id, min_range, max_range, consider reordering the fields or adding explicit padding members
struct lg4ff_wheel {
~~~~~~~^~~~~~~~~~~~~
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
drivers/hid/hid-lg-g15.c:366:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = (ret < 0) ? ret : -EIO;
^ ~~~~~~~~~~~~~~~~~~~~~~
drivers/hid/hid-lg-g15.c:366:3: note: Value stored to 'ret' is never read
ret = (ret < 0) ? ret : -EIO;
^ ~~~~~~~~~~~~~~~~~~~~~~
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
Suppressed 13 warnings (13 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
Suppressed 13 warnings (13 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
13 warnings generated.
Suppressed 13 warnings (13 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
7 warnings generated.
Suppressed 7 warnings (7 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
fs/btrfs/ioctl.c:2080:3: warning: Value stored to 'i' is never read [clang-analyzer-deadcode.DeadStores]
i = nritems;
^ ~~~~~~~
fs/btrfs/ioctl.c:2080:3: note: Value stored to 'i' is never read
i = nritems;
^ ~~~~~~~
fs/btrfs/ioctl.c:2394:3: warning: Value stored to 'dirid' is never read [clang-analyzer-deadcode.DeadStores]
dirid = key.objectid;
^ ~~~~~~~~~~~~
fs/btrfs/ioctl.c:2394:3: note: Value stored to 'dirid' is never read
dirid = key.objectid;
^ ~~~~~~~~~~~~
fs/btrfs/ioctl.c:4631:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(super_block->label, label);
^~~~~~
fs/btrfs/ioctl.c:4631:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(super_block->label, label);
^~~~~~
>> fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
args.iovcnt = args.iovcnt;
^
fs/btrfs/ioctl.c:5191:2: note: 'Default' branch taken. Execution continues on line 5197
switch (cmd) {
^
fs/btrfs/ioctl.c:5197:9: note: Calling 'btrfs_ioctl'
return btrfs_ioctl(file, cmd, (unsigned long) compat_ptr(arg));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:5033:2: note: Control jumps to 'case 1079546944:' at line 5176
switch (cmd) {
^
fs/btrfs/ioctl.c:5177:10: note: Calling 'btrfs_ioctl_encoded_write'
return btrfs_ioctl_encoded_write(file, argp, true);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4940:6: note: Assuming the condition is false
if (!capable(CAP_SYS_ADMIN)) {
^~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4940:2: note: Taking false branch
if (!capable(CAP_SYS_ADMIN)) {
^
fs/btrfs/ioctl.c:4945:6: note: Assuming the condition is false
if (!(file->f_mode & FMODE_WRITE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4945:2: note: Taking false branch
if (!(file->f_mode & FMODE_WRITE)) {
^
fs/btrfs/ioctl.c:4950:6: note: 'compat' is true
if (compat) {
^~~~~~
fs/btrfs/ioctl.c:4950:2: note: Taking true branch
if (compat) {
^
fs/btrfs/ioctl.c:4954:7: note: Calling 'copy_from_user'
if (copy_from_user(&args32, argp, sizeof(args32))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/uaccess.h:191:2: note: Taking true branch
if (likely(check_copy_size(to, n, false)))
^
include/linux/uaccess.h:193:2: note: Returning value (loaded from 'n'), which participates in a condition later
return n;
^~~~~~~~
fs/btrfs/ioctl.c:4954:7: note: Returning from 'copy_from_user'
if (copy_from_user(&args32, argp, sizeof(args32))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4954:7: note: Assuming the condition is false
if (copy_from_user(&args32, argp, sizeof(args32))) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ioctl.c:4954:3: note: Taking false branch
if (copy_from_user(&args32, argp, sizeof(args32))) {
^
fs/btrfs/ioctl.c:4959:15: note: Assigned value is garbage or undefined
args.iovcnt = args.iovcnt;
^ ~~~~~~~~~~~
Suppressed 8 warnings (8 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
9 warnings generated.
drivers/clk/clk-cdce706.c:355:22: warning: Division by zero [clang-analyzer-core.DivideZero]
return *parent_rate / div;
~~~~~~~~~~~~~^~~~~
drivers/clk/clk-cdce706.c:293:32: note: Left side of '&&' is false
struct cdce706_hw_data *hwd = to_hw_data(hw);
^
drivers/clk/clk-cdce706.c:65:26: note: expanded from macro 'to_hw_data'
#define to_hw_data(phw) (container_of((phw), struct cdce706_hw_data, hw))
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
drivers/clk/clk-cdce706.c:293:32: note: Taking false branch
struct cdce706_hw_data *hwd = to_hw_data(hw);
^
drivers/clk/clk-cdce706.c:65:26: note: expanded from macro 'to_hw_data'
#define to_hw_data(phw) (container_of((phw), struct cdce706_hw_data, hw))
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
drivers/clk/clk-cdce706.c:293:32: note: Loop condition is false. Exiting loop
struct cdce706_hw_data *hwd = to_hw_data(hw);
^
drivers/clk/clk-cdce706.c:65:26: note: expanded from macro 'to_hw_data'
#define to_hw_data(phw) (container_of((phw), struct cdce706_hw_data, hw))
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
vim +4959 fs/btrfs/ioctl.c
d38f9ac9a40338 Omar Sandoval 2019-10-09 4928
0aea17a6398e5a Omar Sandoval 2019-08-13 4929 static int btrfs_ioctl_encoded_write(struct file *file, void __user *argp,
0aea17a6398e5a Omar Sandoval 2019-08-13 4930 bool compat)
0aea17a6398e5a Omar Sandoval 2019-08-13 4931 {
0aea17a6398e5a Omar Sandoval 2019-08-13 4932 struct btrfs_ioctl_encoded_io_args args;
0aea17a6398e5a Omar Sandoval 2019-08-13 4933 struct iovec iovstack[UIO_FASTIOV];
0aea17a6398e5a Omar Sandoval 2019-08-13 4934 struct iovec *iov = iovstack;
0aea17a6398e5a Omar Sandoval 2019-08-13 4935 struct iov_iter iter;
0aea17a6398e5a Omar Sandoval 2019-08-13 4936 loff_t pos;
0aea17a6398e5a Omar Sandoval 2019-08-13 4937 struct kiocb kiocb;
0aea17a6398e5a Omar Sandoval 2019-08-13 4938 ssize_t ret;
0aea17a6398e5a Omar Sandoval 2019-08-13 4939
0aea17a6398e5a Omar Sandoval 2019-08-13 4940 if (!capable(CAP_SYS_ADMIN)) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4941 ret = -EPERM;
0aea17a6398e5a Omar Sandoval 2019-08-13 4942 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4943 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4944
0aea17a6398e5a Omar Sandoval 2019-08-13 4945 if (!(file->f_mode & FMODE_WRITE)) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4946 ret = -EBADF;
0aea17a6398e5a Omar Sandoval 2019-08-13 4947 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4948 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4949
0aea17a6398e5a Omar Sandoval 2019-08-13 4950 if (compat) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4951 #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
0aea17a6398e5a Omar Sandoval 2019-08-13 4952 struct btrfs_ioctl_encoded_io_args_32 args32;
0aea17a6398e5a Omar Sandoval 2019-08-13 4953
0aea17a6398e5a Omar Sandoval 2019-08-13 4954 if (copy_from_user(&args32, argp, sizeof(args32))) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4955 ret = -EFAULT;
0aea17a6398e5a Omar Sandoval 2019-08-13 4956 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4957 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4958 args.iov = compat_ptr(args32.iov);
0aea17a6398e5a Omar Sandoval 2019-08-13 @4959 args.iovcnt = args.iovcnt;
0aea17a6398e5a Omar Sandoval 2019-08-13 4960 memcpy(&args.offset, &args32.offset,
0aea17a6398e5a Omar Sandoval 2019-08-13 4961 sizeof(args) -
0aea17a6398e5a Omar Sandoval 2019-08-13 4962 offsetof(struct btrfs_ioctl_encoded_io_args, offset));
0aea17a6398e5a Omar Sandoval 2019-08-13 4963 #else
0aea17a6398e5a Omar Sandoval 2019-08-13 4964 return -ENOTTY;
0aea17a6398e5a Omar Sandoval 2019-08-13 4965 #endif
0aea17a6398e5a Omar Sandoval 2019-08-13 4966 } else {
0aea17a6398e5a Omar Sandoval 2019-08-13 4967 if (copy_from_user(&args, argp, sizeof(args))) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4968 ret = -EFAULT;
0aea17a6398e5a Omar Sandoval 2019-08-13 4969 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4970 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4971 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4972
0aea17a6398e5a Omar Sandoval 2019-08-13 4973 ret = -EINVAL;
0aea17a6398e5a Omar Sandoval 2019-08-13 4974 if (args.flags != 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 4975 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4976 if (memchr_inv(args.reserved, 0, sizeof(args.reserved)))
0aea17a6398e5a Omar Sandoval 2019-08-13 4977 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4978 if (args.compression == BTRFS_ENCODED_IO_COMPRESSION_NONE &&
0aea17a6398e5a Omar Sandoval 2019-08-13 4979 args.encryption == BTRFS_ENCODED_IO_ENCRYPTION_NONE)
0aea17a6398e5a Omar Sandoval 2019-08-13 4980 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4981 if (args.compression >= BTRFS_ENCODED_IO_COMPRESSION_TYPES ||
0aea17a6398e5a Omar Sandoval 2019-08-13 4982 args.encryption >= BTRFS_ENCODED_IO_ENCRYPTION_TYPES)
0aea17a6398e5a Omar Sandoval 2019-08-13 4983 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4984 if (args.unencoded_offset > args.unencoded_len)
0aea17a6398e5a Omar Sandoval 2019-08-13 4985 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4986 if (args.len > args.unencoded_len - args.unencoded_offset)
0aea17a6398e5a Omar Sandoval 2019-08-13 4987 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4988
0aea17a6398e5a Omar Sandoval 2019-08-13 4989 ret = import_iovec(WRITE, args.iov, args.iovcnt, ARRAY_SIZE(iovstack),
0aea17a6398e5a Omar Sandoval 2019-08-13 4990 &iov, &iter);
0aea17a6398e5a Omar Sandoval 2019-08-13 4991 if (ret < 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 4992 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4993
0aea17a6398e5a Omar Sandoval 2019-08-13 4994 file_start_write(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 4995
0aea17a6398e5a Omar Sandoval 2019-08-13 4996 if (iov_iter_count(&iter) == 0) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4997 ret = 0;
0aea17a6398e5a Omar Sandoval 2019-08-13 4998 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 4999 }
0aea17a6398e5a Omar Sandoval 2019-08-13 5000 pos = args.offset;
0aea17a6398e5a Omar Sandoval 2019-08-13 5001 ret = rw_verify_area(WRITE, file, &pos, args.len);
0aea17a6398e5a Omar Sandoval 2019-08-13 5002 if (ret < 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5003 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 5004
0aea17a6398e5a Omar Sandoval 2019-08-13 5005 init_sync_kiocb(&kiocb, file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5006 ret = kiocb_set_rw_flags(&kiocb, 0);
0aea17a6398e5a Omar Sandoval 2019-08-13 5007 if (ret)
0aea17a6398e5a Omar Sandoval 2019-08-13 5008 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 5009 kiocb.ki_pos = pos;
0aea17a6398e5a Omar Sandoval 2019-08-13 5010
0aea17a6398e5a Omar Sandoval 2019-08-13 5011 ret = btrfs_do_write_iter(&kiocb, &iter, &args);
0aea17a6398e5a Omar Sandoval 2019-08-13 5012 if (ret > 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5013 fsnotify_modify(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5014
0aea17a6398e5a Omar Sandoval 2019-08-13 5015 out_end_write:
0aea17a6398e5a Omar Sandoval 2019-08-13 5016 file_end_write(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5017 kfree(iov);
0aea17a6398e5a Omar Sandoval 2019-08-13 5018 out_acct:
0aea17a6398e5a Omar Sandoval 2019-08-13 5019 if (ret > 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5020 add_wchar(current, ret);
0aea17a6398e5a Omar Sandoval 2019-08-13 5021 inc_syscw(current);
0aea17a6398e5a Omar Sandoval 2019-08-13 5022 return ret;
0aea17a6398e5a Omar Sandoval 2019-08-13 5023 }
0aea17a6398e5a Omar Sandoval 2019-08-13 5024
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39328 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [osandov:btrfs-send-encoded 9/14] fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
2021-10-29 4:11 [osandov:btrfs-send-encoded 9/14] fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] kernel test robot
@ 2021-10-29 7:16 ` kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-10-29 7:16 UTC (permalink / raw)
To: Omar Sandoval; +Cc: llvm, kbuild-all, Omar Sandoval, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 8224 bytes --]
tree: https://github.com/osandov/linux.git btrfs-send-encoded
head: b460af84b8ddd4fd78e02fec6272b70326b87861
commit: 0aea17a6398e5a7ecab69537ff062b00f6b9c20f [9/14] btrfs: add BTRFS_IOC_ENCODED_WRITE
config: x86_64-randconfig-c007-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/osandov/linux/commit/0aea17a6398e5a7ecab69537ff062b00f6b9c20f
git remote add osandov https://github.com/osandov/linux.git
git fetch --no-tags osandov btrfs-send-encoded
git checkout 0aea17a6398e5a7ecab69537ff062b00f6b9c20f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
args.iovcnt = args.iovcnt;
^
vim +4959 fs/btrfs/ioctl.c
d38f9ac9a40338 Omar Sandoval 2019-10-09 4928
0aea17a6398e5a Omar Sandoval 2019-08-13 4929 static int btrfs_ioctl_encoded_write(struct file *file, void __user *argp,
0aea17a6398e5a Omar Sandoval 2019-08-13 4930 bool compat)
0aea17a6398e5a Omar Sandoval 2019-08-13 4931 {
0aea17a6398e5a Omar Sandoval 2019-08-13 4932 struct btrfs_ioctl_encoded_io_args args;
0aea17a6398e5a Omar Sandoval 2019-08-13 4933 struct iovec iovstack[UIO_FASTIOV];
0aea17a6398e5a Omar Sandoval 2019-08-13 4934 struct iovec *iov = iovstack;
0aea17a6398e5a Omar Sandoval 2019-08-13 4935 struct iov_iter iter;
0aea17a6398e5a Omar Sandoval 2019-08-13 4936 loff_t pos;
0aea17a6398e5a Omar Sandoval 2019-08-13 4937 struct kiocb kiocb;
0aea17a6398e5a Omar Sandoval 2019-08-13 4938 ssize_t ret;
0aea17a6398e5a Omar Sandoval 2019-08-13 4939
0aea17a6398e5a Omar Sandoval 2019-08-13 4940 if (!capable(CAP_SYS_ADMIN)) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4941 ret = -EPERM;
0aea17a6398e5a Omar Sandoval 2019-08-13 4942 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4943 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4944
0aea17a6398e5a Omar Sandoval 2019-08-13 4945 if (!(file->f_mode & FMODE_WRITE)) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4946 ret = -EBADF;
0aea17a6398e5a Omar Sandoval 2019-08-13 4947 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4948 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4949
0aea17a6398e5a Omar Sandoval 2019-08-13 4950 if (compat) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4951 #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
0aea17a6398e5a Omar Sandoval 2019-08-13 4952 struct btrfs_ioctl_encoded_io_args_32 args32;
0aea17a6398e5a Omar Sandoval 2019-08-13 4953
0aea17a6398e5a Omar Sandoval 2019-08-13 4954 if (copy_from_user(&args32, argp, sizeof(args32))) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4955 ret = -EFAULT;
0aea17a6398e5a Omar Sandoval 2019-08-13 4956 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4957 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4958 args.iov = compat_ptr(args32.iov);
0aea17a6398e5a Omar Sandoval 2019-08-13 @4959 args.iovcnt = args.iovcnt;
0aea17a6398e5a Omar Sandoval 2019-08-13 4960 memcpy(&args.offset, &args32.offset,
0aea17a6398e5a Omar Sandoval 2019-08-13 4961 sizeof(args) -
0aea17a6398e5a Omar Sandoval 2019-08-13 4962 offsetof(struct btrfs_ioctl_encoded_io_args, offset));
0aea17a6398e5a Omar Sandoval 2019-08-13 4963 #else
0aea17a6398e5a Omar Sandoval 2019-08-13 4964 return -ENOTTY;
0aea17a6398e5a Omar Sandoval 2019-08-13 4965 #endif
0aea17a6398e5a Omar Sandoval 2019-08-13 4966 } else {
0aea17a6398e5a Omar Sandoval 2019-08-13 4967 if (copy_from_user(&args, argp, sizeof(args))) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4968 ret = -EFAULT;
0aea17a6398e5a Omar Sandoval 2019-08-13 4969 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4970 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4971 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4972
0aea17a6398e5a Omar Sandoval 2019-08-13 4973 ret = -EINVAL;
0aea17a6398e5a Omar Sandoval 2019-08-13 4974 if (args.flags != 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 4975 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4976 if (memchr_inv(args.reserved, 0, sizeof(args.reserved)))
0aea17a6398e5a Omar Sandoval 2019-08-13 4977 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4978 if (args.compression == BTRFS_ENCODED_IO_COMPRESSION_NONE &&
0aea17a6398e5a Omar Sandoval 2019-08-13 4979 args.encryption == BTRFS_ENCODED_IO_ENCRYPTION_NONE)
0aea17a6398e5a Omar Sandoval 2019-08-13 4980 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4981 if (args.compression >= BTRFS_ENCODED_IO_COMPRESSION_TYPES ||
0aea17a6398e5a Omar Sandoval 2019-08-13 4982 args.encryption >= BTRFS_ENCODED_IO_ENCRYPTION_TYPES)
0aea17a6398e5a Omar Sandoval 2019-08-13 4983 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4984 if (args.unencoded_offset > args.unencoded_len)
0aea17a6398e5a Omar Sandoval 2019-08-13 4985 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4986 if (args.len > args.unencoded_len - args.unencoded_offset)
0aea17a6398e5a Omar Sandoval 2019-08-13 4987 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4988
0aea17a6398e5a Omar Sandoval 2019-08-13 4989 ret = import_iovec(WRITE, args.iov, args.iovcnt, ARRAY_SIZE(iovstack),
0aea17a6398e5a Omar Sandoval 2019-08-13 4990 &iov, &iter);
0aea17a6398e5a Omar Sandoval 2019-08-13 4991 if (ret < 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 4992 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4993
0aea17a6398e5a Omar Sandoval 2019-08-13 4994 file_start_write(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 4995
0aea17a6398e5a Omar Sandoval 2019-08-13 4996 if (iov_iter_count(&iter) == 0) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4997 ret = 0;
0aea17a6398e5a Omar Sandoval 2019-08-13 4998 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 4999 }
0aea17a6398e5a Omar Sandoval 2019-08-13 5000 pos = args.offset;
0aea17a6398e5a Omar Sandoval 2019-08-13 5001 ret = rw_verify_area(WRITE, file, &pos, args.len);
0aea17a6398e5a Omar Sandoval 2019-08-13 5002 if (ret < 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5003 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 5004
0aea17a6398e5a Omar Sandoval 2019-08-13 5005 init_sync_kiocb(&kiocb, file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5006 ret = kiocb_set_rw_flags(&kiocb, 0);
0aea17a6398e5a Omar Sandoval 2019-08-13 5007 if (ret)
0aea17a6398e5a Omar Sandoval 2019-08-13 5008 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 5009 kiocb.ki_pos = pos;
0aea17a6398e5a Omar Sandoval 2019-08-13 5010
0aea17a6398e5a Omar Sandoval 2019-08-13 5011 ret = btrfs_do_write_iter(&kiocb, &iter, &args);
0aea17a6398e5a Omar Sandoval 2019-08-13 5012 if (ret > 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5013 fsnotify_modify(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5014
0aea17a6398e5a Omar Sandoval 2019-08-13 5015 out_end_write:
0aea17a6398e5a Omar Sandoval 2019-08-13 5016 file_end_write(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5017 kfree(iov);
0aea17a6398e5a Omar Sandoval 2019-08-13 5018 out_acct:
0aea17a6398e5a Omar Sandoval 2019-08-13 5019 if (ret > 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5020 add_wchar(current, ret);
0aea17a6398e5a Omar Sandoval 2019-08-13 5021 inc_syscw(current);
0aea17a6398e5a Omar Sandoval 2019-08-13 5022 return ret;
0aea17a6398e5a Omar Sandoval 2019-08-13 5023 }
0aea17a6398e5a Omar Sandoval 2019-08-13 5024
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 39328 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [osandov:btrfs-send-encoded 9/14] fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
@ 2021-10-29 7:16 ` kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-10-29 7:16 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8355 bytes --]
tree: https://github.com/osandov/linux.git btrfs-send-encoded
head: b460af84b8ddd4fd78e02fec6272b70326b87861
commit: 0aea17a6398e5a7ecab69537ff062b00f6b9c20f [9/14] btrfs: add BTRFS_IOC_ENCODED_WRITE
config: x86_64-randconfig-c007-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/osandov/linux/commit/0aea17a6398e5a7ecab69537ff062b00f6b9c20f
git remote add osandov https://github.com/osandov/linux.git
git fetch --no-tags osandov btrfs-send-encoded
git checkout 0aea17a6398e5a7ecab69537ff062b00f6b9c20f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
args.iovcnt = args.iovcnt;
^
vim +4959 fs/btrfs/ioctl.c
d38f9ac9a40338 Omar Sandoval 2019-10-09 4928
0aea17a6398e5a Omar Sandoval 2019-08-13 4929 static int btrfs_ioctl_encoded_write(struct file *file, void __user *argp,
0aea17a6398e5a Omar Sandoval 2019-08-13 4930 bool compat)
0aea17a6398e5a Omar Sandoval 2019-08-13 4931 {
0aea17a6398e5a Omar Sandoval 2019-08-13 4932 struct btrfs_ioctl_encoded_io_args args;
0aea17a6398e5a Omar Sandoval 2019-08-13 4933 struct iovec iovstack[UIO_FASTIOV];
0aea17a6398e5a Omar Sandoval 2019-08-13 4934 struct iovec *iov = iovstack;
0aea17a6398e5a Omar Sandoval 2019-08-13 4935 struct iov_iter iter;
0aea17a6398e5a Omar Sandoval 2019-08-13 4936 loff_t pos;
0aea17a6398e5a Omar Sandoval 2019-08-13 4937 struct kiocb kiocb;
0aea17a6398e5a Omar Sandoval 2019-08-13 4938 ssize_t ret;
0aea17a6398e5a Omar Sandoval 2019-08-13 4939
0aea17a6398e5a Omar Sandoval 2019-08-13 4940 if (!capable(CAP_SYS_ADMIN)) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4941 ret = -EPERM;
0aea17a6398e5a Omar Sandoval 2019-08-13 4942 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4943 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4944
0aea17a6398e5a Omar Sandoval 2019-08-13 4945 if (!(file->f_mode & FMODE_WRITE)) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4946 ret = -EBADF;
0aea17a6398e5a Omar Sandoval 2019-08-13 4947 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4948 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4949
0aea17a6398e5a Omar Sandoval 2019-08-13 4950 if (compat) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4951 #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
0aea17a6398e5a Omar Sandoval 2019-08-13 4952 struct btrfs_ioctl_encoded_io_args_32 args32;
0aea17a6398e5a Omar Sandoval 2019-08-13 4953
0aea17a6398e5a Omar Sandoval 2019-08-13 4954 if (copy_from_user(&args32, argp, sizeof(args32))) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4955 ret = -EFAULT;
0aea17a6398e5a Omar Sandoval 2019-08-13 4956 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4957 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4958 args.iov = compat_ptr(args32.iov);
0aea17a6398e5a Omar Sandoval 2019-08-13 @4959 args.iovcnt = args.iovcnt;
0aea17a6398e5a Omar Sandoval 2019-08-13 4960 memcpy(&args.offset, &args32.offset,
0aea17a6398e5a Omar Sandoval 2019-08-13 4961 sizeof(args) -
0aea17a6398e5a Omar Sandoval 2019-08-13 4962 offsetof(struct btrfs_ioctl_encoded_io_args, offset));
0aea17a6398e5a Omar Sandoval 2019-08-13 4963 #else
0aea17a6398e5a Omar Sandoval 2019-08-13 4964 return -ENOTTY;
0aea17a6398e5a Omar Sandoval 2019-08-13 4965 #endif
0aea17a6398e5a Omar Sandoval 2019-08-13 4966 } else {
0aea17a6398e5a Omar Sandoval 2019-08-13 4967 if (copy_from_user(&args, argp, sizeof(args))) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4968 ret = -EFAULT;
0aea17a6398e5a Omar Sandoval 2019-08-13 4969 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4970 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4971 }
0aea17a6398e5a Omar Sandoval 2019-08-13 4972
0aea17a6398e5a Omar Sandoval 2019-08-13 4973 ret = -EINVAL;
0aea17a6398e5a Omar Sandoval 2019-08-13 4974 if (args.flags != 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 4975 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4976 if (memchr_inv(args.reserved, 0, sizeof(args.reserved)))
0aea17a6398e5a Omar Sandoval 2019-08-13 4977 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4978 if (args.compression == BTRFS_ENCODED_IO_COMPRESSION_NONE &&
0aea17a6398e5a Omar Sandoval 2019-08-13 4979 args.encryption == BTRFS_ENCODED_IO_ENCRYPTION_NONE)
0aea17a6398e5a Omar Sandoval 2019-08-13 4980 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4981 if (args.compression >= BTRFS_ENCODED_IO_COMPRESSION_TYPES ||
0aea17a6398e5a Omar Sandoval 2019-08-13 4982 args.encryption >= BTRFS_ENCODED_IO_ENCRYPTION_TYPES)
0aea17a6398e5a Omar Sandoval 2019-08-13 4983 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4984 if (args.unencoded_offset > args.unencoded_len)
0aea17a6398e5a Omar Sandoval 2019-08-13 4985 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4986 if (args.len > args.unencoded_len - args.unencoded_offset)
0aea17a6398e5a Omar Sandoval 2019-08-13 4987 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4988
0aea17a6398e5a Omar Sandoval 2019-08-13 4989 ret = import_iovec(WRITE, args.iov, args.iovcnt, ARRAY_SIZE(iovstack),
0aea17a6398e5a Omar Sandoval 2019-08-13 4990 &iov, &iter);
0aea17a6398e5a Omar Sandoval 2019-08-13 4991 if (ret < 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 4992 goto out_acct;
0aea17a6398e5a Omar Sandoval 2019-08-13 4993
0aea17a6398e5a Omar Sandoval 2019-08-13 4994 file_start_write(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 4995
0aea17a6398e5a Omar Sandoval 2019-08-13 4996 if (iov_iter_count(&iter) == 0) {
0aea17a6398e5a Omar Sandoval 2019-08-13 4997 ret = 0;
0aea17a6398e5a Omar Sandoval 2019-08-13 4998 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 4999 }
0aea17a6398e5a Omar Sandoval 2019-08-13 5000 pos = args.offset;
0aea17a6398e5a Omar Sandoval 2019-08-13 5001 ret = rw_verify_area(WRITE, file, &pos, args.len);
0aea17a6398e5a Omar Sandoval 2019-08-13 5002 if (ret < 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5003 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 5004
0aea17a6398e5a Omar Sandoval 2019-08-13 5005 init_sync_kiocb(&kiocb, file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5006 ret = kiocb_set_rw_flags(&kiocb, 0);
0aea17a6398e5a Omar Sandoval 2019-08-13 5007 if (ret)
0aea17a6398e5a Omar Sandoval 2019-08-13 5008 goto out_end_write;
0aea17a6398e5a Omar Sandoval 2019-08-13 5009 kiocb.ki_pos = pos;
0aea17a6398e5a Omar Sandoval 2019-08-13 5010
0aea17a6398e5a Omar Sandoval 2019-08-13 5011 ret = btrfs_do_write_iter(&kiocb, &iter, &args);
0aea17a6398e5a Omar Sandoval 2019-08-13 5012 if (ret > 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5013 fsnotify_modify(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5014
0aea17a6398e5a Omar Sandoval 2019-08-13 5015 out_end_write:
0aea17a6398e5a Omar Sandoval 2019-08-13 5016 file_end_write(file);
0aea17a6398e5a Omar Sandoval 2019-08-13 5017 kfree(iov);
0aea17a6398e5a Omar Sandoval 2019-08-13 5018 out_acct:
0aea17a6398e5a Omar Sandoval 2019-08-13 5019 if (ret > 0)
0aea17a6398e5a Omar Sandoval 2019-08-13 5020 add_wchar(current, ret);
0aea17a6398e5a Omar Sandoval 2019-08-13 5021 inc_syscw(current);
0aea17a6398e5a Omar Sandoval 2019-08-13 5022 return ret;
0aea17a6398e5a Omar Sandoval 2019-08-13 5023 }
0aea17a6398e5a Omar Sandoval 2019-08-13 5024
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39328 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-29 7:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 4:11 [osandov:btrfs-send-encoded 9/14] fs/btrfs/ioctl.c:4959:15: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] kernel test robot
2021-10-29 7:16 ` kernel test robot
2021-10-29 7:16 ` kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.