]> 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)
commit387468da34e35ae435150ffb21ee3a225c05800d
treeb3b016c578ca225e824a3317ddf5e94ac6bdf5d6
parent36d9b96106e35fd0731afdb3086f279ff97e2573
tipc: fix variable dereference before NULL check

In commit bef0677de2b0 ("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: bef0677de2b0 ("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