[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1011012020500.12889@swampdragon.chaosbits.net>
Date: Mon, 1 Nov 2010 20:23:23 +0100 (CET)
From: Jesper Juhl <jj@...osbits.net>
To: Borislav Petkov <bp@...en8.de>
cc: linux-kernel@...r.kernel.org, Peter Oruba <peter.oruba@....com>,
Andreas Herrmann <andreas.herrmann3@....com>,
amd64-microcode@...64.org
Subject: Re: [PATCH] AMD Microcode: Prefer vzalloc() over calls to
vmalloc()+memset()
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@...osbits.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@...osbits.net>
Signed-off-by: Borislav Petkov <bp@...en8.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@...osbits.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists