From a46abbd66eecdbfba84c81eca8911f5d9564c8a8 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Fri, 26 Jul 2024 13:09:06 -0400 Subject: [PATCH] Fix typing on call to interlockedExchange for windows mingw is complaining on builds about the use of InterlockedExchange on a uint32_t type, as the input parameter here is expected to be LONG (defined as signed 32 bit on all versions of windows). the input value (reader_idx) will never grow larger than the group size of the lock (nominally 2, but always a reasonably small value), so it should be safe to just cast it to the appropriate type here. Reviewed-by: Matt Caswell Reviewed-by: Tom Cosgrove (Merged from https://github.com/openssl/openssl/pull/25015) --- crypto/threads_win.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/threads_win.c b/crypto/threads_win.c index 0196235a13e..fe57d8671b1 100644 --- a/crypto/threads_win.c +++ b/crypto/threads_win.c @@ -365,7 +365,7 @@ static struct rcu_qp *update_qp(CRYPTO_RCU_LOCK *lock) /* update the reader index to be the prior qp */ tmp = lock->current_alloc_idx; - InterlockedExchange(&lock->reader_idx, tmp); + InterlockedExchange((LONG volatile *)&lock->reader_idx, tmp); /* wake up any waiters */ ossl_crypto_condvar_broadcast(lock->alloc_signal); -- 2.47.2