All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Benc <jbenc@redhat.com>
To: Matthias Schiffer <mschiffer@universe-factory.net>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net] vxlan: correctly validate VXLAN ID against VXLAN_VID_MASK
Date: Thu, 23 Feb 2017 16:34:37 +0100	[thread overview]
Message-ID: <20170223163437.6f2a29cb@griffin> (raw)
In-Reply-To: <3ea499d5a3564fc7074665962b1a10cccd900e59.1487854674.git.mschiffer@universe-factory.net>

On Thu, 23 Feb 2017 13:59:02 +0100, Matthias Schiffer wrote:
> The incorrect check caused an off-by-one error: the maximum VID 0xffffff
> was unusable.
> 
> Fixes: d342894c5d2f ("vxlan: virtual extensible lan")
> Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
> ---
>  drivers/net/vxlan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 556953f53437..f89428fb7389 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2675,7 +2675,7 @@ static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[])
>  
>  	if (data[IFLA_VXLAN_ID]) {
>  		__u32 id = nla_get_u32(data[IFLA_VXLAN_ID]);
> -		if (id >= VXLAN_VID_MASK)
> +		if (id & ~VXLAN_VID_MASK)
>  			return -ERANGE;
>  	}
>  

"if (id >= VXLAN_N_VID)" would be cleaner and the meaning more obvious.

Thanks,

 Jiri

      reply	other threads:[~2017-02-23 15:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-23 12:59 [PATCH net] vxlan: correctly validate VXLAN ID against VXLAN_VID_MASK Matthias Schiffer
2017-02-23 15:34 ` Jiri Benc [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=20170223163437.6f2a29cb@griffin \
    --to=jbenc@redhat.com \
    --cc=davem@davemloft.net \
    --cc=mschiffer@universe-factory.net \
    --cc=netdev@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.