PERFORCE change 28754 for review

John Baldwin jhb at FreeBSD.org
Fri Apr 11 11:42:51 PDT 2003


On 11-Apr-2003 Peter Wemm wrote:
> http://perforce.freebsd.org/chv.cgi?CH=28754
> 
> Change 28754 by peter at peter_daintree on 2003/04/10 23:32:49
> 
>       OK, I have to laugh about this one.
>       keep gcc-3.3 happy where long > int (speed_t is
>       unsigned int)

Why not use UINTMAX? if speed_t is an int?  Or perhaps
speed_t should be a long instead?

> Affected files ...
> 
> .. //depot/projects/hammer/sys/dev/sio/sio.c#9 edit
> 
> Differences ...
> 
> ==== //depot/projects/hammer/sys/dev/sio/sio.c#9 (text+ko) ====
> 
> @@ -1542,8 +1542,12 @@
>       u_int   divisor;
>       int     error;
>  
> -     if (speed == 0 || speed > (ULONG_MAX - 1) / 8)
> +     if (speed == 0)
> +             return (0);
> +#if UINT_MAX > (ULONG_MAX - 1) / 8
> +     if (speed > (ULONG_MAX - 1) / 8)
>               return (0);
> +#endif
>       divisor = (rclk / (8UL * speed) + 1) / 2;
>       if (divisor == 0 || divisor >= 65536)
>               return (0);

-- 

John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


More information about the p4-projects mailing list