summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhuzhuzhu <[email protected]>2024-07-17 09:08:10 +0800
committerGitHub <[email protected]>2024-07-17 09:08:10 +0800
commit4ad194bb47101345ce3b3fa631ab2215a0c190c0 (patch)
tree14ecd88eda79b9bf862f5537ab46dfd5a926a5a4
parent1d78d11567bc2187d10ca94e63c39cc95ff1195d (diff)
[fix] fix cromfs read out of mem range (#9197)
Update dfs_cromfs.c
-rw-r--r--components/dfs/dfs_v2/filesystems/cromfs/dfs_cromfs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/components/dfs/dfs_v2/filesystems/cromfs/dfs_cromfs.c b/components/dfs/dfs_v2/filesystems/cromfs/dfs_cromfs.c
index 0d82914df4..ae67887a4d 100644
--- a/components/dfs/dfs_v2/filesystems/cromfs/dfs_cromfs.c
+++ b/components/dfs/dfs_v2/filesystems/cromfs/dfs_cromfs.c
@@ -786,18 +786,18 @@ static ssize_t dfs_cromfs_read(struct dfs_file *file, void *buf, size_t count, o
rt_err_t result = RT_EOK;
file_info *fi = NULL;
cromfs_info *ci = NULL;
- uint32_t length = 0;
+ ssize_t length = 0;
ci = (cromfs_info *)file->dentry->mnt->data;
fi = (file_info *)file->vnode->data;
- if (count < file->vnode->size - *pos)
+ if ((off_t)count < (off_t)file->vnode->size - *pos)
{
length = count;
}
else
{
- length = file->vnode->size - *pos;
+ length = (off_t)file->vnode->size - *pos;
}
if (length > 0)