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: <202202170739.jOmFwlAm-lkp@intel.com>
Date:   Thu, 17 Feb 2022 07:47:43 +0800
From:   kernel test robot <lkp@...el.com>
To:     David Howells <dhowells@...hat.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
        linux-kernel@...r.kernel.org
Subject: [ammarfaizi2-block:dhowells/linux-fs/netfs-maple 31/42]
 fs/netfs/buffered_write.c:749:6: warning: variable 'spare_region' is used
 uninitialized whenever 'if' condition is true

tree:   https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-maple
head:   5cb7f190822d09757b30cd9539e57eef72552d1f
commit: eefdd180445e96088f4a69f0e733643e9a794b1f [31/42] netfs: Allow buffered shared-writeable mmap through netfs_page_mkwrite()
config: hexagon-randconfig-r005-20220216 (https://download.01.org/0day-ci/archive/20220217/202202170739.jOmFwlAm-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0e628a783b935c70c80815db6c061ec84f884af5)
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/ammarfaizi2/linux-block/commit/eefdd180445e96088f4a69f0e733643e9a794b1f
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/netfs-maple
        git checkout eefdd180445e96088f4a69f0e733643e9a794b1f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash fs/netfs/

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

All warnings (new ones prefixed by >>):

   fs/netfs/buffered_write.c:28:26: warning: comparison of distinct pointer types ('typeof ((1UL << 14) - offset) *' (aka 'unsigned long *') and 'typeof (size) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
                   unsigned int psize   = min(PAGE_SIZE - offset, size);
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                 ^~~~~~~~~~~~~~~~
   include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                    ^~~~~~~~~~~~~~~~~
   include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   fs/netfs/buffered_write.c:95:18: warning: comparison of distinct pointer types ('typeof (target->from) *' (aka 'unsigned long long *') and 'typeof (folio_pos(folio) + offset) *' (aka 'long long *')) [-Wcompare-distinct-pointer-types]
           target->from  = min(target->from, folio_pos(folio) + offset);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                 ^~~~~~~~~~~~~~~~
   include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                    ^~~~~~~~~~~~~~~~~
   include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   fs/netfs/buffered_write.c:96:18: warning: comparison of distinct pointer types ('typeof (target->to) *' (aka 'unsigned long long *') and 'typeof (folio_pos(folio) + offset + len) *' (aka 'long long *')) [-Wcompare-distinct-pointer-types]
           target->to    = max(target->to,   folio_pos(folio) + offset + len);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:52:19: note: expanded from macro 'max'
   #define max(x, y)       __careful_cmp(x, y, >)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                 ^~~~~~~~~~~~~~~~
   include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                    ^~~~~~~~~~~~~~~~~
   include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
>> fs/netfs/buffered_write.c:749:6: warning: variable 'spare_region' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (mas_expected_entries(&mas, 2) < 0) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/netfs/buffered_write.c:785:30: note: uninitialized use occurs here
           netfs_put_dirty_region(ctx, spare_region, netfs_region_trace_put_discard);
                                       ^~~~~~~~~~~~
   fs/netfs/buffered_write.c:749:2: note: remove the 'if' if its condition is always false
           if (mas_expected_entries(&mas, 2) < 0) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/netfs/buffered_write.c:746:6: warning: variable 'spare_region' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (folio_lock_killable(folio) < 0)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/netfs/buffered_write.c:785:30: note: uninitialized use occurs here
           netfs_put_dirty_region(ctx, spare_region, netfs_region_trace_put_discard);
                                       ^~~~~~~~~~~~
   fs/netfs/buffered_write.c:746:2: note: remove the 'if' if its condition is always false
           if (folio_lock_killable(folio) < 0)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/netfs/buffered_write.c:743:6: warning: variable 'spare_region' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (folio_wait_writeback_killable(folio))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/netfs/buffered_write.c:785:30: note: uninitialized use occurs here
           netfs_put_dirty_region(ctx, spare_region, netfs_region_trace_put_discard);
                                       ^~~~~~~~~~~~
   fs/netfs/buffered_write.c:743:2: note: remove the 'if' if its condition is always false
           if (folio_wait_writeback_killable(folio))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/netfs/buffered_write.c:726:41: note: initialize the variable 'spare_region' to silence this warning
           struct netfs_dirty_region *spare_region;
                                                  ^
                                                   = NULL
   6 warnings generated.


vim +749 fs/netfs/buffered_write.c

   719	
   720	/*
   721	 * Notification that a previously read-only page is about to become writable.
   722	 * Note that the caller indicates a single page of a multipage folio.
   723	 */
   724	vm_fault_t netfs_page_mkwrite(struct vm_fault *vmf)
   725	{
   726		struct netfs_dirty_region *spare_region;
   727		struct folio *folio = page_folio(vmf->page);
   728		struct file *file = vmf->vma->vm_file;
   729		struct inode *inode = file_inode(file);
   730		struct netfs_i_context *ctx = netfs_i_context(inode);
   731		vm_fault_t ret = VM_FAULT_RETRY;
   732		int err;
   733	
   734		MA_STATE(mas, &ctx->dirty_regions, vmf->page->index, PAGE_SIZE);
   735	
   736		_enter("%lx", folio->index);
   737	
   738		if (ctx->ops->validate_for_write(inode, file) < 0)
   739			return VM_FAULT_SIGBUS;
   740	
   741		sb_start_pagefault(inode->i_sb);
   742	
   743		if (folio_wait_writeback_killable(folio))
   744			goto out;
   745	
   746		if (folio_lock_killable(folio) < 0)
   747			goto out;
   748	
 > 749		if (mas_expected_entries(&mas, 2) < 0) {

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ