sys/util: Stricter bytecpy impl

The docstring for this function states that it is guaranteed to perform
a copy byte by byte, but this is not true in general without a
`volatile` storage type on the casted pointer.

Signed-off-by: Chris McDonald <cjmcdonald@chromium.org>
This commit is contained in:
Chris McDonald 2021-11-24 13:11:51 -07:00 committed by Anas Nashif
commit f882d43b56

View file

@ -253,7 +253,7 @@ static inline void bytecpy(void *dst, const void *src, size_t size)
size_t i;
for (i = 0; i < size; ++i) {
((uint8_t *)dst)[i] = ((const uint8_t *)src)[i];
((volatile uint8_t *)dst)[i] = ((volatile const uint8_t *)src)[i];
}
}