[PATCH 6/7] clock: fix possible error on overflow in is_timeout

Sascha Hauer s.hauer at pengutronix.de
Thu Apr 22 07:32:55 EDT 2010


On Tue, Apr 20, 2010 at 05:39:12AM +0200, Wolfram Sang wrote:
> From: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> Signed-off-by: Wolfram Sang <w.sang at pengutronix.de>
> ---
>  common/clock.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)

applied to master.

> 
> diff --git a/common/clock.c b/common/clock.c
> index 8eeb917..15df0ab 100644
> --- a/common/clock.c
> +++ b/common/clock.c
> @@ -84,8 +84,7 @@ uint32_t clocksource_hz2mult(uint32_t hz, uint32_t shift_constant)
>  
>  int is_timeout(uint64_t start_ns, uint64_t time_offset_ns)
>  {
> -
> -	if (start_ns + time_offset_ns < get_time_ns())
> +	if ((int64_t)(start_ns + time_offset_ns - get_time_ns()) < 0)
>  		return 1;
>  	else
>  		return 0;
> -- 
> 1.7.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list