Re: Portability fix in kern_ntptime.c

2019-06-06 Thread Kamil Rytarowski
On 06.06.2019 05:07, Mouse wrote: >> Unfortunately, if "undefined behavior" (UB) is invoked, you simply >> cannot claim to understand what is happening, because C11-compliant >> compilers have a lot of leeway in what code they generate when >> behavior is undefined. > > Compilers that do

Re: Portability fix in kern_ntptime.c

2019-06-05 Thread Mouse
> Unfortunately, if "undefined behavior" (UB) is invoked, you simply > cannot claim to understand what is happening, because C11-compliant > compilers have a lot of leeway in what code they generate when > behavior is undefined. Compilers that do unexpected things under such circumstances are

Re: Portability fix in kern_ntptime.c

2019-06-05 Thread David Young
On Thu, Jun 06, 2019 at 04:42:50AM +0700, Robert Elz wrote: > Further, I'd never do it without a thorough review of the code, > if you looked, you'd also see > > freq = (ntv->freq * 1000LL) >> 16; > > and > > ntv->ppsfreq = L_GINT((pps_freq / 1000LL) << 16); > > (and

Re: Portability fix in kern_ntptime.c

2019-06-05 Thread Kamil Rytarowski
On 05.06.2019 23:42, Robert Elz wrote: > Date:Wed, 5 Jun 2019 22:25:39 +0200 > From:Kamil Rytarowski > Message-ID: <05d25ffa-588b-464f-56c9-099fea3f3...@gmx.com> > > | Does this patch look good? > > Personally, I would hesitate to change any of the NTP related >

Re: Portability fix in kern_ntptime.c

2019-06-05 Thread Robert Elz
Date:Wed, 5 Jun 2019 22:25:39 +0200 From:Kamil Rytarowski Message-ID: <05d25ffa-588b-464f-56c9-099fea3f3...@gmx.com> | Does this patch look good? Personally, I would hesitate to change any of the NTP related code without an extremely good reason, and without a lot

Portability fix in kern_ntptime.c

2019-06-05 Thread Kamil Rytarowski
Does this patch look good? http://netbsd.org/~kamil/patch-00121-kern_ntptime.c.txt It fixes the following reports: [ 49.1001191] UBSan: Undefined Behavior in ../../../../kern/kern_ntptime.c:381:14, left shift of negative value -43172954112 [ 49.1001191] UBSan: Undefined Behavior in