mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Xiu Jianfeng <xiujianfeng@huawei.com>,
	peterz@infradead.org, mingo@redhat.com, will@kernel.org,
	boqun.feng@gmail.com
Cc: wangweiyang2@huawei.com, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org, keescook@chromium.org
Subject: Re: [PATCH -next] lockdep: Use memset_startat() helper in reinit_class()
Date: Mon, 13 Dec 2021 11:31:44 -0500	[thread overview]
Message-ID: <383e4f24-8165-7aab-40af-52340c09de46@redhat.com> (raw)
In-Reply-To: <20211213132618.105737-1-xiujianfeng@huawei.com>

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>


  parent reply	other threads:[~2021-12-13 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 13:26 Xiu Jianfeng
2021-12-13 14:32 ` Peter Zijlstra
2021-12-13 16:31 ` Waiman Long [this message]
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=383e4f24-8165-7aab-40af-52340c09de46@redhat.com \
    --to=longman@redhat.com \
    --cc=boqun.feng@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=wangweiyang2@huawei.com \
    --cc=will@kernel.org \
    --cc=xiujianfeng@huawei.com \
    /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

all inboxes | Powered by JetHome®