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
This commit is contained in:

committed by
Rahul Choudhary

parent
b2de6ec785
commit
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user