From: Ingo Molnar <mingo@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Jules Irenge <jbi.octave@gmail.com>,
tglx@linutronix.de, linux-kernel@vger.kernel.org, x86@kernel.org,
hpa@zytor.com, mingo@redhat.com
Subject: Re: [PATCH] cpu: microcode: Add comma to 0
Date: Wed, 27 Nov 2019 17:50:25 +0100 [thread overview]
Message-ID: <20191127165025.GA10957@gmail.com> (raw)
In-Reply-To: <20191127112613.GA3812@zn.tnic>
* Borislav Petkov <bp@alien8.de> wrote:
> On Wed, Nov 27, 2019 at 07:54:36AM +0100, Ingo Molnar wrote:
> >
> > * Jules Irenge <jbi.octave@gmail.com> wrote:
> >
> > > Add "," after 0
> > > Because memory for the struct is being cleared
> > > and elements after "," are missing on purpose
> > > as they are being cleared to
> > >
> > > Recommended by Boris Petkov
> > >
> > > Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> > > ---
> > > arch/x86/kernel/cpu/microcode/amd.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
> > > index a0e52bd00ecc..04ee649f4acb 100644
> > > --- a/arch/x86/kernel/cpu/microcode/amd.c
> > > +++ b/arch/x86/kernel/cpu/microcode/amd.c
> > > @@ -418,7 +418,7 @@ static int __apply_microcode_amd(struct microcode_amd *mc)
> > > static bool
> > > apply_microcode_early_amd(u32 cpuid_1_eax, void *ucode, size_t size, bool save_patch)
> > > {
> > > - struct cont_desc desc = { 0 };
> > > + struct cont_desc desc = { 0, };
> >
> > This is 100% unnecessary - " = { }" is enough of a structure initializer.
>
> That was my initial thought but empty initializers are not ISO C
> compliant, I've been told.
Yeah, but the kernel isn't ISO C, and the hive mind has spoken in favor
of the shortest variant:
dagon:~/tip> git grep '= { }' | wc -l
647
dagon:~/tip> git grep '= { 0, }' | wc -l
231
dagon:~/tip> git grep '= { NULL, }' | wc -l
38
:-)
Thanks,
Ingo
next prev parent reply other threads:[~2019-11-27 16:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 22:15 [PATCH] cpu: microcode: Add comma to 0 Jules Irenge
2019-11-27 6:54 ` Ingo Molnar
2019-11-27 11:26 ` Borislav Petkov
2019-11-27 16:50 ` Ingo Molnar [this message]
2019-11-27 17:15 ` Borislav Petkov
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=20191127165025.GA10957@gmail.com \
--to=mingo@kernel.org \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jbi.octave@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).