🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
2 messages
2 total messages Started by Stephen Hemminger Sat, 28 Nov 2026 18:27
[PATCH iproute2] remove unnecessary cast of RTA_DATA()
#23968
Author: Stephen Hemminger
Date: Sat, 28 Nov 2026 18:27
66 lines
12538 bytes
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
Re: [PATCH iproute2] remove unnecessary cast of RTA_DATA()
#24736
Author: patchwork-bot+netdevbpf
Date: Mon, 30 Nov 2026 18:20
26 lines
8532 bytes
Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Sat, 28 Nov 2026 10:27:19 -0800 you wrote:
> 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(-)

Here is the summary with links:
  - [iproute2] remove unnecessary cast of RTA_DATA()
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=65af26828fc5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads