Commit 9996ddbb authored by Eric Engestrom's avatar Eric Engestrom 💤
Browse files

util/futex: fix dangling pointer use

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110901
Fixes: 7dc2f478

 "util: emulate futex on FreeBSD using umtx"
Cc: Greg V <greg@unrelenting.technology>
Signed-off-by: Eric Engestrom's avatarEric Engestrom <eric.engestrom@intel.com>
parent d3781512
...@@ -69,15 +69,15 @@ static inline int futex_wake(uint32_t *addr, int count) ...@@ -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) static inline int futex_wait(uint32_t *addr, int32_t value, struct timespec *timeout)
{ {
void *uaddr = NULL, *uaddr2 = NULL; 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 */ assert(value == (int)(uint32_t)value); /* Check that bits weren't discarded */
if (timeout != NULL) { if (timeout != NULL) {
const struct _umtx_time tmo = { tmo._timeout = *timeout;
._timeout = *timeout,
._flags = UMTX_ABSTIME,
._clockid = CLOCK_MONOTONIC
};
uaddr = (void *)(uintptr_t)sizeof(tmo); uaddr = (void *)(uintptr_t)sizeof(tmo);
uaddr2 = (void *)&tmo; uaddr2 = (void *)&tmo;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment