git: eb5a0f6271a0 - stable/14 - powerpc: Avoid ignoring copyin()'s return value
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Jan 2024 00:37:21 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=eb5a0f6271a01aafe39bd232f2f91133a8e36fbc
commit eb5a0f6271a01aafe39bd232f2f91133a8e36fbc
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-26 01:40:16 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-02 00:29:50 +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
(cherry picked from commit bdf03b4bcc4a9aa0be503dbc64415e6b0b845fbc)
---
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];