Skip to content

Commit

Permalink
stats: fixed implicit integer sign extension in stats_get_off()
Browse files Browse the repository at this point in the history
Introduced explicit casting for fixing static analyze issue.

fixes zephyrproject-rtos#39812

Signed-off-by: Andrzej Puzdrowski <[email protected]>
  • Loading branch information
nvlsianpu authored and nashif committed Oct 28, 2021
1 parent ec576a5 commit 87c1f9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/stats/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ stats_get_name(const struct stats_hdr *hdr, int idx)
static uint16_t
stats_get_off(const struct stats_hdr *hdr, int idx)
{
return sizeof(*hdr) + idx * hdr->s_size;
return (uint16_t) (sizeof(*hdr) + idx * (int) hdr->s_size);
}

/**
Expand Down

0 comments on commit 87c1f9a

Please sign in to comment.