The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Thomas Meyer <thomas@m3y3r.de>
Cc: herrmann.der.user@googlemail.com, tglx@linutronix.de,
	mingo@redhat.com, hpa@zytor.com, x86@kernel.org,
	amd64-microcode@amd64.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86, microcode, AMD: Cocci spatch "memdup.spatch"
Date: Sun, 2 Jun 2013 12:21:37 +0200	[thread overview]
Message-ID: <20130602102137.GA3441@nazgul.tnic> (raw)
In-Reply-To: <1370079731.29224.12.camel@localhost.localdomain>

On Sat, Jun 01, 2013 at 11:42:11AM +0200, Thomas Meyer wrote:
> 
> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
> --- a/arch/x86/kernel/microcode_amd.c
> +++ b/arch/x86/kernel/microcode_amd.c
> @@ -345,7 +345,7 @@ static int verify_and_add_patch(unsigned
>  		return -EINVAL;
>  	}
>  
> -	patch->data = kzalloc(patch_size, GFP_KERNEL);
> +	patch->data = kmemdup(fw + SECTION_HDR_SIZE, patch_size, GFP_KERNEL);
>  	if (!patch->data) {
>  		pr_err("Patch data allocation failure.\n");
>  		kfree(patch);
> @@ -353,7 +353,6 @@ static int verify_and_add_patch(unsigned
>  	}
>  
>  	/* All looks ok, copy patch... */
> -	memcpy(patch->data, fw + SECTION_HDR_SIZE, patch_size);
>  	INIT_LIST_HEAD(&patch->plist);
>  	patch->patch_id  = mc_hdr->patch_id;
>  	patch->equiv_cpu = proc_id;

I can see what happens with a little code browsing of the definition of
kmemdup but patches without a commit message are most times not a very
elegant thing.

So please add a nice commit message explaining why you're doing what
you're doing. If the coccinelle script is not in the kernel tree,
then referring to it doesn't mean a whole lot so don't do it. Rather,
explaining why you're doing the change, is a much better thing to do.

Thanks.

      reply	other threads:[~2013-06-02 10:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01  9:42 [PATCH] x86, microcode, AMD: Cocci spatch "memdup.spatch" Thomas Meyer
2013-06-02 10:21 ` Borislav Petkov [this message]

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=20130602102137.GA3441@nazgul.tnic \
    --to=bp@alien8.de \
    --cc=amd64-microcode@amd64.org \
    --cc=herrmann.der.user@googlemail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas@m3y3r.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