* [PATCH -next] lockdep: Use memset_startat() helper in reinit_class()
@ 2021-12-13 13:26 Xiu Jianfeng
2021-12-13 14:32 ` Peter Zijlstra
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Xiu Jianfeng @ 2021-12-13 13:26 UTC (permalink / raw)
To: peterz, mingo, will, longman, boqun.feng
Cc: wangweiyang2, linux-kernel, linux-hardening, keescook
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next] lockdep: Use memset_startat() helper in reinit_class()
2021-12-13 13:26 [PATCH -next] lockdep: Use memset_startat() helper in reinit_class() Xiu Jianfeng
@ 2021-12-13 14:32 ` Peter Zijlstra
2021-12-13 16:31 ` Waiman Long
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2021-12-13 14:32 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: mingo, will, longman, boqun.feng, wangweiyang2, linux-kernel,
linux-hardening, keescook
On Mon, Dec 13, 2021 at 09:26:18PM +0800, Xiu Jianfeng wrote:
> use memset_startat() helper to simplify the code, there is no functional
> change in this patch.
>
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] lockdep: Use memset_startat() helper in reinit_class()
2021-12-13 13:26 [PATCH -next] lockdep: Use memset_startat() helper in reinit_class() Xiu Jianfeng
2021-12-13 14:32 ` 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
3 siblings, 0 replies; 5+ messages in thread
From: Waiman Long @ 2021-12-13 16:31 UTC (permalink / raw)
To: Xiu Jianfeng, peterz, mingo, will, boqun.feng
Cc: wangweiyang2, linux-kernel, linux-hardening, keescook
On 12/13/21 08:26, Xiu Jianfeng wrote:
> 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));
LGTM
Acked-by: Waiman Long <longman@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] lockdep: Use memset_startat() helper in reinit_class()
2021-12-13 13:26 [PATCH -next] lockdep: Use memset_startat() helper in reinit_class() Xiu Jianfeng
2021-12-13 14:32 ` 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
3 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2021-12-13 20:39 UTC (permalink / raw)
To: Xiu Jianfeng
Cc: peterz, mingo, will, longman, boqun.feng, wangweiyang2,
linux-kernel, linux-hardening
On Mon, Dec 13, 2021 at 09:26:18PM +0800, Xiu Jianfeng wrote:
> use memset_startat() helper to simplify the code, there is no functional
> change in this patch.
>
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: locking/core] lockdep: Use memset_startat() helper in reinit_class()
2021-12-13 13:26 [PATCH -next] lockdep: Use memset_startat() helper in reinit_class() Xiu Jianfeng
` (2 preceding siblings ...)
2021-12-13 20:39 ` Kees Cook
@ 2022-01-26 13:30 ` tip-bot2 for Xiu Jianfeng
3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Xiu Jianfeng @ 2022-01-26 13:30 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Xiu Jianfeng, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the locking/core branch of tip:
Commit-ID: e204193b138af347fbbbe026e68cb3385112f387
Gitweb: https://git.kernel.org/tip/e204193b138af347fbbbe026e68cb3385112f387
Author: Xiu Jianfeng <xiujianfeng@huawei.com>
AuthorDate: Mon, 13 Dec 2021 21:26:18 +08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 25 Jan 2022 22:30:27 +01:00
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@huawei.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20211213132618.105737-1-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 4a882f8..89b3df5 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));
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-26 13:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 13:26 [PATCH -next] lockdep: Use memset_startat() helper in reinit_class() Xiu Jianfeng
2021-12-13 14:32 ` 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
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).