Re: svn commit: r300377 - head/sys/compat/ndis

2016-05-21 Thread Bruce Evans
On Sun, 22 May 2016, Andrey Chernov wrote: On 22.05.2016 3:06, Bruce Evans wrote: ... FreeBSD still has the ACM version in libkern, and has a fixed copy of that in libc, with the bad old version under an ifdef. The libc version now adjusts the range from [0, 0x7fff] to 0, 0x7ffd] and r

Re: svn commit: r300377 - head/sys/compat/ndis

2016-05-21 Thread Andrey Chernov
On 22.05.2016 3:06, Bruce Evans wrote: > On Sat, 21 May 2016, Pedro Giffuni wrote: > >> On 05/21/16 16:55, Conrad Meyer wrote: >>> On Sat, May 21, 2016 at 1:40 PM, Pedro Giffuni wrote: On 05/21/16 14:05, Conrad Meyer wrote: > Won't this still return a negative integer in many c

Re: svn commit: r300377 - head/sys/compat/ndis

2016-05-21 Thread Bruce Evans
On Sat, 21 May 2016, Pedro Giffuni wrote: On 05/21/16 16:55, Conrad Meyer wrote: On Sat, May 21, 2016 at 1:40 PM, Pedro Giffuni wrote: On 05/21/16 14:05, Conrad Meyer wrote: Won't this still return a negative integer in many cases? random(9) returns u_long, whereas this rand() routine ret

Re: svn commit: r300377 - head/sys/compat/ndis

2016-05-21 Thread Pedro Giffuni
On 05/21/16 16:55, Conrad Meyer wrote: On Sat, May 21, 2016 at 1:40 PM, Pedro Giffuni wrote: On 05/21/16 14:05, Conrad Meyer wrote: Won't this still return a negative integer in many cases? random(9) returns u_long, whereas this rand() routine returns 'int'. Even on architectures where l

Re: svn commit: r300377 - head/sys/compat/ndis

2016-05-21 Thread Conrad Meyer
On Sat, May 21, 2016 at 1:40 PM, Pedro Giffuni wrote: > > > On 05/21/16 14:05, Conrad Meyer wrote: >> Won't this still return a negative integer in many cases? >> >> random(9) returns u_long, whereas this rand() routine returns 'int'. >> >> Even on architectures where long is the same size as ordi

Re: svn commit: r300377 - head/sys/compat/ndis

2016-05-21 Thread Pedro Giffuni
On 05/21/16 14:05, Conrad Meyer wrote: On Sat, May 21, 2016 at 10:52 AM, Pedro F. Giffuni wrote: Author: pfg Date: Sat May 21 17:52:44 2016 New Revision: 300377 URL: https://svnweb.freebsd.org/changeset/base/300377 Log: ndis(4): Avoid overflow. This is a long standing problem: our rando

Re: svn commit: r300377 - head/sys/compat/ndis

2016-05-21 Thread Conrad Meyer
On Sat, May 21, 2016 at 10:52 AM, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat May 21 17:52:44 2016 > New Revision: 300377 > URL: https://svnweb.freebsd.org/changeset/base/300377 > > Log: > ndis(4): Avoid overflow. > > This is a long standing problem: our random() function returns an >

svn commit: r300377 - head/sys/compat/ndis

2016-05-21 Thread Pedro F. Giffuni
Author: pfg Date: Sat May 21 17:52:44 2016 New Revision: 300377 URL: https://svnweb.freebsd.org/changeset/base/300377 Log: ndis(4): Avoid overflow. This is a long standing problem: our random() function returns an unsigned integer but the rand provided by ndis(4) returns an int. Scale i