backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: backports@vger.kernel.org
Cc: nbd@nbd.name, Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 12/38] backports: add memset_after/memset_startat
Date: Tue, 11 Oct 2022 23:04:20 +0200	[thread overview]
Message-ID: <20221011230356.04e4d975f11d.I22eae0fdc7b78cf10a7dee6fe477fbf0c9a5e807@changeid> (raw)
In-Reply-To: <20221011210446.144768-1-johannes@sipsolutions.net>

From: Johannes Berg <johannes.berg@intel.com>

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 backport/backport-include/linux/string.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/backport/backport-include/linux/string.h b/backport/backport-include/linux/string.h
index 39257e5f66ab..dc29dcf72b24 100644
--- a/backport/backport-include/linux/string.h
+++ b/backport/backport-include/linux/string.h
@@ -12,4 +12,24 @@ extern void *memdup_user_nul(const void __user *, size_t);
 int match_string(const char * const *array, size_t n, const char *string);
 #endif /* LINUX_VERSION_IS_LESS(4,5,0) */
 
+#ifndef memset_after
+#define memset_after(obj, v, member)					\
+({									\
+	u8 *__ptr = (u8 *)(obj);					\
+	typeof(v) __val = (v);						\
+	memset(__ptr + offsetofend(typeof(*(obj)), member), __val,	\
+	       sizeof(*(obj)) - offsetofend(typeof(*(obj)), member));	\
+})
+#endif
+
+#ifndef memset_startat
+#define memset_startat(obj, v, member)					\
+({									\
+	u8 *__ptr = (u8 *)(obj);					\
+	typeof(v) __val = (v);						\
+	memset(__ptr + offsetof(typeof(*(obj)), member), __val,		\
+	       sizeof(*(obj)) - offsetof(typeof(*(obj)), member));	\
+})
+#endif
+
 #endif /* __BACKPORT_LINUX_STRING_H */
-- 
2.37.3

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  parent reply	other threads:[~2022-10-11 21:05 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 21:04 [PATCH 00/38] backports updates Johannes Berg
2022-10-11 21:04 ` [PATCH 01/38] backport: update pv trace fixes patch Johannes Berg
2022-10-11 21:04 ` [PATCH 02/38] backport: implement NLA_POLICY_RANGE for NLA_BINARY Johannes Berg
2022-10-11 21:04 ` [PATCH 03/38] backports: bpgit: handle copied files properly in status() Johannes Berg
2022-10-11 21:04 ` [PATCH 04/38] backport: add dev_sw_netstats_tx/rx_add() functions Johannes Berg
2022-10-11 21:04 ` [PATCH 05/38] backport: include kcov.h in sched.h for kernels < v4.10 Johannes Berg
2022-10-11 21:04 ` [PATCH 06/38] backports: increase cfg80211 wiphy padding Johannes Berg
2022-10-11 21:04 ` [PATCH 07/38] backport: remove aql_disable debugfs for < v4.10 Johannes Berg
2022-10-11 21:04 ` [PATCH 08/38] backport: update iwl-debug patch Johannes Berg
2022-10-11 21:04 ` [PATCH 09/38] main: add module_exit() Johannes Berg
2022-10-11 21:04 ` [PATCH 10/38] backports: add kthread.h Johannes Berg
2022-10-11 21:04 ` [PATCH 11/38] backports: stub structs but remove ndo_fill_forward_path Johannes Berg
2022-10-12  8:18   ` Felix Fietkau
2022-10-12  8:50     ` Johannes Berg
2022-10-11 21:04 ` Johannes Berg [this message]
2022-10-11 21:04 ` [PATCH 13/38] backports: add ktime_get_coarse_boottime_ns Johannes Berg
2022-10-11 21:04 ` [PATCH 14/38] patches: add spatch to adjust to changed ethtool ringparam API Johannes Berg
2022-10-11 21:04 ` [PATCH 15/38] backport: update 0099-netlink-range patch to apply on v5.18-rc1 Johannes Berg
2022-10-11 21:04 ` [PATCH 16/38] backports: add DMI_OEM_STRING for older kernels Johannes Berg
2022-10-11 21:04 ` [PATCH 17/38] backports: define __is_constexpr() " Johannes Berg
2022-10-11 21:04 ` [PATCH 18/38] backports: update x509.asn1.[ch] Johannes Berg
2022-10-11 21:04 ` [PATCH 19/38] backports: update mac80211-status.patch to v6.0-rc1 Johannes Berg
2022-10-11 21:04 ` [PATCH 20/38] backports: add linux/efi.h Johannes Berg
2022-10-11 21:04 ` [PATCH 21/38] backports: add eth_hw_addr_set() Johannes Berg
2022-10-11 21:04 ` [PATCH 22/38] backports: add module namespace support Johannes Berg
2022-10-11 21:04 ` [PATCH 23/38] backports: add lockdep_is_held() when needed Johannes Berg
2022-10-11 21:04 ` [PATCH 24/38] backports: add netif_rx() Johannes Berg
2022-10-11 21:04 ` [PATCH 25/38] backports: add rfkill_soft_blocked() Johannes Berg
2022-10-11 21:04 ` [PATCH 26/38] backports: add skb_postpush_rcsum() Johannes Berg
2022-10-11 21:04 ` [PATCH 27/38] backports: add skb_list_del_init() Johannes Berg
2022-10-11 21:04 ` [PATCH 28/38] backports: update skb kcov ifdef Johannes Berg
2022-10-11 21:04 ` [PATCH 29/38] backports: add DECLARE_FLEX_ARRAY() Johannes Berg
2022-10-11 21:04 ` [PATCH 30/38] backports: add skb_get_dsfield() Johannes Berg
2022-10-11 21:04 ` [PATCH 31/38] backports: add NLA_POLICY_MIN_LEN() Johannes Berg
2022-10-11 21:04 ` [PATCH 32/38] backports: add netlink length validation for 13 Johannes Berg
2022-10-11 21:04 ` [PATCH 33/38] backports: add mul_u64_u64_div_u64() Johannes Berg
2022-10-11 21:04 ` [PATCH 34/38] backports: add id_2 argument to find_asymmetric_key() Johannes Berg
2022-10-11 21:04 ` [PATCH 35/38] backports: don't backport some SKB functions for RHEL 7.6 Johannes Berg
2022-10-11 21:04 ` [PATCH 36/38] backports: use kernel verification only if CONFIG_CRYPTO_HASH_INFO Johannes Berg
2022-10-11 21:04 ` [PATCH 37/38] backports: add thermal_zone_device_enable() Johannes Berg
2022-10-11 21:04 ` [PATCH 38/38] backports: add virtio_reset_device Johannes Berg
2022-10-19 20:53 ` [PATCH 00/38] backports updates Hauke Mehrtens
2022-10-20  7:23   ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221011230356.04e4d975f11d.I22eae0fdc7b78cf10a7dee6fe477fbf0c9a5e807@changeid \
    --to=johannes@sipsolutions.net \
    --cc=backports@vger.kernel.org \
    --cc=johannes.berg@intel.com \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).