ramfs: fix off-by-one error
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
36d90bc0f6
commit
ab15b88cd6
1 changed files with 2 additions and 2 deletions
|
|
@ -98,8 +98,8 @@ static ssize_t read(inode_t *inode, char *buf, size_t size, size_t offset)
|
|||
if (offset >= inode->file_size)
|
||||
return -EINVAL;
|
||||
|
||||
if (size + offset >= inode->file_size)
|
||||
size = inode->file_size - offset - 1;
|
||||
if (size + offset > inode->file_size)
|
||||
size = inode->file_size - offset;
|
||||
|
||||
memcpy(buf, inode->data + offset, size);
|
||||
ret = size;
|
||||
|
|
|
|||
Loading…
Reference in a new issue