Skip to content

Commit

Permalink
stats: fix Coverity CID :198875
Browse files Browse the repository at this point in the history
Issue was caused by pointer arithmetic.
This commit cast pointer of struct data to u8_t pointer
and makes arithmetic explicitly by adding the exact value.

fixes #16572

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
  • Loading branch information
nvlsianpu authored and nashif committed Jun 7, 2019
1 parent 5d57edd commit 9f7c2b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/stats/stats.c
Expand Up @@ -281,5 +281,5 @@ stats_init_and_reg(struct stats_hdr *shdr, u8_t size, u16_t cnt,
void
stats_reset(struct stats_hdr *hdr)
{
(void)memset(hdr + 1, 0, hdr->s_size * hdr->s_cnt);
(void)memset((u8_t *)hdr + sizeof(*hdr), 0, hdr->s_size * hdr->s_cnt);
}

0 comments on commit 9f7c2b6

Please sign in to comment.