Skip to content
Permalink
Browse files

stats: fix Coverity CID :198875

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 5, 2019
1 parent 5d57edd commit 9f7c2b62d0fe5a9c6e0cccbc9debe481d3a783e3
Showing with 1 addition and 1 deletion.
  1. +1 −1 subsys/stats/stats.c
@@ -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.
You can’t perform that action at this time.