summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2017-07-19 06:52:41 +0000
committerclaudio <claudio@openbsd.org>2017-07-19 06:52:41 +0000
commit25fbc5b2fc9056b157d333df59d2abcc1236210d (patch)
tree0c639c484a5fd1b46115f8d76affef529f0d8a54
parentrevert previous; the code this was supposed to be used for is moving (diff)
downloadwireguard-openbsd-25fbc5b2fc9056b157d333df59d2abcc1236210d.tar.xz
wireguard-openbsd-25fbc5b2fc9056b157d333df59d2abcc1236210d.zip
Move KTRPOINT call up. The lenght variable i is getting aligned and so
uninitialised data can be dumped into the ktrace message. Found by Ilja Van Sprundel OK bluhm@
-rw-r--r--sys/kern/uipc_syscalls.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index e041ac1bb1e..75953e74395 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.153 2017/07/12 09:25:47 mpi Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.154 2017/07/19 06:52:41 claudio Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -882,16 +882,16 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp,
i = len;
}
error = copyout(mtod(m, caddr_t), cp, i);
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_STRUCT) && error == 0 && i)
+ ktrcmsghdr(p, mtod(m, char *), i);
+#endif
if (m->m_next)
i = ALIGN(i);
cp += i;
len -= i;
if (error != 0 || len <= 0)
break;
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_STRUCT) && i)
- ktrcmsghdr(p, mtod(m, char *), i);
-#endif
} while ((m = m->m_next) != NULL);
len = cp - (caddr_t)mp->msg_control;
}