aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2021-11-10 15:16:41 -0800
committerJason A. Donenfeld <Jason@zx2c4.com>2022-06-10 18:57:00 +0200
commita31339b25e38f7ba3af5381f9ee6cb3eae13992f (patch)
tree21f6750e6c059be8f5c3e555e706bfadd3f142a6
parentbuild: only include compat.h for if_wg.c and fix build with an obj directory (diff)
downloadwireguard-freebsd-a31339b25e38f7ba3af5381f9ee6cb3eae13992f.tar.xz
wireguard-freebsd-a31339b25e38f7ba3af5381f9ee6cb3eae13992f.zip
if_wg: wg_queue_len: remove locking
Locking a mutex just to read a single word doesn't close any races. Signed-off-by: John Baldwin <jhb@FreeBSD.org>
-rw-r--r--src/if_wg.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/if_wg.c b/src/if_wg.c
index c2bc2ee..262024b 100644
--- a/src/if_wg.c
+++ b/src/if_wg.c
@@ -1804,11 +1804,7 @@ wg_queue_deinit(struct wg_queue *queue)
static size_t
wg_queue_len(struct wg_queue *queue)
{
- size_t len;
- mtx_lock(&queue->q_mtx);
- len = queue->q_len;
- mtx_unlock(&queue->q_mtx);
- return (len);
+ return (queue->q_len);
}
static int