The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=218b2ccf8cc90698487515c681f3e3453b0dcead

commit 218b2ccf8cc90698487515c681f3e3453b0dcead
Author:     Bjoern A. Zeeb <b...@freebsd.org>
AuthorDate: 2024-04-02 09:30:49 +0000
Commit:     Bjoern A. Zeeb <b...@freebsd.org>
CommitDate: 2024-04-12 23:09:19 +0000

    LinuxKPI: implement memzero_explicit()
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D44586
---
 sys/compat/linuxkpi/common/include/linux/string.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/string.h 
b/sys/compat/linuxkpi/common/include/linux/string.h
index 1365b7d7823a..9e1818a38594 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -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_ */

Reply via email to