diff options
author | Tony Asleson <tasleson@redhat.com> | 2017-09-06 14:25:57 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-09-27 10:57:21 +0200 |
commit | c04dc907e590c85d84f252c1de390da1cfd5e3dc (patch) | |
tree | d3874d71561dfa482c0cb100a11d9ed5e4c94f3f /drivers/md | |
parent | 0b312f81db414f2ec82034c317bd2dae58c03fb1 (diff) | |
download | linux-stable-c04dc907e590c85d84f252c1de390da1cfd5e3dc.tar.gz linux-stable-c04dc907e590c85d84f252c1de390da1cfd5e3dc.tar.bz2 linux-stable-c04dc907e590c85d84f252c1de390da1cfd5e3dc.zip |
bcache: Correct return value for sysfs attach errors
commit 77fa100f27475d08a569b9d51c17722130f089e7 upstream.
If you encounter any errors in bch_cached_dev_attach it will return
a negative error code. The variable 'v' which stores the result is
unsigned, thus user space sees a very large value returned for bytes
written which can cause incorrect user space behavior. Utilize 1
signed variable to use throughout the function to preserve error return
capability.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bcache/sysfs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index b3ff57d61dde..4fbb5532f24c 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -191,7 +191,7 @@ STORE(__cached_dev) { struct cached_dev *dc = container_of(kobj, struct cached_dev, disk.kobj); - unsigned v = size; + ssize_t v = size; struct cache_set *c; struct kobj_uevent_env *env; @@ -226,7 +226,7 @@ STORE(__cached_dev) bch_cached_dev_run(dc); if (attr == &sysfs_cache_mode) { - ssize_t v = bch_read_string_list(buf, bch_cache_modes + 1); + v = bch_read_string_list(buf, bch_cache_modes + 1); if (v < 0) return v; |