All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next v2 1/2] tipc: convert dest node's address to network order
@ 2021-03-12  2:20 Hoang Huu Le
  2021-03-12  2:20 ` [net-next v2 2/2] tipc: clean up warnings detected by sparse Hoang Huu Le
  0 siblings, 1 reply; 2+ messages in thread
From: Hoang Huu Le @ 2021-03-12  2:20 UTC (permalink / raw)
  To: jmaloy, maloy, ying.xue, kuba, davem, netdev, tipc-discussion; +Cc: Hoang Le

From: Hoang Le <hoang.h.le@dektech.com.au>

(struct tipc_link_info)->dest is in network order (__be32), so we must
convert the value to network order before assigning. The problem detected
by sparse:

net/tipc/netlink_compat.c:699:24: warning: incorrect type in assignment (different base types)
net/tipc/netlink_compat.c:699:24:    expected restricted __be32 [usertype] dest
net/tipc/netlink_compat.c:699:24:    got int

Acked-by: Jon Maloy <jmaloy@redhat.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
---
 net/tipc/netlink_compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 5a1ce64039f7..0749df80454d 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -696,7 +696,7 @@ static int tipc_nl_compat_link_dump(struct tipc_nl_compat_msg *msg,
 	if (err)
 		return err;
 
-	link_info.dest = nla_get_flag(link[TIPC_NLA_LINK_DEST]);
+	link_info.dest = htonl(nla_get_flag(link[TIPC_NLA_LINK_DEST]));
 	link_info.up = htonl(nla_get_flag(link[TIPC_NLA_LINK_UP]));
 	nla_strscpy(link_info.str, link[TIPC_NLA_LINK_NAME],
 		    TIPC_MAX_LINK_NAME);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-12  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12  2:20 [net-next v2 1/2] tipc: convert dest node's address to network order Hoang Huu Le
2021-03-12  2:20 ` [net-next v2 2/2] tipc: clean up warnings detected by sparse Hoang Huu Le

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.