]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: fix variable dereference before NULL check
authorParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Wed, 10 Aug 2016 12:07:34 +0000 (14:07 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Aug 2016 00:56:52 +0000 (17:56 -0700)
commit364e937b9497248c4def03b9ce588ac0a2fe2dfb
treeb3b016c578ca225e824a3317ddf5e94ac6bdf5d6
parentb2d4e71e0d0d07e3c46218a0154ad37f61f8fecc
tipc: fix variable dereference before NULL check

In commit 4176428a1248 ("tipc: dump monitor attributes"),
I dereferenced a pointer before checking if its valid.
This is reported by static check Smatch as:
net/tipc/monitor.c:733 tipc_nl_add_monitor_peer()
     warn: variable dereferenced before check 'mon' (see line 731)

In this commit, we check for a valid monitor before proceeding
with any other operation.

Fixes: 4176428a1248 ("tipc: dump monitor attributes")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/monitor.c