tracing: Fix crash from reading trace_pipe with sendfile
[firefly-linux-kernel-4.4.55.git] / kernel / trace / trace.c
index d9293402ee685ae59007fe1ade71866e121a0882..8305cbb2d5a2939637aa180a5a722bc22a9fd47f 100644 (file)
@@ -4949,7 +4949,10 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
 
        spd.nr_pages = i;
 
-       ret = splice_to_pipe(pipe, &spd);
+       if (i)
+               ret = splice_to_pipe(pipe, &spd);
+       else
+               ret = 0;
 out:
        splice_shrink_spd(&spd);
        return ret;