All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [bcachefs:bcachefs-testing 409/413] fs/bcachefs/sysfs.c:811 sysfs_opt_store() error: we previously assumed 'ca' could be null (see line 806)
Date: Sat, 13 Sep 2025 00:40:00 +0800	[thread overview]
Message-ID: <202509130045.dqS8rJDb-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Kent Overstreet <kent.overstreet@linux.dev>
TO: Kent Overstreet <kent.overstreet@linux.dev>

tree:   https://evilpiepirate.org/git/bcachefs.git bcachefs-testing
head:   bb2535dc2fde90827c6c5f396f650218c1708fa2
commit: 3da259c787a77ffffc7289a3b34b5d2bd862b446 [409/413] bcachefs: bch2_set_rebalance_needs_scan_device()
:::::: branch date: 12 hours ago
:::::: commit date: 15 hours ago
config: hexagon-randconfig-r071-20250912 (https://download.01.org/0day-ci/archive/20250913/202509130045.dqS8rJDb-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 21857ae337e0892a5522b6e7337899caa61de2a6)

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202509130045.dqS8rJDb-lkp@intel.com/

smatch warnings:
fs/bcachefs/sysfs.c:811 sysfs_opt_store() error: we previously assumed 'ca' could be null (see line 806)

vim +/ca +811 fs/bcachefs/sysfs.c

1c6fdbd8f2465d Kent Overstreet 2017-03-16  763  
8b294a9b5c1447 Kent Overstreet 2025-03-11  764  static ssize_t sysfs_opt_store(struct bch_fs *c,
8b294a9b5c1447 Kent Overstreet 2025-03-11  765  			       struct bch_dev *ca,
8b294a9b5c1447 Kent Overstreet 2025-03-11  766  			       enum bch_opt_id id,
8b294a9b5c1447 Kent Overstreet 2025-03-11  767  			       const char *buf, size_t size)
1c6fdbd8f2465d Kent Overstreet 2017-03-16  768  {
8b294a9b5c1447 Kent Overstreet 2025-03-11  769  	const struct bch_option *opt = bch2_opt_table + id;
8b294a9b5c1447 Kent Overstreet 2025-03-11  770  	int ret = 0;
1c6fdbd8f2465d Kent Overstreet 2017-03-16  771  
f0cc5d2931378b Kent Overstreet 2022-03-06  772  	/*
f0cc5d2931378b Kent Overstreet 2022-03-06  773  	 * We don't need to take c->writes for correctness, but it eliminates an
f0cc5d2931378b Kent Overstreet 2022-03-06  774  	 * unsightly error message in the dmesg log when we're RO:
f0cc5d2931378b Kent Overstreet 2022-03-06  775  	 */
c9b1d94a2196fc Kent Overstreet 2025-04-18  776  	if (unlikely(!enumerated_ref_tryget(&c->writes, BCH_WRITE_REF_sysfs)))
f0cc5d2931378b Kent Overstreet 2022-03-06  777  		return -EROFS;
f0cc5d2931378b Kent Overstreet 2022-03-06  778  
8b294a9b5c1447 Kent Overstreet 2025-03-11  779  	char *tmp = kstrdup(buf, GFP_KERNEL);
f0cc5d2931378b Kent Overstreet 2022-03-06  780  	if (!tmp) {
f0cc5d2931378b Kent Overstreet 2022-03-06  781  		ret = -ENOMEM;
f0cc5d2931378b Kent Overstreet 2022-03-06  782  		goto err;
f0cc5d2931378b Kent Overstreet 2022-03-06  783  	}
1c6fdbd8f2465d Kent Overstreet 2017-03-16  784  
8b294a9b5c1447 Kent Overstreet 2025-03-11  785  	u64 v;
8b294a9b5c1447 Kent Overstreet 2025-03-11  786  	ret =   bch2_opt_parse(c, opt, strim(tmp), &v, NULL) ?:
c93cee090d7386 Kent Overstreet 2025-08-27  787  		bch2_opt_hook_pre_set(c, ca, 0, id, v, true);
1c6fdbd8f2465d Kent Overstreet 2017-03-16  788  	kfree(tmp);
1c6fdbd8f2465d Kent Overstreet 2017-03-16  789  
1c6fdbd8f2465d Kent Overstreet 2017-03-16  790  	if (ret < 0)
f0cc5d2931378b Kent Overstreet 2022-03-06  791  		goto err;
1c6fdbd8f2465d Kent Overstreet 2017-03-16  792  
e882906929c55a Kent Overstreet 2025-05-14  793  	bool is_sb = opt->get_sb || opt->get_member;
e882906929c55a Kent Overstreet 2025-05-14  794  	bool changed = false;
e882906929c55a Kent Overstreet 2025-05-14  795  
e882906929c55a Kent Overstreet 2025-05-14  796  	if (is_sb) {
e882906929c55a Kent Overstreet 2025-05-14  797  		changed = bch2_opt_set_sb(c, ca, opt, v);
e882906929c55a Kent Overstreet 2025-05-14  798  	} else if (!ca) {
e882906929c55a Kent Overstreet 2025-05-14  799  		changed = bch2_opt_get_by_id(&c->opts, id) != v;
e882906929c55a Kent Overstreet 2025-05-14  800  	} else {
e882906929c55a Kent Overstreet 2025-05-14  801  		/* device options that aren't superblock options aren't
e882906929c55a Kent Overstreet 2025-05-14  802  		 * supported */
e882906929c55a Kent Overstreet 2025-05-14  803  		BUG();
e882906929c55a Kent Overstreet 2025-05-14  804  	}
c2250847043901 Kent Overstreet 2024-10-24  805  
c79eb06da4c34f Kent Overstreet 2025-04-15 @806  	if (!ca)
c79eb06da4c34f Kent Overstreet 2025-04-15  807  		bch2_opt_set_by_id(&c->opts, id, v);
80be08cdb5a822 Kent Overstreet 2025-03-13  808  
3da259c787a77f Kent Overstreet 2025-08-23  809  	/* XXX: add a superblock bit to make this transactional */
3da259c787a77f Kent Overstreet 2025-08-23  810  	if (id == Opt_durability)
3da259c787a77f Kent Overstreet 2025-08-23 @811  		bch2_set_rebalance_needs_scan_device(c, ca->dev_idx);
3da259c787a77f Kent Overstreet 2025-08-23  812  
c79eb06da4c34f Kent Overstreet 2025-04-15  813  	if (changed)
041ac8a7a4b4d1 Kent Overstreet 2025-08-27  814  		bch2_opt_hook_post_set(c, ca, 0, id, v);
80be08cdb5a822 Kent Overstreet 2025-03-13  815  
f0cc5d2931378b Kent Overstreet 2022-03-06  816  	ret = size;
f0cc5d2931378b Kent Overstreet 2022-03-06  817  err:
c9b1d94a2196fc Kent Overstreet 2025-04-18  818  	enumerated_ref_put(&c->writes, BCH_WRITE_REF_sysfs);
f0cc5d2931378b Kent Overstreet 2022-03-06  819  	return ret;
1c6fdbd8f2465d Kent Overstreet 2017-03-16  820  }
8b294a9b5c1447 Kent Overstreet 2025-03-11  821  

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

                 reply	other threads:[~2025-09-12 16:40 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=202509130045.dqS8rJDb-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@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.