mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:08:12 +00:00
Kernel: Make syscalls that take a buffer size use ssize_t instead of size_t.
Dealing with the unsigned overflow propagation here just seems unreasonably error prone. Let's limit ourselves to 2GB buffer sizes instead.
This commit is contained in:
parent
5af4e622b9
commit
beda478821
40 changed files with 144 additions and 136 deletions
|
@ -18,16 +18,16 @@ bool FullDevice::can_read(Process&) const
|
|||
return true;
|
||||
}
|
||||
|
||||
ssize_t FullDevice::read(Process&, byte* buffer, size_t bufferSize)
|
||||
ssize_t FullDevice::read(Process&, byte* buffer, ssize_t size)
|
||||
{
|
||||
size_t count = min(GoodBufferSize, bufferSize);
|
||||
memset(buffer, 0, count);
|
||||
ssize_t count = min(GoodBufferSize, size);
|
||||
memset(buffer, 0, (size_t)count);
|
||||
return count;
|
||||
}
|
||||
|
||||
ssize_t FullDevice::write(Process&, const byte*, size_t bufferSize)
|
||||
ssize_t FullDevice::write(Process&, const byte*, ssize_t size)
|
||||
{
|
||||
if (bufferSize == 0)
|
||||
if (size == 0)
|
||||
return 0;
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue