qcacmn: Fix truncation issues due to typecast in QDF time APIs

Currently there is an issue wrt truncation in the __qdf_system_time_after()
& __qdf_system_time_after_eq() QDF APIs where the input system ticks
(jiffies) which are of type unsigned long are getting truncated due to
typecast to long before comparison. Due to this typecasting, there is
likelihood of a wrong comparison resulting in wrong actions being
taken in the caller.

Typecast the result of the comparison instead to fix this problem.

Change-Id: I4741d9606d9e3462b8dd4736e5612f4a3008000b
CRs-Fixed: 3591262
此提交包含在:
Manikanta Pubbisetty
2023-08-17 18:04:39 +05:30
提交者 Rahul Choudhary
父節點 b2de6ec785
當前提交 9d8d909ff1

查看文件

@@ -280,11 +280,11 @@ static inline void __qdf_mdelay(uint32_t msecs)
* @b: Time stamp value b
*
* Return:
* true if a < b else false
* true if a > b else false
*/
static inline bool __qdf_system_time_after(__qdf_time_t a, __qdf_time_t b)
{
return (long)(b) - (long)(a) < 0;
return (long)((b) - (a)) < 0;
}
/**
@@ -311,7 +311,7 @@ static inline bool __qdf_system_time_before(__qdf_time_t a, __qdf_time_t b)
*/
static inline bool __qdf_system_time_after_eq(__qdf_time_t a, __qdf_time_t b)
{
return (long)(a) - (long)(b) >= 0;
return (long)((a) - (b)) >= 0;
}
/**