Kernel: Address validation helpers should take size_t, not ssize_t

This commit is contained in:
Andreas Kling 2020-01-29 18:31:15 +01:00
parent 164d9ecad7
commit c9e877a294
Notes: sideshowbarker 2024-07-19 09:44:59 +09:00
2 changed files with 6 additions and 6 deletions

View File

@ -2334,21 +2334,21 @@ pid_t Process::sys$waitpid(pid_t waitee, int* wstatus, int options)
return waitee_pid; return waitee_pid;
} }
bool Process::validate_read_from_kernel(VirtualAddress vaddr, ssize_t size) const bool Process::validate_read_from_kernel(VirtualAddress vaddr, size_t size) const
{ {
if (vaddr.is_null()) if (vaddr.is_null())
return false; return false;
return MM.validate_kernel_read(*this, vaddr, size); return MM.validate_kernel_read(*this, vaddr, size);
} }
bool Process::validate_read(const void* address, ssize_t size) const bool Process::validate_read(const void* address, size_t size) const
{ {
if (!size) if (!size)
return false; return false;
return MM.validate_user_read(*this, VirtualAddress(address), size); return MM.validate_user_read(*this, VirtualAddress(address), size);
} }
bool Process::validate_write(void* address, ssize_t size) const bool Process::validate_write(void* address, size_t size) const
{ {
if (!size) if (!size)
return false; return false;

View File

@ -326,10 +326,10 @@ public:
u32 m_ticks_in_user_for_dead_children { 0 }; u32 m_ticks_in_user_for_dead_children { 0 };
u32 m_ticks_in_kernel_for_dead_children { 0 }; u32 m_ticks_in_kernel_for_dead_children { 0 };
bool validate_read_from_kernel(VirtualAddress, ssize_t) const; bool validate_read_from_kernel(VirtualAddress, size_t) const;
bool validate_read(const void*, ssize_t) const; bool validate_read(const void*, size_t) const;
bool validate_write(void*, ssize_t) const; bool validate_write(void*, size_t) const;
template<typename T> template<typename T>
bool validate_read_typed(T* value, size_t count = 1) { return validate_read(value, sizeof(T) * count); } bool validate_read_typed(T* value, size_t count = 1) { return validate_read(value, sizeof(T) * count); }
template<typename T> template<typename T>