LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [PATCH net v2] ipvs: fix possible memory leak in ip_vs_control_net_i

To: "wanghai (M)" <wanghai38@xxxxxxxxxx>
Subject: Re: [PATCH net v2] ipvs: fix possible memory leak in ip_vs_control_net_init
Cc: Simon Horman <horms@xxxxxxxxxxxx>, pablo@xxxxxxxxxxxxx, christian@xxxxxxxxxx, lvs-devel@xxxxxxxxxxxxxxx, netfilter-devel@xxxxxxxxxxxxxxx
From: Julian Anastasov <ja@xxxxxx>
Date: Mon, 23 Nov 2020 21:04:27 +0200 (EET)
        Hello,

On Mon, 23 Nov 2020, wanghai (M) wrote:

> 在 2020/11/22 19:20, Julian Anastasov 写道:
> >  Hello,
> >
> > On Fri, 20 Nov 2020, Wang Hai wrote:
> >
> >> +  if (!proc_create_net_single("ip_vs_stats_percpu", 0,
> >> ipvs->net->proc_net,
> >> +                  ip_vs_stats_percpu_show, NULL))
> >> +          goto err_percpu;
> >     Make sure the parameters are properly aligned to function open
> > parenthesis without exceeding 80 columns:
> >
> > linux# scripts/checkpatch.pl --strict /tmp/file.patch
> Thanks, I'll perfect it.
> >     It was true only for first call due to some
> > renames for the others two in commit 3617d9496cd9 :(
> It does indeed rename in commit 3617d9496cd9.
> But I don't understand what's wrong with my patch here.

        Visually, they should look like this:

        if (!proc_create_net("ip_vs", 0, ipvs->net->proc_net,
                             &ip_vs_info_seq_ops, sizeof(struct ip_vs_iter)))
                goto err_vs;
        if (!proc_create_net_single("ip_vs_stats", 0, ipvs->net->proc_net,
                                    ip_vs_stats_show, NULL))
                goto err_stats;
        if (!proc_create_net_single("ip_vs_stats_percpu", 0,
                                    ipvs->net->proc_net,
                                    ip_vs_stats_percpu_show, NULL))
                goto err_percpu;

        The first one explained:

<1  TAB>if (!proc_create_net("ip_vs", 0, ipvs->net->proc_net,
<  open parenthesis is here  ^ and all next lines align to first parameter>
<1  TAB><1  TAB><1 TAB><5 SP>&ip_vs_info_seq_ops, sizeof(struct ip_vs_iter)))
<1  TAB><1  TAB>goto err_vs;

Regards

--
Julian Anastasov <ja@xxxxxx>
<Prev in Thread] Current Thread [Next in Thread>