From: Jesper Juhl <jj@chaosbits.net>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-kernel@vger.kernel.org, Peter Oruba <peter.oruba@amd.com>,
Andreas Herrmann <andreas.herrmann3@amd.com>,
amd64-microcode@amd64.org
Subject: Re: [PATCH] AMD Microcode: Prefer vzalloc() over calls to vmalloc()+memset()
Date: Mon, 1 Nov 2010 20:23:23 +0100 (CET) [thread overview]
Message-ID: <alpine.LNX.2.00.1011012020500.12889@swampdragon.chaosbits.net> (raw)
In-Reply-To: <20101031100833.GA18633@liondog.tnic>
On Sun, 31 Oct 2010, Borislav Petkov wrote:
> On Sat, Oct 30, 2010 at 09:23:14PM +0200, Jesper Juhl wrote:
> > We don't have to do memset() ourselves after vmalloc() when we have
> > vzalloc(), so change that in
> > arch/x86/kernel/microcode_amd.c::get_next_ucode().
> >
> > Please CC me on replies.
> >
> >
> > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> > ---
> > compile tested only.
> >
> > microcode_amd.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
> > index e1af7c0..d46e805 100644
> > --- a/arch/x86/kernel/microcode_amd.c
> > +++ b/arch/x86/kernel/microcode_amd.c
> > @@ -183,9 +183,8 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
> > return NULL;
> > }
> >
> > - mc = vmalloc(UCODE_MAX_SIZE);
> > + mc = vzalloc(UCODE_MAX_SIZE);
> > if (mc) {
> > - memset(mc, 0, UCODE_MAX_SIZE);
> > if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR,
> > total_size)) {
> > vfree(mc);
>
> Good.
>
> Better yet, you can go a step further and remove one indentation block:
>
> --
> mc = vzalloc(UCODE_MAX_SIZE);
> if (!mc)
> goto out;
>
> if (get_ucode_data(mc, ...
> ...
>
> out:
> return mc;
>
> }
> --
> making the code even fit in 80 chars width and thus more readable.
>
> Thanks.
>
Thank you for the feedback I'll prepare a new version of the patch
incorporating it, then resend it.
One thing I'm not entirely sure about though is how to credit you with
your improment to my original patch. Would I simply prepend
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Borislav Petkov <bp@alien8.de>
or should I leave just my own Signed-off-by: and then mention you in the
changelog part of the mail or?
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Plain text mails only, please http://www.expita.com/nomime.html
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
next prev parent reply other threads:[~2010-11-01 19:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-30 19:23 [PATCH] AMD Microcode: Prefer vzalloc() over calls to vmalloc()+memset() Jesper Juhl
2010-10-31 10:08 ` Borislav Petkov
2010-11-01 19:23 ` Jesper Juhl [this message]
2010-11-01 21:27 ` Borislav Petkov
2010-11-01 21:44 ` [PATCH v2] " Jesper Juhl
2010-11-02 17:51 ` 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=alpine.LNX.2.00.1011012020500.12889@swampdragon.chaosbits.net \
--to=jj@chaosbits.net \
--cc=amd64-microcode@amd64.org \
--cc=andreas.herrmann3@amd.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.oruba@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.