mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +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
|
@ -17,15 +17,15 @@ bool ZeroDevice::can_read(Process&) const
|
|||
return true;
|
||||
}
|
||||
|
||||
ssize_t ZeroDevice::read(Process&, byte* buffer, size_t bufferSize)
|
||||
ssize_t ZeroDevice::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 ZeroDevice::write(Process&, const byte*, size_t bufferSize)
|
||||
ssize_t ZeroDevice::write(Process&, const byte*, ssize_t size)
|
||||
{
|
||||
return min(GoodBufferSize, bufferSize);
|
||||
return min(GoodBufferSize, size);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue