LinuxKPI: implement memzero_explicit()

Sponsored by:	The FreeBSD Foundation
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D44586

(cherry picked from commit 218b2ccf8cc90698487515c681f3e3453b0dcead)
This commit is contained in:
Bjoern A. Zeeb 2024-04-02 09:30:49 +00:00
parent 0af78fa479
commit 7a52baf280

View file

@ -273,4 +273,11 @@ memcpy_and_pad(void *dst, size_t dstlen, const void *src, size_t len, int ch)
memset(_ptr + _o, _c, sizeof(*(ptr)) - _o); \
})
static inline void
memzero_explicit(void *p, size_t s)
{
memset(p, 0, s);
__asm__ __volatile__("": :"r"(p) :"memory");
}
#endif /* _LINUXKPI_LINUX_STRING_H_ */