summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTobias Heider <tobhe@cvs.openbsd.org>2022-01-21 14:07:07 +0000
committerTobias Heider <tobhe@cvs.openbsd.org>2022-01-21 14:07:07 +0000
commit59423e7eb105a7bcc317d5817b6ccef5305380dc (patch)
tree22ddfe07d461ea28edc5086e405e95ea828de2d7 /sys/arch
parent09dc662336818f44d74e8a26d4529811d5b393ba (diff)
Fix NULL dereference which allows user programs to read parts
of the kernel memory. Found with clang static analyzer. Feedback and ok gkoehler@ ok bluhm@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc/powerpc/trap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c
index 6e12ceb4ee4..990615fbae4 100644
--- a/sys/arch/powerpc/powerpc/trap.c
+++ b/sys/arch/powerpc/powerpc/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.124 2022/01/20 14:02:51 tobhe Exp $ */
+/* $OpenBSD: trap.c,v 1.125 2022/01/21 14:07:06 tobhe Exp $ */
/* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */
/*
@@ -154,7 +154,7 @@ void
enable_vec(struct proc *p)
{
struct pcb *pcb = &p->p_addr->u_pcb;
- struct vreg *pcb_vr = pcb->pcb_vr;
+ struct vreg *pcb_vr;
struct cpu_info *ci = curcpu();
u_int32_t oldmsr, msr;
@@ -163,6 +163,7 @@ enable_vec(struct proc *p)
*/
if (pcb->pcb_vr == NULL)
pcb->pcb_vr = pool_get(&ppc_vecpl, PR_WAITOK | PR_ZERO);
+ pcb_vr = pcb->pcb_vr;
if (curcpu()->ci_vecproc != NULL || pcb->pcb_veccpu != NULL)
printf("attempting to restore vector in use vecproc %p"