]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: return EINVAL if iovcnt < 0 for p{read,write}v() 5112/head
authorKefu Chai <kchai@redhat.com>
Wed, 1 Jul 2015 08:43:16 +0000 (16:43 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 1 Jul 2015 09:13:05 +0000 (17:13 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/client/Client.cc

index 28fefb610c8626c188566723c0f928d1dec61a38..4e70756d4c062c694dd61df35345e82ede7cd404 100644 (file)
@@ -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); 
 }