From: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [intel-lts:pr/59 1/1] drivers/block/loop.c:662:16: warning: variable 'inode' set but not used
Date: Wed, 19 Feb 2025 07:26:06 +0800 [thread overview]
Message-ID: <202502190714.GkOSy4o2-lkp@intel.com> (raw)
Hi Theodore,
FYI, the error/warning still remains.
tree: https://github.com/intel/linux-intel-lts.git pr/59
head: 19ae9bc73680fd6c1c95edb5b7e2aaa790e7f011
commit: 6f9f5797fc7de2e9f801b2f7af0726e1349d33a4 [1/1] loop: add recursion validation to LOOP_CHANGE_FD
config: sh-randconfig-002-20250218 (https://download.01.org/0day-ci/archive/20250219/202502190714.GkOSy4o2-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250219/202502190714.GkOSy4o2-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502190714.GkOSy4o2-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/block/loop.c: In function 'loop_change_fd':
>> drivers/block/loop.c:662:16: warning: variable 'inode' set but not used [-Wunused-but-set-variable]
struct inode *inode;
^~~~~
vim +/inode +662 drivers/block/loop.c
6f9f5797fc7de2 Theodore Ts'o 2018-05-07 649
^1da177e4c3f41 Linus Torvalds 2005-04-16 650 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 651 * loop_change_fd switched the backing store of a loopback device to
^1da177e4c3f41 Linus Torvalds 2005-04-16 652 * a new file. This is useful for operating system installers to free up
^1da177e4c3f41 Linus Torvalds 2005-04-16 653 * the original file and in High Availability environments to switch to
^1da177e4c3f41 Linus Torvalds 2005-04-16 654 * an alternative location for the content in case of server meltdown.
^1da177e4c3f41 Linus Torvalds 2005-04-16 655 * This can only work if the loop device is used read-only, and if the
^1da177e4c3f41 Linus Torvalds 2005-04-16 656 * new backing store is the same size and type as the old backing store.
^1da177e4c3f41 Linus Torvalds 2005-04-16 657 */
bb21488482bd36 Al Viro 2008-03-02 658 static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
bb21488482bd36 Al Viro 2008-03-02 659 unsigned int arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 660 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 661 struct file *file, *old_file;
^1da177e4c3f41 Linus Torvalds 2005-04-16 @662 struct inode *inode;
^1da177e4c3f41 Linus Torvalds 2005-04-16 663 int error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 664
^1da177e4c3f41 Linus Torvalds 2005-04-16 665 error = -ENXIO;
^1da177e4c3f41 Linus Torvalds 2005-04-16 666 if (lo->lo_state != Lo_bound)
^1da177e4c3f41 Linus Torvalds 2005-04-16 667 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 668
^1da177e4c3f41 Linus Torvalds 2005-04-16 669 /* the loop device has to be read-only */
^1da177e4c3f41 Linus Torvalds 2005-04-16 670 error = -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 671 if (!(lo->lo_flags & LO_FLAGS_READ_ONLY))
^1da177e4c3f41 Linus Torvalds 2005-04-16 672 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 673
^1da177e4c3f41 Linus Torvalds 2005-04-16 674 error = -EBADF;
^1da177e4c3f41 Linus Torvalds 2005-04-16 675 file = fget(arg);
^1da177e4c3f41 Linus Torvalds 2005-04-16 676 if (!file)
^1da177e4c3f41 Linus Torvalds 2005-04-16 677 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 678
6f9f5797fc7de2 Theodore Ts'o 2018-05-07 679 error = loop_validate_file(file, bdev);
6f9f5797fc7de2 Theodore Ts'o 2018-05-07 680 if (error)
6f9f5797fc7de2 Theodore Ts'o 2018-05-07 681 goto out_putf;
6f9f5797fc7de2 Theodore Ts'o 2018-05-07 682
^1da177e4c3f41 Linus Torvalds 2005-04-16 683 inode = file->f_mapping->host;
^1da177e4c3f41 Linus Torvalds 2005-04-16 684 old_file = lo->lo_backing_file;
^1da177e4c3f41 Linus Torvalds 2005-04-16 685
^1da177e4c3f41 Linus Torvalds 2005-04-16 686 error = -EINVAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 687
^1da177e4c3f41 Linus Torvalds 2005-04-16 688 /* size of the new backing store needs to be the same */
^1da177e4c3f41 Linus Torvalds 2005-04-16 689 if (get_loop_size(lo, file) != get_loop_size(lo, old_file))
^1da177e4c3f41 Linus Torvalds 2005-04-16 690 goto out_putf;
^1da177e4c3f41 Linus Torvalds 2005-04-16 691
^1da177e4c3f41 Linus Torvalds 2005-04-16 692 /* and ... switch */
43cade803ebeb0 Omar Sandoval 2017-08-24 693 blk_mq_freeze_queue(lo->lo_queue);
43cade803ebeb0 Omar Sandoval 2017-08-24 694 mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
43cade803ebeb0 Omar Sandoval 2017-08-24 695 lo->lo_backing_file = file;
43cade803ebeb0 Omar Sandoval 2017-08-24 696 lo->old_gfp_mask = mapping_gfp_mask(file->f_mapping);
43cade803ebeb0 Omar Sandoval 2017-08-24 697 mapping_set_gfp_mask(file->f_mapping,
43cade803ebeb0 Omar Sandoval 2017-08-24 698 lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
43cade803ebeb0 Omar Sandoval 2017-08-24 699 loop_update_dio(lo);
43cade803ebeb0 Omar Sandoval 2017-08-24 700 blk_mq_unfreeze_queue(lo->lo_queue);
^1da177e4c3f41 Linus Torvalds 2005-04-16 701
^1da177e4c3f41 Linus Torvalds 2005-04-16 702 fput(old_file);
e03c8dd14915fa Kay Sievers 2011-08-23 703 if (lo->lo_flags & LO_FLAGS_PARTSCAN)
06f0e9e68c0d81 Ming Lei 2015-05-06 704 loop_reread_partitions(lo, bdev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 705 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 706
^1da177e4c3f41 Linus Torvalds 2005-04-16 707 out_putf:
^1da177e4c3f41 Linus Torvalds 2005-04-16 708 fput(file);
^1da177e4c3f41 Linus Torvalds 2005-04-16 709 out:
^1da177e4c3f41 Linus Torvalds 2005-04-16 710 return error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 711 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 712
:::::: The code at line 662 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2025-02-18 23:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202502190714.GkOSy4o2-lkp@intel.com \
--to=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.