From: Kefu Chai Date: Wed, 1 Jul 2015 08:43:16 +0000 (+0800) Subject: client: return EINVAL if iovcnt < 0 for p{read,write}v() X-Git-Tag: v9.0.3~103^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F5112%2Fhead;p=ceph.git client: return EINVAL if iovcnt < 0 for p{read,write}v() Signed-off-by: Kefu Chai --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 28fefb610c8..4e70756d4c0 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7131,6 +7131,8 @@ int Client::read(int fd, char *buf, loff_t size, loff_t offset) int Client::preadv(int fd, const struct iovec *iov, int iovcnt, loff_t offset) { + if (iovcnt < 0) + return EINVAL; return _preadv_pwritev(fd, iov, iovcnt, offset, false); } @@ -7458,6 +7460,8 @@ int Client::write(int fd, const char *buf, loff_t size, loff_t offset) int Client::pwritev(int fd, const struct iovec *iov, int iovcnt, int64_t offset) { + if (iovcnt < 0) + return EINVAL; return _preadv_pwritev(fd, iov, iovcnt, offset, true); }