From: Ben Pfaff Date: Thu, 24 Jan 2013 21:50:39 +0000 (-0800) Subject: timeval: Avoid unnecessary integer overflow in time_alarm(). X-Git-Tag: sliver-openvswitch-1.10.90-1~11^2~90 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=75b0b752d8d70edcd08f18e1028d60537cdede85;p=sliver-openvswitch.git timeval: Avoid unnecessary integer overflow in time_alarm(). Durations longer than 4294967 seconds would unnecessarily overflow in the multiplication here. Found by Coverity. Signed-off-by: Ben Pfaff Acked-by: Ethan Jackson --- diff --git a/lib/timeval.c b/lib/timeval.c index d91305c67..ef9c8fe88 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -328,7 +328,7 @@ time_alarm(unsigned int secs) time_refresh(); now = time_msec(); - msecs = secs * 1000; + msecs = secs * 1000LL; block_sigalrm(&oldsigs); deadline = now < LLONG_MAX - msecs ? now + msecs : LLONG_MAX;