From: "Ryan O'Hara" <rohara@redhat.com>
To: Julian Anastasov <ja@ssi.bg>
Cc: Simon Horman <horms@verge.net.au>, lvs-devel@vger.kernel.org
Subject: Re: [PATCH] ipvsadm: Fix svc->pe_name conditional
Date: Mon, 19 Aug 2013 09:52:17 -0500 [thread overview]
Message-ID: <20130819145217.GA12716@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.00.1308182035550.3222@ja.ssi.bg>
On Sun, Aug 18, 2013 at 09:13:39PM +0300, Julian Anastasov wrote:
>
> Hello,
>
> On Sun, 18 Aug 2013, Ryan O'Hara wrote:
>
> > The pe_name in ipvs_service_t is an array, so comparing it NULL has no
> > effect. Use strlen to see if pe_name is set.
> >
> > Signed-off-by: Ryan O'Hara <rohara@redhat.com>
>
> Looks good to me.
>
> Acked-by: Julian Anastasov <ja@ssi.bg>
>
> Or may be we can avoid strlen? Eg. svc->pe_name[0] ?
Agree. I'll resend the patch without strlen.
> It looks like CHECK_PE has similar problem and more:
>
> - Do we really work without NL support if CHECK_PE
> always succeeds in 'if (s->pe_name)'? I have a doubt.
Not sure about this. I've always been under the impression that NL is
absolutely required.
> - CHECK_PE and CHECK_IPV4 as part of CHECK_COMPAT_SVC use
> 'return' and we can leak svc in ipvs_get_service()
>
> - in ipvs_get_service() CHECK_PE does not need to be called,
> it is already part of CHECK_COMPAT_SVC
Yes. I'm tempted to remove these macros due to the 'return'
issue. Thoughts?
> - ipvs_get_service uses malloc but later calls CHECK_PE, may be
> malloc should be changed with calloc
Aside from the fact that CHECK_PE could return without freeing memory,
I don't see the problem here.
Ryan
> > ---
> > libipvs/libipvs.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libipvs/libipvs.c b/libipvs/libipvs.c
> > index c3c3b0a..ebc46e9 100644
> > --- a/libipvs/libipvs.c
> > +++ b/libipvs/libipvs.c
> > @@ -229,7 +229,7 @@ static int ipvs_nl_fill_service_attr(struct nl_msg *msg, ipvs_service_t *svc)
> > }
> >
> > NLA_PUT_STRING(msg, IPVS_SVC_ATTR_SCHED_NAME, svc->sched_name);
> > - if (svc->pe_name)
> > + if (strlen(svc->pe_name))
> > NLA_PUT_STRING(msg, IPVS_SVC_ATTR_PE_NAME, svc->pe_name);
> > NLA_PUT(msg, IPVS_SVC_ATTR_FLAGS, sizeof(flags), &flags);
> > NLA_PUT_U32(msg, IPVS_SVC_ATTR_TIMEOUT, svc->timeout);
> > --
> > 1.8.1.4
>
> Regards
>
> --
> Julian Anastasov <ja@ssi.bg>
next prev parent reply other threads:[~2013-08-19 14:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-18 16:41 [PATCH] ipvsadm: Fix svc->pe_name conditional Ryan O'Hara
2013-08-18 18:13 ` Julian Anastasov
2013-08-19 14:52 ` Ryan O'Hara [this message]
2013-08-19 15:27 ` Julian Anastasov
2013-08-19 20:40 ` Ryan O'Hara
2013-08-20 0:28 ` Simon Horman
2013-08-20 6:35 ` Julian Anastasov
2013-08-20 14:00 ` Ryan O'Hara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130819145217.GA12716@redhat.com \
--to=rohara@redhat.com \
--cc=horms@verge.net.au \
--cc=ja@ssi.bg \
--cc=lvs-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.