diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-05 17:38:37 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-05 17:38:37 +0200 |
commit | 48a0b31c478cb78dece459369610e0f993c8f6f0 (patch) | |
tree | f08fde80936619aa94f84edb0973878d8810d147 /Kernel/Arch | |
parent | 9903f5c6ef76dfd3c15e63205e307c9519c32ff3 (diff) | |
download | serenity-48a0b31c478cb78dece459369610e0f993c8f6f0.zip |
Kernel: Make copy_{from,to}_user() return KResult and use TRY()
This makes EFAULT propagation flow much more naturally. :^)
Diffstat (limited to 'Kernel/Arch')
-rw-r--r-- | Kernel/Arch/x86/common/Processor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Arch/x86/common/Processor.cpp b/Kernel/Arch/x86/common/Processor.cpp index dbf892c590..c7d29bbda4 100644 --- a/Kernel/Arch/x86/common/Processor.cpp +++ b/Kernel/Arch/x86/common/Processor.cpp @@ -476,10 +476,10 @@ Vector<FlatPtr> Processor::capture_stack_trace(Thread& thread, size_t max_frames break; if (Memory::is_user_range(VirtualAddress(stack_ptr), sizeof(FlatPtr) * 2)) { - if (!copy_from_user(&retaddr, &((FlatPtr*)stack_ptr)[1]) || !retaddr) + if (copy_from_user(&retaddr, &((FlatPtr*)stack_ptr)[1]).is_error() || !retaddr) break; stack_trace.append(retaddr); - if (!copy_from_user(&stack_ptr, (FlatPtr*)stack_ptr)) + if (copy_from_user(&stack_ptr, (FlatPtr*)stack_ptr).is_error()) break; } else { void* fault_at; @@ -552,7 +552,7 @@ Vector<FlatPtr> Processor::capture_stack_trace(Thread& thread, size_t max_frames auto& regs = thread.regs(); auto* stack_top = reinterpret_cast<FlatPtr*>(regs.sp()); if (Memory::is_user_range(VirtualAddress(stack_top), sizeof(FlatPtr))) { - if (!copy_from_user(&frame_ptr, &((FlatPtr*)stack_top)[0])) + if (copy_from_user(&frame_ptr, &((FlatPtr*)stack_top)[0]).is_error()) frame_ptr = 0; } else { void* fault_at; |