Skip to content

Commit

Permalink
net: ppp: Fix integer handling coverity issue
Browse files Browse the repository at this point in the history
Store the time difference value in u32_t variable than
abs() value in signed variable.

Fixes zephyrproject-rtos#22912
Coverity CID: 208406

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
  • Loading branch information
rveerama1 committed Feb 21, 2020
1 parent cee1954 commit 93ff194
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/net/l2/ppp/ppp_l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ static void echo_reply_handler(void *user_data, size_t user_data_len)
{
struct ppp_context *ctx = user_data;
u32_t end_time = k_cycle_get_32();
int time_diff;
u32_t time_diff;

time_diff = abs(end_time - ctx->shell.echo_req_data);
time_diff = end_time - ctx->shell.echo_req_data;
ctx->shell.echo_req_data =
k_cyc_to_ns_floor64(time_diff) / 1000;

Expand Down

0 comments on commit 93ff194

Please sign in to comment.