@@ -53,6 +53,9 @@ int io_tee(struct io_kiocb *req, unsigned int issue_flags)
struct file *in;
long ret = 0;
+ if (unlikely(!sp->len))
+ goto done;
+
if (issue_flags & IO_URING_F_NONBLOCK)
return -EAGAIN;
@@ -65,8 +68,7 @@ int io_tee(struct io_kiocb *req, unsigned int issue_flags)
goto done;
}
- if (sp->len)
- ret = do_tee(in, out, sp->len, flags);
+ ret = do_tee(in, out, sp->len, flags);
if (!(sp->flags & SPLICE_F_FD_IN_FIXED))
io_put_file(in);
@@ -95,6 +97,9 @@ int io_splice(struct io_kiocb *req, unsigned int issue_flags)
struct file *in;
long ret = 0;
+ if (unlikely(!sp->len))
+ goto done;
+
if (issue_flags & IO_URING_F_NONBLOCK)
return -EAGAIN;
@@ -110,8 +115,7 @@ int io_splice(struct io_kiocb *req, unsigned int issue_flags)
poff_in = (sp->off_in == -1) ? NULL : &sp->off_in;
poff_out = (sp->off_out == -1) ? NULL : &sp->off_out;
- if (sp->len)
- ret = do_splice(in, poff_in, out, poff_out, sp->len, flags);
+ ret = do_splice(in, poff_in, out, poff_out, sp->len, flags);
if (!(sp->flags & SPLICE_F_FD_IN_FIXED))
io_put_file(in);