From: Jon Maloy <jon.ma...@ericsson.com>
Date: Wed, 28 Mar 2018 16:58:20 +0200

> -/*
> - * tipc_nametbl_publish - add name publication to network name tables
> +/* tipc_nametbl_publish - add service binding to name table
>   */
>  struct publication *tipc_nametbl_publish(struct net *net, u32 type, u32 
> lower,
> -                                      u32 upper, u32 scope, u32 port_ref,
> +                                      u32 upper, u32 scope, u32 port,
>                                        u32 key)
>  {
> -     struct publication *publ;
> -     struct sk_buff *buf = NULL;
> -     struct tipc_net *tn = net_generic(net, tipc_net_id);
> +     struct name_table *nt = tipc_name_table(net);
> +     struct tipc_net *tn = tipc_net(net);
> +     struct sk_buff *skb = NULL;
> +     struct publication *p;
>  
>       spin_lock_bh(&tn->nametbl_lock);
> -     if (tn->nametbl->local_publ_count >= TIPC_MAX_PUBLICATIONS) {
> -             pr_warn("Publication failed, local publication limit reached 
> (%u)\n",
> -                     TIPC_MAX_PUBLICATIONS);
> -             spin_unlock_bh(&tn->nametbl_lock);
> -             return NULL;
> +
> +     if (nt->local_publ_count >= TIPC_MAX_PUBL) {
> +             pr_warn("Bind failed, max limit %u reached\n", TIPC_MAX_PUBL);
> +             goto exit;

If we goto exit:...

> +exit:
>       spin_unlock_bh(&tn->nametbl_lock);
>  
> -     if (buf)
> -             tipc_node_broadcast(net, buf);
> -     return publ;
> +     if (skb)
> +             tipc_node_broadcast(net, skb);
> +     return p;
>  }

'p' is uninitialized, yet we return it.

Reply via email to