lkml.org 
[lkml]   [2019]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH net] net: sit: fix UBSAN Undefined behaviour in check_6rd
From
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.

I don't like this at all, and I have to put my foot down somehow.

So I'm not applying this, sorry.

\
 
 \ /
  Last update: 2019-03-11 18:30    [W:0.070 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site