netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Bo YU <tsu.yubo@gmail.com>,
	matthieu.baerts@tessares.net, davem@davemloft.net,
	kuba@kernel.org, mathew.j.martineau@linux.intel.com
Cc: netdev@vger.kernel.org, mptcp@lists.01.org
Subject: Re: [PATCH -next] mptcp/pm_netlink.c : add check for nla_put_in6_addr
Date: Tue, 21 Apr 2020 18:32:10 +0200	[thread overview]
Message-ID: <4440312dc634ce08e2a3f76e38851bcc8cd331c2.camel@redhat.com> (raw)
In-Reply-To: <20200421161830.uaiwr5il6kh5texr@host>

On Wed, 2020-04-22 at 00:18 +0800, Bo YU wrote:
> Normal there should be checked for nla_put_in6_addr like other
> usage in net.
> 
> Detected by CoverityScan, CID# 1461639
> 
> Fixes: 01cacb00b35c("mptcp: add netlink-based PM")
> Signed-off-by: Bo YU <tsu.yubo@gmail.com>
> ---
> BWT, I am not sure nla_put_in_addr whether or not to do such that
> ---
>  net/mptcp/pm_netlink.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index 86d61ab34c7c..f340b00672e1 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -603,8 +603,9 @@ static int mptcp_nl_fill_addr(struct sk_buff *skb,
>  		nla_put_in_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR4,
>  				addr->addr.s_addr);
>  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
> -	else if (addr->family == AF_INET6)
> -		nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6);
> +	else if (addr->family == AF_INET6 &&
> +		nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6))
> +		goto nla_put_failure;
>  #endif
>  	nla_nest_end(skb, attr);
>  	return 0;

This change LGTM, but I think we also need a similar check for
nla_put_in_addr(), thanks!

Paolo


      reply	other threads:[~2020-04-21 16:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 16:18 [PATCH -next] mptcp/pm_netlink.c : add check for nla_put_in6_addr Bo YU
2020-04-21 16:32 ` Paolo Abeni [this message]

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=4440312dc634ce08e2a3f76e38851bcc8cd331c2.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mathew.j.martineau@linux.intel.com \
    --cc=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.01.org \
    --cc=netdev@vger.kernel.org \
    --cc=tsu.yubo@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).