Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Apr 2017 08:10:30 +0200
From:      Michael Tuexen <tuexen@freebsd.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Cy Schubert <Cy.Schubert@komquats.com>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r317208 - head/sys/netinet
Message-ID:  <8BBC38A0-DDBA-4C04-9654-98755B3E4E13@freebsd.org>
In-Reply-To: <20170421131041.G966@besplex.bde.org>
References:  <201704210143.v3L1h99s037727@slippy.cwsent.com> <20170421131041.G966@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> On 21. Apr 2017, at 05:16, Bruce Evans <brde@optusnet.com.au> wrote:
>=20
> On Thu, 20 Apr 2017, Cy Schubert wrote:
>=20
> Please trim quotes.
>=20
>> In message <201704201919.v3KJJYko052651@repo.freebsd.org>, Michael =
Tuexen
>> write
>> s:
>=20
> [>> ... 5 lines trimmed]
>=20
>>> Log:
>>>  Syncoockies can be used in combination with the syncache. If the =
cache
>>>  overflows, syncookies are used.
>=20
> [>> ... 16 lines trimmed]
>=20
>>> Modified: head/sys/netinet/tcp_syncache.c
>>> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
>>> =3D
>>> --- head/sys/netinet/tcp_syncache.c	Thu Apr 20 19:14:52 2017	=
(r31720
>>> 7)
>>> +++ head/sys/netinet/tcp_syncache.c	Thu Apr 20 19:19:33 2017	=
(r31720
>>> 8)
>>> @@ -260,6 +260,7 @@ syncache_init(void)
>>> 			 &V_tcp_syncache.hashbase[i].sch_mtx, 0);
>>> 		V_tcp_syncache.hashbase[i].sch_length =3D 0;
>>> 		V_tcp_syncache.hashbase[i].sch_sc =3D &V_tcp_syncache;
>>> +		V_tcp_syncache.hashbase[i].sch_last_overflow =3D =
INT64_MIN;
>> ...
>> This line produced the following on i386:
>>=20
>> /opt/src/svn-current/sys/netinet/tcp_syncache.c:263:50: error: =
implicit
>> conversion from 'long long' to 'time_t' (aka 'int') changes value =
from
>> -9223372036854775808 to 0 [-Werror,-Wconstant-conversion]
>>               V_tcp_syncache.hashbase[i].sch_last_overflow =3D =
INT64_MIN;
>>                                                            ~ =
^~~~~~~~~
>> ./x86/_stdint.h:91:41: note: expanded from macro 'INT64_MIN'
>> #define INT64_MIN       (-0x7fffffffffffffffLL-1)
>>                        ~~~~~~~~~~~~~~~~~~~~~^~
>>=20
>> Looks like it needs a time_t cast.
>=20
> A cast would just break the warning.  INT64_MIN has nothing to do with
> time_t.  The expression (time_t)INT64_MIN would be more obviously =
garbage
> since in the above it is not clear that sch_last_overflow has a type
> unrelated to the constant.
Fixed in https://svnweb.freebsd.org/changeset/base/317244
>=20
> INT64_MIN is also broken if time_t is 64 bits but unsigned.  Then it =
is
> converted to half of plus infinity instead of the intended minus =
infinity.
The patch assumes that time_t is signed, which is true for FreeBSD on =
all
platforms. Or am I missing a platform?

Best regards
Michael
>=20
> Bruce




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8BBC38A0-DDBA-4C04-9654-98755B3E4E13>