diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bcache/sysfs.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 467105614324..17bae9c14ca0 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c | |||
@@ -804,8 +804,17 @@ STORE(__bch_cache_set) | |||
804 | sysfs_strtoul_clamp(io_error_limit, c->error_limit, 0, UINT_MAX); | 804 | sysfs_strtoul_clamp(io_error_limit, c->error_limit, 0, UINT_MAX); |
805 | 805 | ||
806 | /* See count_io_errors() for why 88 */ | 806 | /* See count_io_errors() for why 88 */ |
807 | if (attr == &sysfs_io_error_halflife) | 807 | if (attr == &sysfs_io_error_halflife) { |
808 | c->error_decay = strtoul_or_return(buf) / 88; | 808 | unsigned long v = 0; |
809 | ssize_t ret; | ||
810 | |||
811 | ret = strtoul_safe_clamp(buf, v, 0, UINT_MAX); | ||
812 | if (!ret) { | ||
813 | c->error_decay = v / 88; | ||
814 | return size; | ||
815 | } | ||
816 | return ret; | ||
817 | } | ||
809 | 818 | ||
810 | if (attr == &sysfs_io_disable) { | 819 | if (attr == &sysfs_io_disable) { |
811 | v = strtoul_or_return(buf); | 820 | v = strtoul_or_return(buf); |