]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
utime.h: fix OVERFLOW_BEFORE_WIDEN
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 13 Mar 2015 16:21:02 +0000 (17:21 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Tue, 17 Mar 2015 08:19:40 +0000 (09:19 +0100)
CID 1274295 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
 overflow_before_widen: Potentially overflowing expression
 usec * 1000 with type int (32 bits, signed) is evaluated using
 32-bit arithmetic before being used in a context which expects
 an expression of type uint64_t (64 bits, unsigned).

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/include/utime.h

index 9ec0c48f70d41704504ff63db8b0b5056aa0dda7..9f1007be8a7ba848523c853f42ceafeaa75c53d2 100644 (file)
@@ -288,7 +288,7 @@ public:
       gmtime_r(&tt, &tm);
 
       if (nsec) {
-        *nsec = usec * 1000;
+        *nsec = (uint64_t)usec * 1000;
       }
     }
     time_t t = timegm(&tm);