diff options
author | Adrian Bunk <bunk@stusta.de> | 2006-10-31 19:59:35 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-11-01 18:42:33 -0500 |
commit | d55b4c631e89a008e80b003e5aa4291d9ec800ac (patch) | |
tree | 3245eaef822d00a769c83515abd5b34a524aacdd /net/tipc/port.c | |
parent | 3ccfc65c5004e5fe5cfbffe43b8acc686680b53e (diff) |
[TIPC] net/tipc/port.c: fix NULL dereference
The correct order is: NULL check before dereference
Spotted by the Coverity checker.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/port.c')
-rw-r--r-- | net/tipc/port.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index c1a1a76759b5..b7f3199523ca 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -1136,11 +1136,12 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq) | |||
1136 | int res = -EINVAL; | 1136 | int res = -EINVAL; |
1137 | 1137 | ||
1138 | p_ptr = tipc_port_lock(ref); | 1138 | p_ptr = tipc_port_lock(ref); |
1139 | if (!p_ptr) | ||
1140 | return -EINVAL; | ||
1141 | |||
1139 | dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, " | 1142 | dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, " |
1140 | "lower = %u, upper = %u\n", | 1143 | "lower = %u, upper = %u\n", |
1141 | ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper); | 1144 | ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper); |
1142 | if (!p_ptr) | ||
1143 | return -EINVAL; | ||
1144 | if (p_ptr->publ.connected) | 1145 | if (p_ptr->publ.connected) |
1145 | goto exit; | 1146 | goto exit; |
1146 | if (seq->lower > seq->upper) | 1147 | if (seq->lower > seq->upper) |