aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/node.c
diff options
context:
space:
mode:
authorJon Maloy <jon.maloy@ericsson.com>2019-03-22 10:03:51 -0400
committerDavid S. Miller <davem@davemloft.net>2019-03-23 21:45:59 -0400
commit737889efe9713a0f20a75fd0de952841d9275e6b (patch)
tree4682a26dffe0a2265321dbfe1ba0ce4660cabe88 /net/tipc/node.c
parent064c5d6881e897077639e04973de26440ee205e6 (diff)
tipc: tipc clang warning
When checking the code with clang -Wsometimes-uninitialized we get the following warning: if (!tipc_link_is_establishing(l)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/tipc/node.c:847:46: note: uninitialized use occurs here tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr); net/tipc/node.c:831:2: note: remove the 'if' if its condition is always true if (!tipc_link_is_establishing(l)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/tipc/node.c:821:31: note: initialize the variable 'maddr' to silence this warning struct tipc_media_addr *maddr; We fix this by initializing 'maddr' to NULL. For the matter of clarity, we also test if 'xmitq' is non-empty before we use it and 'maddr' further down in the function. It will never happen that 'xmitq' is non- empty at the same time as 'maddr' is NULL, so this is a sufficient test. Fixes: 598411d70f85 ("tipc: make resetting of links non-atomic") Reported-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/node.c')
-rw-r--r--net/tipc/node.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 2dc4919ab23c..dd3b6dc17662 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -817,10 +817,10 @@ static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id,
817static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete) 817static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete)
818{ 818{
819 struct tipc_link_entry *le = &n->links[bearer_id]; 819 struct tipc_link_entry *le = &n->links[bearer_id];
820 struct tipc_media_addr *maddr = NULL;
820 struct tipc_link *l = le->link; 821 struct tipc_link *l = le->link;
821 struct tipc_media_addr *maddr;
822 struct sk_buff_head xmitq;
823 int old_bearer_id = bearer_id; 822 int old_bearer_id = bearer_id;
823 struct sk_buff_head xmitq;
824 824
825 if (!l) 825 if (!l)
826 return; 826 return;
@@ -844,7 +844,8 @@ static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete)
844 tipc_node_write_unlock(n); 844 tipc_node_write_unlock(n);
845 if (delete) 845 if (delete)
846 tipc_mon_remove_peer(n->net, n->addr, old_bearer_id); 846 tipc_mon_remove_peer(n->net, n->addr, old_bearer_id);
847 tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr); 847 if (!skb_queue_empty(&xmitq))
848 tipc_bearer_xmit(n->net, bearer_id, &xmitq, maddr);
848 tipc_sk_rcv(n->net, &le->inputq); 849 tipc_sk_rcv(n->net, &le->inputq);
849} 850}
850 851