LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org
Subject: [amir73il:fsnotify-perf 3/5] fs/notify/mark.c:198:11: warning: variable 'sb' is used uninitialized whenever 'if' condition is false
Date: Tue, 3 Aug 2021 17:36:00 +0800	[thread overview]
Message-ID: <202108031757.lTxFKThS-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3747 bytes --]

tree:   https://github.com/amir73il/linux fsnotify-perf
head:   7446ba772ae107ab937cd04e8800236d6235dc4c
commit: 73c769c1b2c30c19870d29f2153bbe1c1750cc88 [3/5] fsnotify: count all objects with attached connectors
config: s390-randconfig-r014-20210803 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
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
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/amir73il/linux/commit/73c769c1b2c30c19870d29f2153bbe1c1750cc88
        git remote add amir73il https://github.com/amir73il/linux
        git fetch --no-tags amir73il fsnotify-perf
        git checkout 73c769c1b2c30c19870d29f2153bbe1c1750cc88
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

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

All warnings (new ones prefixed by >>):

>> fs/notify/mark.c:198:11: warning: variable 'sb' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           else if (conn->type == FSNOTIFY_OBJ_TYPE_SB)
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/notify/mark.c:201:19: note: uninitialized use occurs here
           atomic_long_inc(&sb->s_fsnotify_obj_refs);
                            ^~
   fs/notify/mark.c:198:7: note: remove the 'if' if its condition is always true
           else if (conn->type == FSNOTIFY_OBJ_TYPE_SB)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/notify/mark.c:189:24: note: initialize the variable 'sb' to silence this warning
           struct super_block *sb;
                                 ^
                                  = NULL
   fs/notify/mark.c:215:11: warning: variable 'sb' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           else if (conn->type == FSNOTIFY_OBJ_TYPE_SB)
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/notify/mark.c:218:32: note: uninitialized use occurs here
           if (atomic_long_dec_and_test(&sb->s_fsnotify_obj_refs))
                                         ^~
   fs/notify/mark.c:215:7: note: remove the 'if' if its condition is always true
           else if (conn->type == FSNOTIFY_OBJ_TYPE_SB)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/notify/mark.c:206:24: note: initialize the variable 'sb' to silence this warning
           struct super_block *sb;
                                 ^
                                  = NULL
   fs/notify/mark.c:263:22: warning: variable 'sb' set but not used [-Wunused-but-set-variable]
           struct super_block *sb;
                               ^
   3 warnings generated.


vim +198 fs/notify/mark.c

   186	
   187	static void fsnotify_get_object_ref(struct fsnotify_mark_connector *conn)
   188	{
   189		struct super_block *sb;
   190	
   191		if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED)
   192			return;
   193	
   194		if (conn->type == FSNOTIFY_OBJ_TYPE_INODE)
   195			sb = fsnotify_conn_inode(conn)->i_sb;
   196		else if (conn->type == FSNOTIFY_OBJ_TYPE_VFSMOUNT)
   197			sb = fsnotify_conn_mount(conn)->mnt.mnt_sb;
 > 198		else if (conn->type == FSNOTIFY_OBJ_TYPE_SB)
   199			sb = fsnotify_conn_sb(conn);
   200	
   201		atomic_long_inc(&sb->s_fsnotify_obj_refs);
   202	}
   203	

---
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: 15732 bytes --]

                 reply	other threads:[~2021-08-03  9:36 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=202108031757.lTxFKThS-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=amir73il@gmail.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [amir73il:fsnotify-perf 3/5] fs/notify/mark.c:198:11: warning: variable '\''sb'\'' is used uninitialized whenever '\''if'\'' condition is false' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).