fs: fix misleading comments in read_write.c

generic_write_checks() returns the number of bytes that may be written
(possibly truncated by generic_write_check_limits()), not zero.  The
comment was likely copied from generic_copy_file_checks(), which is the
analogous function for copy_file_range() and does return 0 on success.

Also, no_seek_end_llseek() and no_seek_end_llseek_size() are helpers for
files that do not support SEEK_END (they only handle SEEK_SET and
SEEK_CUR), not for "fixed-sized devices"; that description was copied
from fixed_size_llseek().

Signed-off-by: Yingchao Deng <dengyingchao@kylinsec.com.cn>
Link: https://patch.msgid.link/918177B3298981ED+20260914075337.1739-1-dengyingchao@kylinsec.com.cn
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
Yingchao Deng 2026-09-14 15:53:37 +08:00 committed by Christian Brauner
parent bfe240aab4
commit 6ffe91a84f
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -274,7 +274,7 @@ loff_t fixed_size_llseek(struct file *file, loff_t offset, int whence, loff_t si
EXPORT_SYMBOL(fixed_size_llseek);
/**
* no_seek_end_llseek - llseek implementation for fixed-sized devices
* no_seek_end_llseek - llseek implementation for files without SEEK_END
* @file: file structure to seek on
* @offset: file offset to seek to
* @whence: type of seek
@ -293,7 +293,7 @@ loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence)
EXPORT_SYMBOL(no_seek_end_llseek);
/**
* no_seek_end_llseek_size - llseek implementation for fixed-sized devices
* no_seek_end_llseek_size - llseek implementation for files without SEEK_END
* @file: file structure to seek on
* @offset: file offset to seek to
* @whence: type of seek
@ -1761,8 +1761,8 @@ EXPORT_SYMBOL(generic_write_checks_count);
* Performs necessary checks before doing a write
*
* Can adjust writing position or amount of bytes to write.
* Returns appropriate error code that caller should return or
* zero in case that write should be allowed.
* Returns the number of bytes that may be written on success (which
* may be less than requested if truncated), or a negative error code.
*/
ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from)
{