All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Cc: Johannes Berg <johannes.berg@intel.com>
Subject: [RFC PATCH 1/2] net: netlink: make full range policy macros nicer
Date: Fri, 24 Feb 2023 13:45:52 +0100	[thread overview]
Message-ID: <20230224134441.791ae90f2939.Ic85e4e5fac77de8dedfa97ee1ad749b8ff8eb7a3@changeid> (raw)
In-Reply-To: <20230224124553.94730-1-johannes@sipsolutions.net>

From: Johannes Berg <johannes.berg@intel.com>

Since these macros are used for variable initializers
there's really no way to have a non-constant pointer,
so move the required & into the macros.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 include/net/netlink.h     | 4 ++--
 net/ipv6/ioam6_iptunnel.c | 4 ++--
 net/wireless/nl80211.c    | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/net/netlink.h b/include/net/netlink.h
index b12cd957abb4..52dedc8bfedd 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -415,13 +415,13 @@ struct nla_policy {
 #define NLA_POLICY_FULL_RANGE(tp, _range) {		\
 	.type = NLA_ENSURE_UINT_OR_BINARY_TYPE(tp),	\
 	.validation_type = NLA_VALIDATE_RANGE_PTR,	\
-	.range = _range,				\
+	.range = &(_range),				\
 }
 
 #define NLA_POLICY_FULL_RANGE_SIGNED(tp, _range) {	\
 	.type = NLA_ENSURE_SINT_TYPE(tp),		\
 	.validation_type = NLA_VALIDATE_RANGE_PTR,	\
-	.range_signed = _range,				\
+	.range_signed = &(_range),			\
 }
 
 #define NLA_POLICY_MIN(tp, _min) {			\
diff --git a/net/ipv6/ioam6_iptunnel.c b/net/ipv6/ioam6_iptunnel.c
index f6f5b83dd954..790a40e2497d 100644
--- a/net/ipv6/ioam6_iptunnel.c
+++ b/net/ipv6/ioam6_iptunnel.c
@@ -67,8 +67,8 @@ static struct ioam6_trace_hdr *ioam6_lwt_trace(struct lwtunnel_state *lwt)
 }
 
 static const struct nla_policy ioam6_iptunnel_policy[IOAM6_IPTUNNEL_MAX + 1] = {
-	[IOAM6_IPTUNNEL_FREQ_K] = NLA_POLICY_FULL_RANGE(NLA_U32, &freq_range),
-	[IOAM6_IPTUNNEL_FREQ_N] = NLA_POLICY_FULL_RANGE(NLA_U32, &freq_range),
+	[IOAM6_IPTUNNEL_FREQ_K] = NLA_POLICY_FULL_RANGE(NLA_U32, freq_range),
+	[IOAM6_IPTUNNEL_FREQ_N] = NLA_POLICY_FULL_RANGE(NLA_U32, freq_range),
 	[IOAM6_IPTUNNEL_MODE]	= NLA_POLICY_RANGE(NLA_U8,
 						   IOAM6_IPTUNNEL_MODE_MIN,
 						   IOAM6_IPTUNNEL_MODE_MAX),
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1c3b9a305f42..fbea0e786b21 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -811,7 +811,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
 	[NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
 	[NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT },
 	[NL80211_ATTR_PUNCT_BITMAP] =
-		NLA_POLICY_FULL_RANGE(NLA_U32, &nl80211_punct_bitmap_range),
+		NLA_POLICY_FULL_RANGE(NLA_U32, nl80211_punct_bitmap_range),
 };
 
 /* policy for the key attributes */
-- 
2.39.2


  reply	other threads:[~2023-02-24 12:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 12:45 [RFC PATCH 0/2] net: netlink: full range policy improvements Johannes Berg
2023-02-24 12:45 ` Johannes Berg [this message]
2023-02-24 12:45 ` [RFC PATCH 2/2] net: netlink: constify full range pointers Johannes Berg
2023-02-24 18:55 ` [RFC PATCH 0/2] net: netlink: full range policy improvements Jakub Kicinski
2023-02-24 20:00   ` Jacob Keller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230224134441.791ae90f2939.Ic85e4e5fac77de8dedfa97ee1ad749b8ff8eb7a3@changeid \
    --to=johannes@sipsolutions.net \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.