aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2019-06-12 17:23:27 +0100
committerEric Engestrom <[email protected]>2019-06-12 17:27:44 +0100
commit9996ddbb27c9eb39cd234a4abce6c3742572c770 (patch)
treef403581ce5d61272affb18d2e32f3b123d6b4733 /src
parentd3781512468aa1c96e92cc6a99963cd0fed80d30 (diff)
util/futex: fix dangling pointer use
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110901 Fixes: 7dc2f4788288ec9c7ab6 "util: emulate futex on FreeBSD using umtx" Cc: Greg V <[email protected]> Signed-off-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/util/futex.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/util/futex.h b/src/util/futex.h
index a8b2c0f3527..268af92882a 100644
--- a/src/util/futex.h
+++ b/src/util/futex.h
@@ -69,15 +69,15 @@ static inline int futex_wake(uint32_t *addr, int count)
static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
{
void *uaddr = NULL, *uaddr2 = NULL;
+ struct _umtx_time tmo = {
+ ._flags = UMTX_ABSTIME,
+ ._clockid = CLOCK_MONOTONIC
+ };
assert(value == (int)(uint32_t)value); /* Check that bits weren't discarded */
if (timeout != NULL) {
- const struct _umtx_time tmo = {
- ._timeout = *timeout,
- ._flags = UMTX_ABSTIME,
- ._clockid = CLOCK_MONOTONIC
- };
+ tmo._timeout = *timeout;
uaddr = (void *)(uintptr_t)sizeof(tmo);
uaddr2 = (void *)&tmo;
}