summaryrefslogtreecommitdiff
path: root/include/linux/uio.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-07-10 14:40:49 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2017-07-10 14:40:49 +0300
commitc43aeb198048f64abda8655fdcdebe71cf1877ba (patch)
treec5bfb5b0027c5d27766b0d29f120a56e04313198 /include/linux/uio.h
parentf263fbb8d60824993c1b64385056a3cfdbb21d45 (diff)
downloadlinux-c43aeb198048f64abda8655fdcdebe71cf1877ba.tar.xz
fix brown paperbag bug in inlined copy_..._iter()
"copied nothing" == "return 0", not "return full size". Fixes: aa28de275a24 "iov_iter/hardening: move object size checks to inlined part" Spotted-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/uio.h')
-rw-r--r--include/linux/uio.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 342d2dc225b9..8a642cda641c 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -103,7 +103,7 @@ static __always_inline __must_check
size_t copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i)
{
if (unlikely(!check_copy_size(addr, bytes, true)))
- return bytes;
+ return 0;
else
return _copy_to_iter(addr, bytes, i);
}
@@ -112,7 +112,7 @@ static __always_inline __must_check
size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i)
{
if (unlikely(!check_copy_size(addr, bytes, false)))
- return bytes;
+ return 0;
else
return _copy_from_iter(addr, bytes, i);
}
@@ -130,7 +130,7 @@ static __always_inline __must_check
size_t copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i)
{
if (unlikely(!check_copy_size(addr, bytes, false)))
- return bytes;
+ return 0;
else
return _copy_from_iter_nocache(addr, bytes, i);
}
@@ -160,7 +160,7 @@ static __always_inline __must_check
size_t copy_from_iter_flushcache(void *addr, size_t bytes, struct iov_iter *i)
{
if (unlikely(!check_copy_size(addr, bytes, false)))
- return bytes;
+ return 0;
else
return _copy_from_iter_flushcache(addr, bytes, i);
}