* [bcache:for-next 9/27] drivers/md/bcache/sysfs.c:271 __cached_dev_store() error: uninitialized symbol 'v'.
@ 2018-08-10 8:19 kbuild test robot
2018-08-10 9:56 ` Coly Li
0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2018-08-10 8:19 UTC (permalink / raw)
To: kbuild, Kent Overstreet, Coly Li; +Cc: Dan Carpenter, linux-fsdevel, kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git for-next
head: 2b04674443471465b4bdc0e52b2355bb5e128078
commit: 9c26e5fd96446919cc77c14a09ba9b6cf2320ab5 [9/27] bcache: set max writeback rate when I/O request is idle
smatch warnings:
drivers/md/bcache/sysfs.c:271 __cached_dev_store() error: uninitialized symbol 'v'.
# https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git/commit/?id=9c26e5fd96446919cc77c14a09ba9b6cf2320ab5
git remote add bcache https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git
git remote update bcache
git checkout 9c26e5fd96446919cc77c14a09ba9b6cf2320ab5
vim +/v +271 drivers/md/bcache/sysfs.c
cafe5635 Kent Overstreet 2013-03-23 257
cafe5635 Kent Overstreet 2013-03-23 258 sysfs_strtoul(data_csum, dc->disk.data_csum);
cafe5635 Kent Overstreet 2013-03-23 259 d_strtoul(verify);
5ceaaad7 Kent Overstreet 2013-09-10 260 d_strtoul(bypass_torture_test);
cafe5635 Kent Overstreet 2013-03-23 261 d_strtoul(writeback_metadata);
cafe5635 Kent Overstreet 2013-03-23 262 d_strtoul(writeback_running);
cafe5635 Kent Overstreet 2013-03-23 263 d_strtoul(writeback_delay);
16749c23 Kent Overstreet 2013-11-11 264
cafe5635 Kent Overstreet 2013-03-23 265 sysfs_strtoul_clamp(writeback_percent, dc->writeback_percent, 0, 40);
cafe5635 Kent Overstreet 2013-03-23 266
9c26e5fd Coly Li 2018-07-26 267 if (attr == &sysfs_writeback_rate) {
9c26e5fd Coly Li 2018-07-26 268 int v;
9c26e5fd Coly Li 2018-07-26 269
9c26e5fd Coly Li 2018-07-26 270 sysfs_strtoul_clamp(writeback_rate, v, 1, INT_MAX);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9c26e5fd Coly Li 2018-07-26 @271 atomic_long_set(&dc->writeback_rate.rate, v);
^
This code is impossible to reach, so Smatch isn't supposed to generate
a warning... It doesn't warn when I build it on my system... Sometimes
Smatch takes short cuts if the system is overloaded so that might be the
reason for this warning.
Anyway, sysfs_strtoul_clamp() returns if "attr == &sysfs_writeback_rate".
9c26e5fd Coly Li 2018-07-26 272 }
16749c23 Kent Overstreet 2013-11-11 273
7a5e3ecb Coly Li 2018-02-07 274 sysfs_strtoul_clamp(writeback_rate_update_seconds,
7a5e3ecb Coly Li 2018-02-07 275 dc->writeback_rate_update_seconds,
7a5e3ecb Coly Li 2018-02-07 276 1, WRITEBACK_RATE_UPDATE_SECS_MAX);
1d316e65 Michael Lyle 2017-10-13 277 d_strtoul(writeback_rate_i_term_inverse);
16749c23 Kent Overstreet 2013-11-11 278 d_strtoul_nonzero(writeback_rate_p_term_inverse);
cafe5635 Kent Overstreet 2013-03-23 279
c7b7bd07 Coly Li 2018-03-18 280 sysfs_strtoul_clamp(io_error_limit, dc->error_limit, 0, INT_MAX);
c7b7bd07 Coly Li 2018-03-18 281
c7b7bd07 Coly Li 2018-03-18 282 if (attr == &sysfs_io_disable) {
c7b7bd07 Coly Li 2018-03-18 283 int v = strtoul_or_return(buf);
c7b7bd07 Coly Li 2018-03-18 284
c7b7bd07 Coly Li 2018-03-18 285 dc->io_disable = v ? 1 : 0;
c7b7bd07 Coly Li 2018-03-18 286 }
c7b7bd07 Coly Li 2018-03-18 287
cafe5635 Kent Overstreet 2013-03-23 288 d_strtoi_h(sequential_cutoff);
cafe5635 Kent Overstreet 2013-03-23 289 d_strtoi_h(readahead);
cafe5635 Kent Overstreet 2013-03-23 290
cafe5635 Kent Overstreet 2013-03-23 291 if (attr == &sysfs_clear_stats)
cafe5635 Kent Overstreet 2013-03-23 292 bch_cache_accounting_clear(&dc->accounting);
cafe5635 Kent Overstreet 2013-03-23 293
cafe5635 Kent Overstreet 2013-03-23 294 if (attr == &sysfs_running &&
cafe5635 Kent Overstreet 2013-03-23 295 strtoul_or_return(buf))
cafe5635 Kent Overstreet 2013-03-23 296 bch_cached_dev_run(dc);
cafe5635 Kent Overstreet 2013-03-23 297
cafe5635 Kent Overstreet 2013-03-23 298 if (attr == &sysfs_cache_mode) {
ce4c3e19 Andy Shevchenko 2018-05-28 299 v = __sysfs_match_string(bch_cache_modes, -1, buf);
cafe5635 Kent Overstreet 2013-03-23 300 if (v < 0)
cafe5635 Kent Overstreet 2013-03-23 301 return v;
cafe5635 Kent Overstreet 2013-03-23 302
cafe5635 Kent Overstreet 2013-03-23 303 if ((unsigned) v != BDEV_CACHE_MODE(&dc->sb)) {
cafe5635 Kent Overstreet 2013-03-23 304 SET_BDEV_CACHE_MODE(&dc->sb, v);
cafe5635 Kent Overstreet 2013-03-23 305 bch_write_bdev_super(dc, NULL);
cafe5635 Kent Overstreet 2013-03-23 306 }
cafe5635 Kent Overstreet 2013-03-23 307 }
cafe5635 Kent Overstreet 2013-03-23 308
7e027ca4 Coly Li 2018-03-18 309 if (attr == &sysfs_stop_when_cache_set_failed) {
ce4c3e19 Andy Shevchenko 2018-05-28 310 v = __sysfs_match_string(bch_stop_on_failure_modes, -1, buf);
7e027ca4 Coly Li 2018-03-18 311 if (v < 0)
7e027ca4 Coly Li 2018-03-18 312 return v;
7e027ca4 Coly Li 2018-03-18 313
7e027ca4 Coly Li 2018-03-18 314 dc->stop_when_cache_set_failed = v;
7e027ca4 Coly Li 2018-03-18 315 }
7e027ca4 Coly Li 2018-03-18 316
cafe5635 Kent Overstreet 2013-03-23 317 if (attr == &sysfs_label) {
aee6f1cf Gabriel de Perthuis 2013-09-23 318 if (size > SB_LABEL_SIZE)
aee6f1cf Gabriel de Perthuis 2013-09-23 319 return -EINVAL;
aee6f1cf Gabriel de Perthuis 2013-09-23 320 memcpy(dc->sb.label, buf, size);
aee6f1cf Gabriel de Perthuis 2013-09-23 321 if (size < SB_LABEL_SIZE)
aee6f1cf Gabriel de Perthuis 2013-09-23 322 dc->sb.label[size] = '\0';
aee6f1cf Gabriel de Perthuis 2013-09-23 323 if (size && dc->sb.label[size - 1] == '\n')
aee6f1cf Gabriel de Perthuis 2013-09-23 324 dc->sb.label[size - 1] = '\0';
cafe5635 Kent Overstreet 2013-03-23 325 bch_write_bdev_super(dc, NULL);
cafe5635 Kent Overstreet 2013-03-23 326 if (dc->disk.c) {
cafe5635 Kent Overstreet 2013-03-23 327 memcpy(dc->disk.c->uuids[dc->disk.id].label,
cafe5635 Kent Overstreet 2013-03-23 328 buf, SB_LABEL_SIZE);
cafe5635 Kent Overstreet 2013-03-23 329 bch_uuid_write(dc->disk.c);
cafe5635 Kent Overstreet 2013-03-23 330 }
ab9e1400 Gabriel de Perthuis 2013-06-09 331 env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL);
d2a65ce2 Dan Carpenter 2013-07-05 332 if (!env)
d2a65ce2 Dan Carpenter 2013-07-05 333 return -ENOMEM;
ab9e1400 Gabriel de Perthuis 2013-06-09 334 add_uevent_var(env, "DRIVER=bcache");
ab9e1400 Gabriel de Perthuis 2013-06-09 335 add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid),
ab9e1400 Gabriel de Perthuis 2013-06-09 336 add_uevent_var(env, "CACHED_LABEL=%s", buf);
ab9e1400 Gabriel de Perthuis 2013-06-09 337 kobject_uevent_env(
ab9e1400 Gabriel de Perthuis 2013-06-09 338 &disk_to_dev(dc->disk.disk)->kobj, KOBJ_CHANGE, env->envp);
ab9e1400 Gabriel de Perthuis 2013-06-09 339 kfree(env);
cafe5635 Kent Overstreet 2013-03-23 340 }
cafe5635 Kent Overstreet 2013-03-23 341
cafe5635 Kent Overstreet 2013-03-23 342 if (attr == &sysfs_attach) {
73ac105b Tang Junhui 2018-02-07 343 uint8_t set_uuid[16];
73ac105b Tang Junhui 2018-02-07 344
73ac105b Tang Junhui 2018-02-07 345 if (bch_parse_uuid(buf, set_uuid) < 16)
cafe5635 Kent Overstreet 2013-03-23 346 return -EINVAL;
cafe5635 Kent Overstreet 2013-03-23 347
7f4fc93d Tang Junhui 2018-02-07 348 v = -ENOENT;
cafe5635 Kent Overstreet 2013-03-23 349 list_for_each_entry(c, &bch_cache_sets, list) {
73ac105b Tang Junhui 2018-02-07 350 v = bch_cached_dev_attach(dc, c, set_uuid);
cafe5635 Kent Overstreet 2013-03-23 351 if (!v)
cafe5635 Kent Overstreet 2013-03-23 352 return size;
cafe5635 Kent Overstreet 2013-03-23 353 }
cafe5635 Kent Overstreet 2013-03-23 354
cafe5635 Kent Overstreet 2013-03-23 355 pr_err("Can't attach %s: cache set not found", buf);
7f4fc93d Tang Junhui 2018-02-07 356 return v;
cafe5635 Kent Overstreet 2013-03-23 357 }
cafe5635 Kent Overstreet 2013-03-23 358
cafe5635 Kent Overstreet 2013-03-23 359 if (attr == &sysfs_detach && dc->disk.c)
cafe5635 Kent Overstreet 2013-03-23 360 bch_cached_dev_detach(dc);
cafe5635 Kent Overstreet 2013-03-23 361
cafe5635 Kent Overstreet 2013-03-23 362 if (attr == &sysfs_stop)
cafe5635 Kent Overstreet 2013-03-23 363 bcache_device_stop(&dc->disk);
cafe5635 Kent Overstreet 2013-03-23 364
cafe5635 Kent Overstreet 2013-03-23 365 return size;
cafe5635 Kent Overstreet 2013-03-23 366 }
cafe5635 Kent Overstreet 2013-03-23 367
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bcache:for-next 9/27] drivers/md/bcache/sysfs.c:271 __cached_dev_store() error: uninitialized symbol 'v'.
2018-08-10 8:19 [bcache:for-next 9/27] drivers/md/bcache/sysfs.c:271 __cached_dev_store() error: uninitialized symbol 'v' kbuild test robot
@ 2018-08-10 9:56 ` Coly Li
0 siblings, 0 replies; 2+ messages in thread
From: Coly Li @ 2018-08-10 9:56 UTC (permalink / raw)
To: kbuild test robot, kbuild, Kent Overstreet
Cc: Dan Carpenter, linux-fsdevel, kbuild-all
On 2018/8/10 4:19 PM, kbuild test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git for-next
> head: 2b04674443471465b4bdc0e52b2355bb5e128078
> commit: 9c26e5fd96446919cc77c14a09ba9b6cf2320ab5 [9/27] bcache: set max writeback rate when I/O request is idle
>
> smatch warnings:
> drivers/md/bcache/sysfs.c:271 __cached_dev_store() error: uninitialized symbol 'v'.
>
> # https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git/commit/?id=9c26e5fd96446919cc77c14a09ba9b6cf2320ab5
> git remote add bcache https://git.kernel.org/pub/scm/linux/kernel/git/colyli/linux-bcache.git
> git remote update bcache
> git checkout 9c26e5fd96446919cc77c14a09ba9b6cf2320ab5
> vim +/v +271 drivers/md/bcache/sysfs.c
>
Oh, here is a bug, thanks for pointing out this. Very helpful!
Coly Li
> cafe5635 Kent Overstreet 2013-03-23 257
> cafe5635 Kent Overstreet 2013-03-23 258 sysfs_strtoul(data_csum, dc->disk.data_csum);
> cafe5635 Kent Overstreet 2013-03-23 259 d_strtoul(verify);
> 5ceaaad7 Kent Overstreet 2013-09-10 260 d_strtoul(bypass_torture_test);
> cafe5635 Kent Overstreet 2013-03-23 261 d_strtoul(writeback_metadata);
> cafe5635 Kent Overstreet 2013-03-23 262 d_strtoul(writeback_running);
> cafe5635 Kent Overstreet 2013-03-23 263 d_strtoul(writeback_delay);
> 16749c23 Kent Overstreet 2013-11-11 264
> cafe5635 Kent Overstreet 2013-03-23 265 sysfs_strtoul_clamp(writeback_percent, dc->writeback_percent, 0, 40);
> cafe5635 Kent Overstreet 2013-03-23 266
> 9c26e5fd Coly Li 2018-07-26 267 if (attr == &sysfs_writeback_rate) {
> 9c26e5fd Coly Li 2018-07-26 268 int v;
> 9c26e5fd Coly Li 2018-07-26 269
> 9c26e5fd Coly Li 2018-07-26 270 sysfs_strtoul_clamp(writeback_rate, v, 1, INT_MAX);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 9c26e5fd Coly Li 2018-07-26 @271 atomic_long_set(&dc->writeback_rate.rate, v);
> ^
> This code is impossible to reach, so Smatch isn't supposed to generate
> a warning... It doesn't warn when I build it on my system... Sometimes
> Smatch takes short cuts if the system is overloaded so that might be the
> reason for this warning.
>
> Anyway, sysfs_strtoul_clamp() returns if "attr == &sysfs_writeback_rate".
>
[snipped]
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-10 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10 8:19 [bcache:for-next 9/27] drivers/md/bcache/sysfs.c:271 __cached_dev_store() error: uninitialized symbol 'v' kbuild test robot
2018-08-10 9:56 ` Coly Li
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).