Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [linkinjeon-exfat:iomap-work 8/9] fs/exfat/file.c:303:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true
Date: Tue, 12 May 2026 04:24:46 +0200	[thread overview]
Message-ID: <202605120425.jIp6e2MN-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat.git iomap-work
head:   6bbe9d8bf6e38726b6d4421a7b144186d8e10a9f
commit: c5b2f44ae0af3036dffc5f3252cd807e42ac8d2b [8/9] exfat: add iomap direct I/O support
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260512/202605120425.jIp6e2MN-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260512/202605120425.jIp6e2MN-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/202605120425.jIp6e2MN-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/exfat/file.c:303:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
     303 |         if (ei->start_clu == 0) {
         |             ^~~~~~~~~~~~~~~~~~
   fs/exfat/file.c:319:9: note: uninitialized use occurs here
     319 |         return err;
         |                ^~~
   fs/exfat/file.c:303:2: note: remove the 'if' if its condition is always false
     303 |         if (ei->start_clu == 0) {
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
     304 |                 /*
         |                 ~~
     305 |                  * Empty start_clu != ~0 (not allocated)
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     306 |                  */
         |                  ~~
     307 |                 exfat_fs_error(sb, "tried to truncate zeroed cluster.");
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     308 |                 goto write_size;
         |                 ~~~~~~~~~~~~~~~~
     309 |         }
         |         ~
   fs/exfat/file.c:300:9: note: initialize the variable 'err' to silence this warning
     300 |         int err;
         |                ^
         |                 = 0
   1 warning generated.


vim +303 fs/exfat/file.c

98d917047e8b7f Namjae Jeon           2020-03-02  294  
c5b2f44ae0af30 Namjae Jeon           2026-05-07  295  static int exfat_truncate(struct inode *inode)
98d917047e8b7f Namjae Jeon           2020-03-02  296  {
98d917047e8b7f Namjae Jeon           2020-03-02  297  	struct super_block *sb = inode->i_sb;
98d917047e8b7f Namjae Jeon           2020-03-02  298  	struct exfat_sb_info *sbi = EXFAT_SB(sb);
7dee6f57d7f22a Christophe Vu-Brugier 2021-11-02  299  	struct exfat_inode_info *ei = EXFAT_I(inode);
98d917047e8b7f Namjae Jeon           2020-03-02  300  	int err;
98d917047e8b7f Namjae Jeon           2020-03-02  301  
98d917047e8b7f Namjae Jeon           2020-03-02  302  	mutex_lock(&sbi->s_lock);
7dee6f57d7f22a Christophe Vu-Brugier 2021-11-02 @303  	if (ei->start_clu == 0) {
98d917047e8b7f Namjae Jeon           2020-03-02  304  		/*
98d917047e8b7f Namjae Jeon           2020-03-02  305  		 * Empty start_clu != ~0 (not allocated)
98d917047e8b7f Namjae Jeon           2020-03-02  306  		 */
98d917047e8b7f Namjae Jeon           2020-03-02  307  		exfat_fs_error(sb, "tried to truncate zeroed cluster.");
98d917047e8b7f Namjae Jeon           2020-03-02  308  		goto write_size;
98d917047e8b7f Namjae Jeon           2020-03-02  309  	}
98d917047e8b7f Namjae Jeon           2020-03-02  310  
f7cde96710a436 Yuezhang Mo           2022-03-28  311  	err = __exfat_truncate(inode);
98d917047e8b7f Namjae Jeon           2020-03-02  312  	if (err)
98d917047e8b7f Namjae Jeon           2020-03-02  313  		goto write_size;
98d917047e8b7f Namjae Jeon           2020-03-02  314  
39c1ce8eafc0ff Yuezhang Mo           2023-01-04  315  	inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9;
98d917047e8b7f Namjae Jeon           2020-03-02  316  write_size:
98d917047e8b7f Namjae Jeon           2020-03-02  317  	mutex_unlock(&sbi->s_lock);
c5b2f44ae0af30 Namjae Jeon           2026-05-07  318  
c5b2f44ae0af30 Namjae Jeon           2026-05-07  319  	return err;
98d917047e8b7f Namjae Jeon           2020-03-02  320  }
98d917047e8b7f Namjae Jeon           2020-03-02  321  

:::::: The code at line 303 was first introduced by commit
:::::: 7dee6f57d7f22a89dd214518c778aec448270d4c exfat: reuse exfat_inode_info variable instead of calling EXFAT_I()

:::::: TO: Christophe Vu-Brugier <christophe.vu-brugier@seagate.com>
:::::: CC: Namjae Jeon <linkinjeon@kernel.org>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2026-05-12  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  2:24 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-05-11 22:06 [linkinjeon-exfat:iomap-work 8/9] fs/exfat/file.c:303:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true kernel test robot

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=202605120425.jIp6e2MN-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linkinjeon@kernel.org \
    --cc=llvm@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox