Merge tag 'xfs-4.13-merge-6' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / fs / iomap.c
index 173222863aca914f7992572d90723c173b6fbf93..039266128b7ff0b09ed2a55e621a9a0dc9e38720 100644 (file)
@@ -610,8 +610,8 @@ iomap_seek_hole(struct inode *inode, loff_t offset, const struct iomap_ops *ops)
        loff_t length = size - offset;
        loff_t ret;
 
-       /* Nothing to be found beyond the end of the file. */
-       if (offset >= size)
+       /* Nothing to be found before or beyond the end of the file. */
+       if (offset < 0 || offset >= size)
                return -ENXIO;
 
        while (length > 0) {
@@ -656,8 +656,8 @@ iomap_seek_data(struct inode *inode, loff_t offset, const struct iomap_ops *ops)
        loff_t length = size - offset;
        loff_t ret;
 
-       /* Nothing to be found beyond the end of the file. */
-       if (offset >= size)
+       /* Nothing to be found before or beyond the end of the file. */
+       if (offset < 0 || offset >= size)
                return -ENXIO;
 
        while (length > 0) {