[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240108014536.43971-1-yang.lee@linux.alibaba.com>
Date: Mon, 8 Jan 2024 09:45:36 +0800
From: Yang Li <yang.lee@...ux.alibaba.com>
To: dhowells@...hat.com
Cc: linux-cachefs@...hat.com,
linux-kernel@...r.kernel.org,
Yang Li <yang.lee@...ux.alibaba.com>
Subject: [PATCH -next] 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 <yang.lee@...ux.alibaba.com>
---
fs/cachefiles/io.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c
index bb19b8bcf2e8..3da2b2e261da 100644
--- a/fs/cachefiles/io.c
+++ b/fs/cachefiles/io.c
@@ -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 */
--
2.20.1.7.g153144c
Powered by blists - more mailing lists