LinuxKPI: implement memzero_explicit()

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D44586
This commit is contained in:
Bjoern A. Zeeb 2024-04-02 09:30:49 +00:00
parent a1cdddcf15
commit 218b2ccf8c

View file

@ -289,4 +289,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_ */