Skip to content

Commit

Permalink
[TIPC] net/tipc/port.c: fix NULL dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian Bunk authored and David S. Miller committed Nov 1, 2006
1 parent 3ccfc65 commit d55b4c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/tipc/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -1136,11 +1136,12 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
int res = -EINVAL;

p_ptr = tipc_port_lock(ref);
if (!p_ptr)
return -EINVAL;

dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, "
"lower = %u, upper = %u\n",
ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper);
if (!p_ptr)
return -EINVAL;
if (p_ptr->publ.connected)
goto exit;
if (seq->lower > seq->upper)
Expand Down

0 comments on commit d55b4c6

Please sign in to comment.