From: Xiu Jianfeng <xiujianfeng@huawei.com>
To: <peterz@infradead.org>, <mingo@redhat.com>, <will@kernel.org>,
<longman@redhat.com>, <boqun.feng@gmail.com>
Cc: <wangweiyang2@huawei.com>, <linux-kernel@vger.kernel.org>,
<linux-hardening@vger.kernel.org>, <keescook@chromium.org>
Subject: [PATCH -next] lockdep: Use memset_startat() helper in reinit_class()
Date: Mon, 13 Dec 2021 21:26:18 +0800 [thread overview]
Message-ID: <20211213132618.105737-1-xiujianfeng@huawei.com> (raw)
use memset_startat() helper to simplify the code, there is no functional
change in this patch.
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
kernel/locking/lockdep.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 4a882f83aeb9..89b3df51fd98 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -6011,13 +6011,10 @@ static void zap_class(struct pending_free *pf, struct lock_class *class)
static void reinit_class(struct lock_class *class)
{
- void *const p = class;
- const unsigned int offset = offsetof(struct lock_class, key);
-
WARN_ON_ONCE(!class->lock_entry.next);
WARN_ON_ONCE(!list_empty(&class->locks_after));
WARN_ON_ONCE(!list_empty(&class->locks_before));
- memset(p + offset, 0, sizeof(*class) - offset);
+ memset_startat(class, 0, key);
WARN_ON_ONCE(!class->lock_entry.next);
WARN_ON_ONCE(!list_empty(&class->locks_after));
WARN_ON_ONCE(!list_empty(&class->locks_before));
--
2.17.1
next reply other threads:[~2021-12-13 13:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 13:26 Xiu Jianfeng [this message]
2021-12-13 14:32 ` [PATCH -next] lockdep: Use memset_startat() helper in reinit_class() Peter Zijlstra
2021-12-13 16:31 ` Waiman Long
2021-12-13 20:39 ` Kees Cook
2022-01-26 13:30 ` [tip: locking/core] " tip-bot2 for Xiu Jianfeng
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=20211213132618.105737-1-xiujianfeng@huawei.com \
--to=xiujianfeng@huawei.com \
--cc=boqun.feng@gmail.com \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=wangweiyang2@huawei.com \
--cc=will@kernel.org \
/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).