xfs: fix SMAP violation during file read
Change-Id: I5106cfeef8e13462ce7402dbe6255f270176d1be Reviewed-on: https://review.haiku-os.org/c/haiku/+/10332 Tested-by: Commit checker robot <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
31c71e72a0
commit
53a3cd8bd5
@@ -608,7 +608,7 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* length)
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
if (pos >= Size() || length == 0) {
|
||||
if (pos >= Size() || *length == 0) {
|
||||
TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF
|
||||
", length %" B_PRIuSIZE ")\n", ID(), pos, *length);
|
||||
*length = 0;
|
||||
@@ -671,9 +671,9 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* length)
|
||||
return B_IO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
memcpy((void*) (buffer + lengthRead),
|
||||
(void*)(block + offsetIntoBlock), lengthToRead);
|
||||
if (user_memcpy((void*)(buffer + lengthRead),
|
||||
(void*)(block + offsetIntoBlock), lengthToRead) < B_OK)
|
||||
return B_BAD_ADDRESS;
|
||||
|
||||
pos += lengthToRead;
|
||||
*length -= lengthToRead;
|
||||
|
||||
Reference in New Issue
Block a user