Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

splice: simplify a conditional in copy_splice_read

Check for -EFAULT instead of wrapping the check in an ret < 0 block.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20230614140341.521331-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
2e82f6c3 0b24be46

+7 -7
+7 -7
fs/splice.c
··· 368 368 if (ret > 0) { 369 369 keep = DIV_ROUND_UP(ret, PAGE_SIZE); 370 370 *ppos = kiocb.ki_pos; 371 - } else if (ret < 0) { 372 - /* 373 - * callers of ->splice_read() expect -EAGAIN on 374 - * "can't put anything in there", rather than -EFAULT. 375 - */ 376 - if (ret == -EFAULT) 377 - ret = -EAGAIN; 378 371 } 372 + 373 + /* 374 + * Callers of ->splice_read() expect -EAGAIN on "can't put anything in 375 + * there", rather than -EFAULT. 376 + */ 377 + if (ret == -EFAULT) 378 + ret = -EAGAIN; 379 379 380 380 /* Free any pages that didn't get touched at all. */ 381 381 if (keep < npages)