[PATCH] generic_file_buffered_write(): handle zero-length iovec segments
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / mm / filemap.h
index 536979fb4ba717443be39b9e0e8a95dfd012200c..3f2a343c6015f2b4b9564307bb557a0dbdddb8f5 100644 (file)
@@ -88,7 +88,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
        const struct iovec *iov = *iovp;
        size_t base = *basep;
 
-       while (bytes) {
+       do {
                int copy = min(bytes, iov->iov_len - base);
 
                bytes -= copy;
@@ -97,7 +97,7 @@ filemap_set_next_iovec(const struct iovec **iovp, size_t *basep, size_t bytes)
                        iov++;
                        base = 0;
                }
-       }
+       } while (bytes);
        *iovp = iov;
        *basep = base;
 }