Mesa (staging/19.1): util/futex: fix dangling pointer use
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 18 10:05:52 UTC 2019
Module: Mesa
Branch: staging/19.1
Commit: 582b691062367618e73c0bab03ecf7c03e81fb19
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=582b691062367618e73c0bab03ecf7c03e81fb19
Author: Eric Engestrom <eric.engestrom at intel.com>
Date: Wed Jun 12 17:23:27 2019 +0100
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 <greg at unrelenting.technology>
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
(cherry picked from commit 9996ddbb27c9eb39cd234a4abce6c3742572c770)
---
src/util/futex.h | 10 +++++-----
1 file 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;
}
More information about the mesa-commit
mailing list