mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: linmiaohe <linmiaohe@huawei.com>
To: David Miller <davem@davemloft.net>
Cc: <kuznet@ms2.inr.ac.ru>, <yoshfuji@linux-ipv6.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<mingfangsen@huawei.com>
Subject: Re: [PATCH net] net: sit: fix UBSAN Undefined behaviour in check_6rd
Date: Tue, 12 Mar 2019 14:01:01 +0800	[thread overview]
Message-ID: <09b205d5-c22c-377c-31af-effc68884098@huawei.com> (raw)
In-Reply-To: <20190311.103037.1736601922338617214.davem@davemloft.net>

That's very nice of you. Thank you very much.

On 2019/3/12 1:30, David Miller wrote:
> From: David Miller <davem@davemloft.net>
> Date: Mon, 11 Mar 2019 10:29:37 -0700 (PDT)
> 
>> From: linmiaohe <linmiaohe@huawei.com>
>> Date: Mon, 11 Mar 2019 16:29:32 +0800
>>
>>> @@ -778,8 +778,9 @@ static bool check_6rd(struct ip_tunnel *tunnel, const struct in6_addr *v6dst,
>>>  		pbw0 = tunnel->ip6rd.prefixlen >> 5;
>>>  		pbi0 = tunnel->ip6rd.prefixlen & 0x1f;
>>>
>>> -		d = (ntohl(v6dst->s6_addr32[pbw0]) << pbi0) >>
>>> -		    tunnel->ip6rd.relay_prefixlen;
>>> +		d = tunnel->ip6rd.relay_prefixlen < 32 ?
>>> +			(ntohl(v6dst->s6_addr32[pbw0]) << pbi0) >>
>>> +		    tunnel->ip6rd.relay_prefixlen : 0;
>>>
>>
>> I hate the fact that we have to guard against something which the rest
>> of the code makes sure NEVER EVER happens.
>>
>> Every assignment of ->relay_prefixlen is guarded by a check against 32.
> 
> Sorry, I now understand, it can equal 32.
> 
> I'll apply this, thank you.
> 
> .
> 


  reply	other threads:[~2019-03-12  6:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-11  8:29 linmiaohe
2019-03-11 17:29 ` David Miller
2019-03-11 17:30   ` David Miller
2019-03-12  6:01     ` linmiaohe [this message]
2019-03-12  6:08     ` linmiaohe

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=09b205d5-c22c-377c-31af-effc68884098@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingfangsen@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®