fix file mmap (#8865)

This commit is contained in:
xiao-mang 2024-04-28 15:21:02 +08:00 committed by GitHub
parent fa1c473a96
commit c359e93a9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -184,7 +184,7 @@ void page_read(struct rt_varea *varea, struct rt_aspace_io_msg *msg)
varea->start, varea->size, varea->offset, varea->attr, varea->flag);
ret = dfs_aspace_mmap_read(file, varea, msg);
if (ret > 0)
if (ret >= 0)
{
msg->response.status = MM_FAULT_STATUS_OK;
if (ret < ARCH_PAGE_SIZE)

View File

@ -1105,7 +1105,7 @@ int dfs_aspace_read(struct dfs_file *file, void *buf, size_t count, off_t *pos)
}
len = count > len ? len : count;
if (len)
if (len > 0)
{
rt_memcpy(ptr, page->page + *pos - page->fpos, len);
ptr += len;