Coly Li 46451874c7 bcache: fix error setting writeback_rate through sysfs interface
Commit ea8c5356d390 ("bcache: set max writeback rate when I/O request
is idle") changes struct bch_ratelimit member rate from uint32_t to
atomic_long_t and uses atomic_long_set() in drivers/md/bcache/sysfs.c
to set new writeback rate, after the input is converted from memory
buf to long int by sysfs_strtoul_clamp().

The above change has a problem because there is an implicit return
inside sysfs_strtoul_clamp() so the following atomic_long_set()
won't be called. This error is detected by 0day system with following
snipped smatch warnings:

drivers/md/bcache/sysfs.c:271 __cached_dev_store() error: uninitialized
symbol 'v'.
270  sysfs_strtoul_clamp(writeback_rate, v, 1, INT_MAX);
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@271 atomic_long_set(&dc->writeback_rate.rate, v);

This patch fixes the above error by using strtoul_safe_clamp() to
convert the input buffer into a long int type result.

Fixes: ea8c5356d390 ("bcache: set max writeback rate when I/O request is idle")
Cc: Kai Krakow <kai@kaishome.de>
Cc: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-08-10 12:18:47 -06:00
..
2018-06-12 16:19:22 -07:00
2018-08-05 19:32:09 -06:00
2018-06-30 21:24:18 +09:00
2018-06-04 10:58:12 -07:00
2018-06-27 11:01:29 -07:00
2018-06-07 10:23:33 -07:00
2018-06-12 16:19:22 -07:00
2018-06-12 16:19:22 -07:00
2018-06-12 16:19:22 -07:00
2018-06-12 16:19:22 -07:00
2018-06-16 16:40:36 -07:00
2018-06-11 12:09:19 -07:00
2018-08-02 15:22:37 -06:00
2018-08-05 19:32:09 -06:00
2018-06-12 16:19:22 -07:00
2018-06-07 10:23:33 -07:00
2018-06-25 21:36:45 +08:00
2018-08-05 19:32:09 -06:00
2018-06-04 10:58:12 -07:00
2018-06-15 18:10:01 -03:00
2018-07-19 11:54:04 -07:00
2018-06-12 16:19:22 -07:00
2018-06-07 12:34:37 -07:00
2018-06-12 16:19:22 -07:00
2018-07-18 15:25:25 -07:00
2018-06-14 16:25:43 +09:00
2018-07-13 10:37:54 +02:00
2018-08-05 19:32:09 -06:00
2018-06-12 16:19:22 -07:00
2018-06-12 16:19:22 -07:00
2018-07-19 15:09:59 -07:00
2018-08-07 07:57:32 -06:00
2018-07-21 16:46:53 -07:00
2018-06-12 16:19:22 -07:00
2018-06-16 06:35:02 +09:00
2018-06-05 16:20:22 -07:00
2018-06-12 12:56:02 -07:00
2018-06-23 20:44:11 +08:00