tree:
https://android.googlesource.com/kernel/goldfish android-4.14-q
head: bf6d4fcf969de4bc7913b6d1343340ab68a9f2b8
commit: 2061c5856b6886554f01cce8b96b8f1595695e98 [10/11] BACKPORT: loop: Add
LOOP_CONFIGURE ioctl
compiler: hppa-linux-gcc (GCC) 7.5.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
cppcheck warnings: (new ones prefixed by >>)
drivers/block/loop.c:531:8: warning: Variable 'bvec' is reassigned a value
before the old one has been used. [redundantAssignment]
bvec = cmd->bvec;
^
drivers/block/loop.c:529:8: note: Variable 'bvec' is reassigned a value before
the old one has been used.
bvec++;
^
drivers/block/loop.c:531:8: note: Variable 'bvec' is reassigned a value before
the old one has been used.
bvec = cmd->bvec;
^
drivers/block/loop.c:693:8: warning: Variable 'error' is reassigned a value
before the old one has been used. [redundantAssignment]
error = -EINVAL;
^
drivers/block/loop.c:688:8: note: Variable 'error' is reassigned a value before
the old one has been used.
error = -ENXIO;
^
drivers/block/loop.c:693:8: note: Variable 'error' is reassigned a value before
the old one has been used.
error = -EINVAL;
^
drivers/block/loop.c:697:8: warning: Variable 'error' is reassigned a value
before the old one has been used. [redundantAssignment]
error = -EBADF;
^
drivers/block/loop.c:693:8: note: Variable 'error' is reassigned a value before
the old one has been used.
error = -EINVAL;
^
drivers/block/loop.c:697:8: note: Variable 'error' is reassigned a value before
the old one has been used.
error = -EBADF;
^
drivers/block/loop.c:702:8: warning: Variable 'error' is reassigned a value
before the old one has been used. [redundantAssignment]
error = loop_validate_file(file, bdev);
^
drivers/block/loop.c:697:8: note: Variable 'error' is reassigned a value before
the old one has been used.
error = -EBADF;
^
drivers/block/loop.c:702:8: note: Variable 'error' is reassigned a value before
the old one has been used.
error = loop_validate_file(file, bdev);
^
drivers/block/loop.c:1018:8: warning: Variable 'error' is reassigned a value
before the old one has been used. [redundantAssignment]
error = -EBUSY;
^
drivers/block/loop.c:1013:8: note: Variable 'error' is reassigned a value
before the old one has been used.
error = -EBADF;
^
drivers/block/loop.c:1018:8: note: Variable 'error' is reassigned a value
before the old one has been used.
error = -EBUSY;
^
drivers/block/loop.c:1022:8: warning: Variable 'error' is reassigned a value
before the old one has been used. [redundantAssignment]
error = loop_validate_file(file, bdev);
^
drivers/block/loop.c:1018:8: note: Variable 'error' is reassigned a value
before the old one has been used.
error = -EBUSY;
^
drivers/block/loop.c:1022:8: note: Variable 'error' is reassigned a value
before the old one has been used.
error = loop_validate_file(file, bdev);
^
drivers/block/loop.c:1435:8: warning: Variable 'error' is reassigned a value
before the old one has been used. [redundantAssignment]
error = -EINVAL;
^
drivers/block/loop.c:1428:0: note: Variable 'error' is reassigned a value
before the old one has been used.
int error = -ENXIO;
^
drivers/block/loop.c:1435:8: note: Variable 'error' is reassigned a value
before the old one has been used.
error = -EINVAL;
^
drivers/block/loop.c:1919:7: warning: Variable 'err' is reassigned a value
before the old one has been used. [redundantAssignment]
err = idr_alloc(&loop_index_idr, lo, i, i + 1, GFP_KERNEL);
^
drivers/block/loop.c:1910:6: note: Variable 'err' is reassigned a value before
the old one has been used.
err = -ENOMEM;
^
drivers/block/loop.c:1919:7: note: Variable 'err' is reassigned a value before
the old one has been used.
err = idr_alloc(&loop_index_idr, lo, i, i + 1, GFP_KERNEL);
^
drivers/block/loop.c:1938:6: warning: Variable 'err' is reassigned a value
before the old one has been used. [redundantAssignment]
err = blk_mq_alloc_tag_set(&lo->tag_set);
^
drivers/block/loop.c:1929:6: note: Variable 'err' is reassigned a value before
the old one has been used.
err = -ENOMEM;
^
drivers/block/loop.c:1938:6: note: Variable 'err' is reassigned a value before
the old one has been used.
err = blk_mq_alloc_tag_set(&lo->tag_set);
^
drivers/block/loop.c:511:23: warning: Local variable iter shadows outer variable
[shadowVar]
struct req_iterator iter;
^
drivers/block/loop.c:501:18: note: Shadowed declaration
struct iov_iter iter;
^
drivers/block/loop.c:511:23: note: Shadow variable
struct req_iterator iter;
^
> drivers/block/loop.c:1069:18: warning: Local variable bsize
shadows outer variable [shadowVar]
unsigned short bsize =
bdev_logical_block_size(
^
drivers/block/loop.c:1008:17: note: Shadowed declaration
unsigned short bsize;
^
drivers/block/loop.c:1069:18: note: Shadow variable
unsigned short bsize = bdev_logical_block_size(
^
vim +1069 drivers/block/loop.c
e25cf72f82f02a Martijn Coenen 2020-05-13 998
2061c5856b6886 Martijn Coenen 2020-05-13 999 static int loop_configure(struct
loop_device *lo, fmode_t mode,
2061c5856b6886 Martijn Coenen 2020-05-13 1000 struct block_device *bdev,
2061c5856b6886 Martijn Coenen 2020-05-13 1001 const struct loop_config
*config)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1002 {
6f9f5797fc7de2 Theodore Ts'o 2018-05-07 1003 struct file *file;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1004 struct inode *inode;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1005 struct address_space *mapping;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1006 int error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1007 loff_t size;
2061c5856b6886 Martijn Coenen 2020-05-13 1008 unsigned short bsize;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1009
^1da177e4c3f41 Linus Torvalds 2005-04-16 1010 /* This is safe, since we have a
reference from open(). */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1011 __module_get(THIS_MODULE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1012
^1da177e4c3f41 Linus Torvalds 2005-04-16 1013 error = -EBADF;
2061c5856b6886 Martijn Coenen 2020-05-13 1014 file = fget(config->fd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1015 if (!file)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1016 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1017
^1da177e4c3f41 Linus Torvalds 2005-04-16 1018 error = -EBUSY;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1019 if (lo->lo_state != Lo_unbound)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1020 goto out_putf;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1021
6f9f5797fc7de2 Theodore Ts'o 2018-05-07 1022 error = loop_validate_file(file,
bdev);
6f9f5797fc7de2 Theodore Ts'o 2018-05-07 1023 if (error)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1024 goto out_putf;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1025
^1da177e4c3f41 Linus Torvalds 2005-04-16 1026 mapping = file->f_mapping;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1027 inode = mapping->host;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1028
2061c5856b6886 Martijn Coenen 2020-05-13 1029 size = get_loop_size(lo, file);
2061c5856b6886 Martijn Coenen 2020-05-13 1030
2061c5856b6886 Martijn Coenen 2020-05-13 1031 if ((config->info.lo_flags &
~LOOP_CONFIGURE_SETTABLE_FLAGS) != 0) {
2061c5856b6886 Martijn Coenen 2020-05-13 1032 error = -EINVAL;
2061c5856b6886 Martijn Coenen 2020-05-13 1033 goto out_putf;
2061c5856b6886 Martijn Coenen 2020-05-13 1034 }
2061c5856b6886 Martijn Coenen 2020-05-13 1035
2061c5856b6886 Martijn Coenen 2020-05-13 1036 if (config->block_size) {
2061c5856b6886 Martijn Coenen 2020-05-13 1037 error =
loop_validate_block_size(config->block_size);
2061c5856b6886 Martijn Coenen 2020-05-13 1038 if (error)
2061c5856b6886 Martijn Coenen 2020-05-13 1039 goto out_putf;
2061c5856b6886 Martijn Coenen 2020-05-13 1040 }
2061c5856b6886 Martijn Coenen 2020-05-13 1041
2061c5856b6886 Martijn Coenen 2020-05-13 1042 error =
loop_set_status_from_info(lo, &config->info);
2061c5856b6886 Martijn Coenen 2020-05-13 1043 if (error)
2061c5856b6886 Martijn Coenen 2020-05-13 1044 goto out_putf;
2061c5856b6886 Martijn Coenen 2020-05-13 1045
456be1484ffc72 Christoph Hellwig 2011-10-17 1046 if (!(file->f_mode &
FMODE_WRITE) || !(mode & FMODE_WRITE) ||
283e7e5d249f48 Al Viro 2015-04-03 1047 !file->f_op->write_iter)
2061c5856b6886 Martijn Coenen 2020-05-13 1048 lo->lo_flags |=
LO_FLAGS_READ_ONLY;
6e0c4b058649df Martijn Coenen 2020-05-13 1049
e03a3d7a94e248 Ming Lei 2015-08-17 1050 error = loop_prepare_queue(lo);
e03a3d7a94e248 Ming Lei 2015-08-17 1051 if (error)
f4aa4c7bbac6c4 Ming Lei 2015-05-05 1052 goto out_putf;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1053
456be1484ffc72 Christoph Hellwig 2011-10-17 1054 error = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1055
2061c5856b6886 Martijn Coenen 2020-05-13 1056 set_device_ro(bdev, (lo->lo_flags
& LO_FLAGS_READ_ONLY) != 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1057
2061c5856b6886 Martijn Coenen 2020-05-13 1058 lo->use_dio = lo->lo_flags
& LO_FLAGS_DIRECT_IO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1059 lo->lo_device = bdev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1060 lo->lo_backing_file = file;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1061 lo->old_gfp_mask =
mapping_gfp_mask(mapping);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1062 mapping_set_gfp_mask(mapping,
lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1063
2061c5856b6886 Martijn Coenen 2020-05-13 1064 if (!(lo->lo_flags &
LO_FLAGS_READ_ONLY) && file->f_op->fsync)
21d0727f639e4b Jens Axboe 2016-03-30 1065
blk_queue_write_cache(lo->lo_queue, true, false);
68db1961bbf4e1 Nikanth Karthikesan 2009-03-24 1066
907f2050333a68 Martijn Coenen 2019-09-04 1067 if
(io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev) {
907f2050333a68 Martijn Coenen 2019-09-04 1068 /* In case of direct I/O, match
underlying block size */
907f2050333a68 Martijn Coenen 2019-09-04 @1069 unsigned short bsize =
bdev_logical_block_size(
907f2050333a68 Martijn Coenen 2019-09-04 1070 inode->i_sb->s_bdev);
907f2050333a68 Martijn Coenen 2019-09-04 1071
907f2050333a68 Martijn Coenen 2019-09-04 1072
blk_queue_logical_block_size(lo->lo_queue, bsize);
907f2050333a68 Martijn Coenen 2019-09-04 1073
blk_queue_physical_block_size(lo->lo_queue, bsize);
907f2050333a68 Martijn Coenen 2019-09-04 1074 blk_queue_io_min(lo->lo_queue,
bsize);
907f2050333a68 Martijn Coenen 2019-09-04 1075 }
907f2050333a68 Martijn Coenen 2019-09-04 1076
2e5ab5f379f96a Ming Lei 2015-08-17 1077 loop_update_dio(lo);
ee86273062cbb3 Milan Broz 2010-08-23 1078 loop_sysfs_init(lo);
88bd1b944fabf6 Martijn Coenen 2020-05-13 1079 loop_set_size(lo, size);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1080
2061c5856b6886 Martijn Coenen 2020-05-13 1081 if (config->block_size)
2061c5856b6886 Martijn Coenen 2020-05-13 1082 bsize = config->block_size;
2061c5856b6886 Martijn Coenen 2020-05-13 1083 else
2061c5856b6886 Martijn Coenen 2020-05-13 1084 bsize = S_ISBLK(inode->i_mode)
?
2061c5856b6886 Martijn Coenen 2020-05-13 1085 block_size(inode->i_bdev)
: PAGE_SIZE;
2061c5856b6886 Martijn Coenen 2020-05-13 1086
2061c5856b6886 Martijn Coenen 2020-05-13 1087 set_blocksize(bdev, bsize);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1088
6c9979185c7ef4 Serge E. Hallyn 2006-09-29 1089 lo->lo_state = Lo_bound;
e03c8dd14915fa Kay Sievers 2011-08-23 1090 if (part_shift)
e03c8dd14915fa Kay Sievers 2011-08-23 1091 lo->lo_flags |=
LO_FLAGS_PARTSCAN;
e03c8dd14915fa Kay Sievers 2011-08-23 1092 if (lo->lo_flags &
LO_FLAGS_PARTSCAN)
06f0e9e68c0d81 Ming Lei 2015-05-06 1093 loop_reread_partitions(lo, bdev);
c1681bf8a7b1b9 Anatol Pomozov 2013-04-01 1094
c1681bf8a7b1b9 Anatol Pomozov 2013-04-01 1095 /* Grab the block_device to prevent
its destruction after we
c1681bf8a7b1b9 Anatol Pomozov 2013-04-01 1096 * put /dev/loopXX inode. Later in
loop_clr_fd() we bdput(bdev).
c1681bf8a7b1b9 Anatol Pomozov 2013-04-01 1097 */
c1681bf8a7b1b9 Anatol Pomozov 2013-04-01 1098 bdgrab(bdev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1099 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1100
^1da177e4c3f41 Linus Torvalds 2005-04-16 1101 out_putf:
^1da177e4c3f41 Linus Torvalds 2005-04-16 1102 fput(file);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1103 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 1104 /* This is safe: open() is still
holding a reference. */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1105 module_put(THIS_MODULE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1106 return error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1107 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1108
:::::: The code at line 1069 was first introduced by commit
:::::: 907f2050333a68ec2166f0b5badb0edd85ef584c BACKPORT: loop: change queue block size to
match when using DIO
:::::: TO: Martijn Coenen <maco(a)android.com>
:::::: CC: Martijn Coenen <maco(a)android.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org