Acked-by: jon

> -----Original Message-----
> From: Parthasarathy Bhuvaragan
> Sent: Wednesday, 03 August, 2016 09:46
> To: tipc-discussion@lists.sourceforge.net; Jon Maloy <jon.ma...@ericsson.com>;
> ma...@donjonn.com; Ying Xue <ying....@windriver.com>
> Cc: dan.carpen...@oracle.com
> Subject: [PATCH net v1 1/1] tipc: fix variable dereferenced before check 'mon'
> 
> In commit cf6f7e1d5109 ("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: cf6f7e1d5109 ("tipc: dump monitor attributes")
> Reported-by: Dan Carpenter <dan.carpen...@oracle.com>
> Signed-off-by: Parthasarathy Bhuvaragan
> <parthasarathy.bhuvara...@ericsson.com>
> ---
>  net/tipc/monitor.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
> index be70a57c1ff9..9dc0388233ae 100644
> --- a/net/tipc/monitor.c
> +++ b/net/tipc/monitor.c
> @@ -728,12 +728,13 @@ int tipc_nl_add_monitor_peer(struct net *net, struct
> tipc_nl_msg *msg,
>                            u32 bearer_id, u32 *prev_node)
>  {
>       struct tipc_monitor *mon = tipc_monitor(net, bearer_id);
> -     struct tipc_peer *peer = mon->self;
> +     struct tipc_peer *peer;
> 
>       if (!mon)
>               return -EINVAL;
> 
>       read_lock_bh(&mon->lock);
> +     peer = mon->self;
>       do {
>               if (*prev_node) {
>                       if (peer->addr == *prev_node)
> --
> 2.1.4


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to