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
#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)
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;
}