[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211213132618.105737-1-xiujianfeng@huawei.com>
Date: Mon, 13 Dec 2021 21:26:18 +0800
From: Xiu Jianfeng <xiujianfeng@...wei.com>
To: <peterz@...radead.org>, <mingo@...hat.com>, <will@...nel.org>,
<longman@...hat.com>, <boqun.feng@...il.com>
CC: <wangweiyang2@...wei.com>, <linux-kernel@...r.kernel.org>,
<linux-hardening@...r.kernel.org>, <keescook@...omium.org>
Subject: [PATCH -next] lockdep: Use memset_startat() helper in reinit_class()
use memset_startat() helper to simplify the code, there is no functional
change in this patch.
Signed-off-by: Xiu Jianfeng <xiujianfeng@...wei.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
Powered by blists - more mailing lists