diff options
author | Zhenlei Huang <zlei@FreeBSD.org> | 2024-06-08 03:21:11 +0000 |
---|---|---|
committer | Zhenlei Huang <zlei@FreeBSD.org> | 2024-06-11 04:49:58 +0000 |
commit | c720ff8f95fc2e36944f503d1b40301cea7b7687 (patch) | |
tree | 8015b64627af19946d84d08d3c850a3fed1bc252 | |
parent | ef4d145057c10e452ac07b3111b4b4d0c5382fb5 (diff) | |
download | src-c720ff8f95fc2e36944f503d1b40301cea7b7687.tar.gz src-c720ff8f95fc2e36944f503d1b40301cea7b7687.zip |
sys/sysctl.h: Fix wrong assertion with multiple access flags
With multiple flags passed in, e.g., CTLFLAG_RD | CTLFLAG_CAPRD, due to
the precedence rules, this will result in false positive assertion. Fix
that by surrounding the replacement lists with parentheses.
Reviewed by: imp, erj
Fixes: 10a1e981d411 iflib: mark isc_driver_version as constant
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45531
(cherry picked from commit 23f4131ad685debef98566351cb9f0e0a5903903)
(cherry picked from commit 9cd77bd9c68bda6134c6672e9a923869b7923343)
-rw-r--r-- | sys/sys/sysctl.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 3a61f1153c5a..ff87e32df2b7 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -382,14 +382,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define SYSCTL_CONST_STRING(parent, nbr, name, access, arg, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING | CTLFLAG_MPSAFE | (access),\ __DECONST(char *, arg), 0, sysctl_handle_string, "A", descr); \ - CTASSERT(!(access & CTLFLAG_WR)); \ + CTASSERT(!((access) & CTLFLAG_WR)); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING) #define SYSCTL_ADD_CONST_STRING(ctx, parent, nbr, name, access, arg, descr) \ ({ \ char *__arg = __DECONST(char *, arg); \ - CTASSERT(!(access & CTLFLAG_WR)); \ + CTASSERT(!((access) & CTLFLAG_WR)); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING | \ |