public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: jiasheng <jiasheng@iscas.ac.cn>
Cc: x86@kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 9/9] x86/microcode/amd: Add __list_del_entry_valid() in front of __list_del() in free_cache()
Date: Thu, 2 Sep 2021 10:38:14 +0200	[thread overview]
Message-ID: <YTCNdmeyq55UBPXK@zn.tnic> (raw)
In-Reply-To: <1630547122-3731091-1-git-send-email-jiasheng@iscas.ac.cn>

Hello,

On Thu, Sep 02, 2021 at 01:45:22AM +0000, jiasheng wrote:
> We have found that in the complied files __list_del()
> appear more than 100 times, and under at least 90% circumstances
> that __list_del_entry_valid() and __list_del() appear in pairs.
> For example, they appear together in the __list_del_entry()
> of the header file, 'include/linux/list.h'.
> But we have found that in the free_cache(), there is only
> __list_del() instead of the pair.
> Therefore, we consider that the __list_del_entry_valid()
> might be forgotten.

if this is how you're going to "analyze" whether something is amiss
in the code - by looking at how some other code does something, i.e.,
patterns - and not involve grey matter and actually *think* what you're
doing before doing it and what those functions do, your patches will
simply get ingored.

> Signed-off-by: jiasheng <jiasheng@iscas.ac.cn>

When you sign off on a patch, please give your full name.

> ---
>  arch/x86/kernel/cpu/microcode/amd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
> index 3d4a483..1987ee1 100644
> --- a/arch/x86/kernel/cpu/microcode/amd.c
> +++ b/arch/x86/kernel/cpu/microcode/amd.c
> @@ -626,6 +626,8 @@ static void free_cache(void)
>  	struct ucode_patch *p, *tmp;
>  
>  	list_for_each_entry_safe(p, tmp, &microcode_cache, plist) {
> +		if (!__list_del_entry_valid(p->plist))
> +			continue;
>  		__list_del(p->plist.prev, p->plist.next);
>  		kfree(p->data);
>  		kfree(p);
> -- 

Also, always CC lkml when submitting patches. CCed now.

Ok, it looks like you're a newbie to this - I'd suggest you read all of
this here:

https://www.kernel.org/doc/html/latest/process/index.html

to get acquainted with how this work is usually done and then try to fix
real bugs first.

HTH.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

       reply	other threads:[~2021-09-02  8:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1630547122-3731091-1-git-send-email-jiasheng@iscas.ac.cn>
2021-09-02  8:38 ` Borislav Petkov [this message]
2021-09-02  1:45 [PATCH 9/9] x86/microcode/amd: Add __list_del_entry_valid() in front of __list_del() in free_cache() jiasheng

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=YTCNdmeyq55UBPXK@zn.tnic \
    --to=bp@alien8.de \
    --cc=jiasheng@iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@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