git: bdf03b4bcc4a - main - powerpc: Avoid ignoring copyin()'s return value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Dec 2023 02:04:21 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bdf03b4bcc4a9aa0be503dbc64415e6b0b845fbc commit bdf03b4bcc4a9aa0be503dbc64415e6b0b845fbc Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2023-12-26 01:40:16 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2023-12-26 02:04:00 +0000 powerpc: Avoid ignoring copyin()'s return value A recent change made it possible for cpu_set_upcall() to return an error. Do that here instead of ignoring an error from copyin(). Reviewed by: jhibbits MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43105 --- sys/powerpc/powerpc/exec_machdep.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index 0c10115c4e25..94e561ddd33a 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -1155,6 +1155,9 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, { struct trapframe *tf; uintptr_t sp; + #ifdef __powerpc64__ + int error; + #endif tf = td->td_frame; /* align stack and alloc space for frame ptr and saved LR */ @@ -1182,10 +1185,12 @@ cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, tf->srr0 = (register_t)entry; /* ELFv2 ABI requires that the global entry point be in r12. */ tf->fixreg[12] = (register_t)entry; - } - else { + } else { register_t entry_desc[3]; - (void)copyin((void *)entry, entry_desc, sizeof(entry_desc)); + error = copyin((void *)entry, entry_desc, + sizeof(entry_desc)); + if (error != 0) + return (error); tf->srr0 = entry_desc[0]; tf->fixreg[2] = entry_desc[1]; tf->fixreg[11] = entry_desc[2];