[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200921143434.707844-5-hch@lst.de>
Date: Mon, 21 Sep 2020 16:34:27 +0200
From: Christoph Hellwig <hch@....de>
To: Alexander Viro <viro@...iv.linux.org.uk>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Jens Axboe <axboe@...nel.dk>, Arnd Bergmann <arnd@...db.de>,
David Howells <dhowells@...hat.com>,
David Laight <David.Laight@...lab.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-mips@...r.kernel.org, linux-parisc@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
sparclinux@...r.kernel.org, linux-block@...r.kernel.org,
linux-scsi@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-aio@...ck.org, io-uring@...r.kernel.org,
linux-arch@...r.kernel.org, linux-mm@...ck.org,
netdev@...r.kernel.org, keyrings@...r.kernel.org,
linux-security-module@...r.kernel.org
Subject: [PATCH 04/11] iov_iter: explicitly check for CHECK_IOVEC_ONLY in rw_copy_check_uvector
Explicitly check for the magic value insted of implicitly relying on
its numeric representation. Also drop the rather pointless unlikely
annotation.
Signed-off-by: Christoph Hellwig <hch@....de>
---
lib/iov_iter.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index d7e72343c360eb..a64867501a7483 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1709,8 +1709,7 @@ static ssize_t rw_copy_check_uvector(int type,
ret = -EINVAL;
goto out;
}
- if (type >= 0
- && unlikely(!access_ok(buf, len))) {
+ if (type != CHECK_IOVEC_ONLY && !access_ok(buf, len)) {
ret = -EFAULT;
goto out;
}
@@ -1824,7 +1823,7 @@ static ssize_t compat_rw_copy_check_uvector(int type,
}
if (len < 0) /* size_t not fitting in compat_ssize_t .. */
goto out;
- if (type >= 0 &&
+ if (type != CHECK_IOVEC_ONLY &&
!access_ok(compat_ptr(buf), len)) {
ret = -EFAULT;
goto out;
--
2.28.0
Powered by blists - more mailing lists