Skip to content

Commit 36b92fb

Browse files
rveerama1ioannisg
authored andcommitted
net: ppp: Fix integer handling coverity issue
Store the time difference value in u32_t variable than abs() value in signed variable. Fixes #22912 Coverity CID: 208406 Signed-off-by: Ravi kumar Veeramally <[email protected]>
1 parent e4479e2 commit 36b92fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/net/l2/ppp/ppp_l2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,9 @@ static void echo_reply_handler(void *user_data, size_t user_data_len)
341341
{
342342
struct ppp_context *ctx = user_data;
343343
u32_t end_time = k_cycle_get_32();
344-
int time_diff;
344+
u32_t time_diff;
345345

346-
time_diff = abs(end_time - ctx->shell.echo_req_data);
346+
time_diff = end_time - ctx->shell.echo_req_data;
347347
ctx->shell.echo_req_data =
348348
k_cyc_to_ns_floor64(time_diff) / 1000;
349349

0 commit comments

Comments
 (0)