Subject: [PATCH 1/2] kdbus: Fix the overflow for timeout calculation 76/80576/1 accepted/tizen/common/20160719.172514 accepted/tizen/ivi/20160719.060824 accepted/tizen/mobile/20160719.060828 accepted/tizen/tv/20160719.060817 accepted/tizen/wearable/20160719.060814 submit/tizen/20160719.020831
authorINSUN PYO <insun.pyo@samsung.com>
Tue, 19 Jul 2016 01:55:58 +0000 (10:55 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Tue, 19 Jul 2016 01:59:14 +0000 (10:59 +0900)
The maximum value of unsigned long is 4294967295 which is too small
for storing nano second. It makes the overflow in calculation.

Use LLU instead of LU for timeout calculation.

======================================================================

Subject: [PATCH 2/2] kdbus: adjust the default value for timeout to 50 sec

This definition is used by the default value for timeout value.
But in the other places, 50 sec is used by default value for timeout,
instead of using it.

Let's align it with the others.

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: I9fb9839a311daf0c5839c87cdde793c2a4118869

gio/gkdbus.c

index d72f43a..3e85ffb 100755 (executable)
@@ -63,7 +63,7 @@
 #include "gunixfdmessage.h"
 
 #define KDBUS_MSG_MAX_SIZE         8192
-#define KDBUS_DEFAULT_TIMEOUT_NS   5000000000LU
+#define KDBUS_DEFAULT_TIMEOUT_NS   50000000000LLU
 #define KDBUS_POOL_SIZE            (16 * 1024LU * 1024LU)
 #define KDBUS_MEMFD_THRESHOLD      (512 * 1024LU)
 #define KDBUS_ALIGN8(l)            (((l) + 7) & ~7)
@@ -3276,7 +3276,7 @@ _g_kdbus_send (GKDBusWorker  *worker,
   if ((msg->flags) & KDBUS_MSG_EXPECT_REPLY)
     {
       if (timeout_msec != -1)
-        msg->timeout_ns = 1000LU * g_get_monotonic_time() + (timeout_msec * 1000000LU);
+        msg->timeout_ns = 1000LU * g_get_monotonic_time() + (timeout_msec * 1000000LLU);
       else
         msg->timeout_ns = 1000LU * g_get_monotonic_time() + KDBUS_DEFAULT_TIMEOUT_NS;
     }