fs: Fix type mismatch for pos variable
PATCH 1/1 fs: Fix type mismatch for pos variable
The 'pos' variable within __cachefiles_prepare_write() and related functions is intended to store the return value from vfs_llseek(), which is of loff_t type. However, it was incorrectly declared as an unsigned long long, which is an unsigned type and cannot store negative error values returned by vfs_llseek().
This patch corrects the type of 'pos' variable to loff_t, ensuring that error codes are properly handled and facilitating proper type conversion from the cachefiles_inject_read_error function.
Signed-off-by Yang Li <[email protected]>
--- fs/cachefiles/io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cachefiles/io.c +2 -1
@@ -521,8 +521,9 @@ int __cachefiles_prepare_write(struct cachefiles_object *object, bool no_space_allocated_yet) {struct cachefiles_cache *cache = object->volume->cache; -unsigned long long start = *_start, pos; +unsigned long long start = *_start;size_t len = *_len; +loff_t pos;int ret;/* Round to DIO size */
Signature · 1 line
2.20.1.7.g153144c