bcache: Correct return value for sysfs attach errors
authorTony Asleson <tasleson@redhat.com>
Wed, 6 Sep 2017 06:25:57 +0000 (14:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Sep 2017 12:39:25 +0000 (14:39 +0200)
commitfa92ff6b77a1ac597c2c8bb973c8a9c0191c108a
tree84319afb161726e91da469c4bcdb19e2cde945e2
parente40cb30162d7f9e9ea8aae9dd1b93e1ff30c1bcd
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>
drivers/md/bcache/sysfs.c