* [PATCH iproute2] remove unnecessary cast of RTA_DATA()
@ 2026-11-28 18:27 Stephen Hemminger
0 siblings, 0 replies; only message in thread
From: Stephen Hemminger @ 2026-11-28 18:27 UTC (permalink / raw)
To: netdev; +Cc: dsahern, Stephen Hemminger
The macro RTA_DATA results in a void * pointer so the cast
is unnecessary. No change in resulting code.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
include/libnetlink.h | 2 +-
ip/xfrm_policy.c | 2 +-
ip/xfrm_state.c | 2 +-
tc/m_ematch.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/libnetlink.h b/include/libnetlink.h
index 518b8714..e1d93119 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -373,7 +373,7 @@ int rtnl_from_file(FILE *, rtnl_listen_filter_t handler,
#define NLMSG_TSTAMP 15
#define rtattr_for_each_nested(attr, nest) \
- for ((attr) = (void *)RTA_DATA(nest); \
+ for ((attr) = RTA_DATA(nest); \
RTA_OK(attr, RTA_PAYLOAD(nest) - ((char *)(attr) - (char *)RTA_DATA((nest)))); \
(attr) = RTA_TAIL((attr)))
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index 5261a292..d36078b4 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -783,7 +783,7 @@ static int xfrm_policy_keep(struct nlmsghdr *n, void *arg)
if (tb[XFRMA_MARK]) {
int r = addattr_l(new_n, xb->size, XFRMA_MARK,
- (void *)RTA_DATA(tb[XFRMA_MARK]), tb[XFRMA_MARK]->rta_len);
+ RTA_DATA(tb[XFRMA_MARK]), tb[XFRMA_MARK]->rta_len);
if (r < 0) {
fprintf(stderr, "%s: XFRMA_MARK failed\n", __func__);
exit(1);
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index dcd08d59..242ebfec 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -1203,7 +1203,7 @@ static int xfrm_state_keep(struct nlmsghdr *n, void *arg)
if (tb[XFRMA_MARK]) {
int r = addattr_l(new_n, xb->size, XFRMA_MARK,
- (void *)RTA_DATA(tb[XFRMA_MARK]), tb[XFRMA_MARK]->rta_len);
+ RTA_DATA(tb[XFRMA_MARK]), tb[XFRMA_MARK]->rta_len);
if (r < 0) {
fprintf(stderr, "%s: XFRMA_MARK failed\n", __func__);
exit(1);
diff --git a/tc/m_ematch.c b/tc/m_ematch.c
index fefc7860..0e55f41a 100644
--- a/tc/m_ematch.c
+++ b/tc/m_ematch.c
@@ -403,7 +403,7 @@ static int print_ematch_seq(FILE *fd, struct rtattr **tb, int start,
return -1;
dlen = RTA_PAYLOAD(tb[i]) - sizeof(*hdr);
- data = (void *) RTA_DATA(tb[i]) + sizeof(*hdr);
+ data = RTA_DATA(tb[i]) + sizeof(*hdr);
if (dlen < 0)
return -1;
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-28 18:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 18:27 [PATCH iproute2] remove unnecessary cast of RTA_DATA() Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox