Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Apr 2003 14:42:47 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Peter Wemm <peter@FreeBSD.org>
Cc:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   RE: PERFORCE change 28754 for review
Message-ID:  <XFMail.20030411144247.jhb@FreeBSD.org>
In-Reply-To: <200304110633.h3B6XTJw085790@repoman.freebsd.org>

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

On 11-Apr-2003 Peter Wemm wrote:
> http://perforce.freebsd.org/chv.cgi?CH=28754
> 
> Change 28754 by peter@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@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030411144247.jhb>