Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Feb 2024 21:11:01 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 7117d4b22f74 - stable/14 - LinuxKPI: implement memset_after()
Message-ID:  <202402182111.41ILB1YP012734@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=7117d4b22f747c692f3d033ef72fee527f890eb8

commit 7117d4b22f747c692f3d033ef72fee527f890eb8
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-01-29 14:19:59 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-02-18 16:41:17 +0000

    LinuxKPI: implement memset_after()
    
    memset_after() is needed by iwlwifi d3.c.
    
    Reviewed by:    emaste
    Differential Revision: https://reviews.freebsd.org/D43644
    
    (cherry picked from commit 2d9d35837d8ea3ee7d7447d63a8755d45ec2fd96)
---
 sys/compat/linuxkpi/common/include/linux/string.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
index 1d9b7af5d9d5..f745c2f6d343 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -265,4 +265,12 @@ memcpy_and_pad(void *dst, size_t dstlen, const void *src, size_t len, int ch)
 	memset(_ptr + _o, _c, sizeof(*(ptr)) - _o);			\
 })
 
+#define	memset_after(ptr, bytepat, smember)				\
+({									\
+	uint8_t *_ptr = (uint8_t *)(ptr);				\
+	int _c = (int)(bytepat);					\
+	size_t _o = offsetofend(typeof(*(ptr)), smember);		\
+	memset(_ptr + _o, _c, sizeof(*(ptr)) - _o);			\
+})
+
 #endif	/* _LINUXKPI_LINUX_STRING_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402182111.41ILB1YP012734>