lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202204232126.HLpn2Rg5-lkp@intel.com>
Date:   Sat, 23 Apr 2022 21:05:09 +0800
From:   kernel test robot <lkp@...el.com>
To:     Sweet Tea Dorminy <sweettea-kernel@...miny.me>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        David Sterba <dsterba@...e.com>,
        Nikolay Borisov <nborisov@...e.com>
Subject: [kdave-btrfs-devel:misc-next 67/136] fs/btrfs/extent_io.c:5952:7:
 warning: Local variable 'ret' shadows outer variable [shadowVariable]

tree:   https://github.com/kdave/btrfs-devel.git misc-next
head:   446e59dd6c55d120dc09444a1f086e5a81898665
commit: 55093e751296ec57c65374e1e0378f6d32946389 [67/136] btrfs: factor out allocating an array of pages
compiler: microblaze-linux-gcc (GCC) 11.2.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 55093e751296ec57c65374e1e0378f6d32946389
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


cppcheck warnings: (new ones prefixed by >>)
        ^
>> fs/btrfs/extent_io.c:5952:7: warning: Local variable 'ret' shadows outer variable [shadowVariable]
     int ret;
         ^
   fs/btrfs/extent_io.c:5931:6: note: Shadowed declaration
    int ret;
        ^
   fs/btrfs/extent_io.c:5952:7: note: Shadow variable
     int ret;
         ^

cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

        ^
   fs/btrfs/extent_io.c:369:26: warning: Parameter 'p_in' can be declared with const [constParameter]
          struct rb_node ***p_in,
                            ^
   fs/btrfs/extent_io.c:370:25: warning: Parameter 'parent_in' can be declared with const [constParameter]
          struct rb_node **parent_in)
                           ^
   fs/btrfs/extent_io.c:1823:30: warning: Parameter 'mapping' can be declared with const [constParameter]
          struct address_space *mapping,
                                ^
   fs/btrfs/extent_io.c:1824:40: warning: Parameter 'locked_page' can be declared with const [constParameter]
          struct page *page, struct page *locked_page,
                                          ^
   fs/btrfs/extent_io.c:6052:16: warning: Parameter 'accessed' can be declared with const [constParameter]
     struct page *accessed)
                  ^

vim +/ret +5952 fs/btrfs/extent_io.c

  5925	
  5926	struct extent_buffer *btrfs_clone_extent_buffer(const struct extent_buffer *src)
  5927	{
  5928		int i;
  5929		struct extent_buffer *new;
  5930		int num_pages = num_extent_pages(src);
  5931		int ret;
  5932	
  5933		new = __alloc_extent_buffer(src->fs_info, src->start, src->len);
  5934		if (new == NULL)
  5935			return NULL;
  5936	
  5937		/*
  5938		 * Set UNMAPPED before calling btrfs_release_extent_buffer(), as
  5939		 * btrfs_release_extent_buffer() have different behavior for
  5940		 * UNMAPPED subpage extent buffer.
  5941		 */
  5942		set_bit(EXTENT_BUFFER_UNMAPPED, &new->bflags);
  5943	
  5944		memset(new->pages, 0, sizeof(*new->pages) * num_pages);
  5945		ret = btrfs_alloc_page_array(num_pages, new->pages);
  5946		if (ret) {
  5947			btrfs_release_extent_buffer(new);
  5948			return NULL;
  5949		}
  5950	
  5951		for (i = 0; i < num_pages; i++) {
> 5952			int ret;
  5953			struct page *p = new->pages[i];
  5954	
  5955			ret = attach_extent_buffer_page(new, p, NULL);
  5956			if (ret < 0) {
  5957				btrfs_release_extent_buffer(new);
  5958				return NULL;
  5959			}
  5960			WARN_ON(PageDirty(p));
  5961			copy_page(page_address(p), page_address(src->pages[i]));
  5962		}
  5963		set_extent_buffer_uptodate(new);
  5964	
  5965		return new;
  5966	}
  5967	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ