mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
	JBeulich@suse.com, khali@linux-fr.org, tglx@linutronix.de,
	hpa@linux.intel.com
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/urgent] x86, cpufeature:   Catch duplicate CPU feature strings
Date: Tue, 26 Jun 2012 14:32:46 +0200	[thread overview]
Message-ID: <20120626143246.0c9bf301@endymion.delvare> (raw)
In-Reply-To: <tip-55f6cb9d0b364e7e8cb65b51193f5e4743c44fde@git.kernel.org>

On Mon, 25 Jun 2012 09:14:29 -0700, tip-bot for H. Peter Anvin wrote:
> Commit-ID:  55f6cb9d0b364e7e8cb65b51193f5e4743c44fde
> Gitweb:     http://git.kernel.org/tip/55f6cb9d0b364e7e8cb65b51193f5e4743c44fde
> Author:     H. Peter Anvin <hpa@linux.intel.com>
> AuthorDate: Fri, 22 Jun 2012 11:47:15 -0700
> Committer:  H. Peter Anvin <hpa@linux.intel.com>
> CommitDate: Mon, 25 Jun 2012 09:02:13 -0700
> 
> x86, cpufeature: Catch duplicate CPU feature strings
> 
> We had a case of duplicate CPU feature strings, a user space ABI
> violation, for almost two years.  Make it a build error so that
> doesn't happen again.
> 
> Link: http://lkml.kernel.org/r/4FE34BCB.5050305@linux.intel.com
> Cc: Jan Beulich <JBeulich@suse.com>
> Cc: Jean Delvare <khali@linux-fr.org>
> ---
>  arch/x86/kernel/cpu/mkcapflags.pl |   23 ++++++++++++++++++-----
>  1 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mkcapflags.pl b/arch/x86/kernel/cpu/mkcapflags.pl
> index dfea390..0c5b549 100644
> --- a/arch/x86/kernel/cpu/mkcapflags.pl
> +++ b/arch/x86/kernel/cpu/mkcapflags.pl
> @@ -11,22 +11,35 @@ open(OUT, "> $out\0") or die "$0: cannot create: $out: $!\n";
>  print OUT "#include <asm/cpufeature.h>\n\n";
>  print OUT "const char * const x86_cap_flags[NCAPINTS*32] = {\n";
>  
> +%features = ();
> +$err = 0;
> +
>  while (defined($line = <IN>)) {
>  	if ($line =~ /^\s*\#\s*define\s+(X86_FEATURE_(\S+))\s+(.*)$/) {
>  		$macro = $1;
> -		$feature = $2;
> +		$feature = "\L$2";
>  		$tail = $3;
>  		if ($tail =~ /\/\*\s*\"([^"]*)\".*\*\//) {
> -			$feature = $1;
> +			$feature = "\L$1";
>  		}
>  
> -		if ($feature ne '') {
> -			printf OUT "\t%-32s = \"%s\",\n",
> -				"[$macro]", "\L$feature";
> +		next if ($feature eq '');
> +
> +		if ($features{$feature}++) {
> +			print STDERR "$in: duplicate feature name: $feature\n";
> +			$err++;
>  		}
> +		printf OUT "\t%-32s = \"%s\",%s\n", "[$macro]", $feature;

You added an extra %s in the string, can't think of a good reason for
it. perl -w would have told you, I think we should add it.

Other than this, the code looks good and the improvement reasonable, so
you can add:

Acked-by: Jean Delvare <khali@linux-fr.org>

after fixing it.

>  	}
>  }
>  print OUT "};\n";
>  
>  close(IN);
>  close(OUT);
> +
> +if ($err) {
> +	unlink($out);
> +	exit(1);
> +}
> +
> +exit(0);


-- 
Jean Delvare

  reply	other threads:[~2012-06-26 12:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-21 14:28 [PATCH] x86, cpufeature: Fix duplicate feature name "dts" Jean Delvare
2012-06-21 16:28 ` H. Peter Anvin
2012-06-21 17:07   ` Jean Delvare
2012-06-21 18:06     ` H. Peter Anvin
2012-06-21 18:44       ` Borislav Petkov
2012-06-21 20:11         ` H. Peter Anvin
2012-06-22  6:59           ` Ingo Molnar
2012-06-22 18:01             ` H. Peter Anvin
2012-06-22 18:49               ` Guenter Roeck
2012-06-22  7:02   ` Jan Beulich
2012-06-22 13:38     ` H. Peter Anvin
2012-06-22 20:38   ` [tip:x86/urgent] x86, cpufeature: Rename X86_FEATURE_DTS to X86_FEATURE_DTHERM tip-bot for H. Peter Anvin
2012-06-24 19:49     ` Jean Delvare
2012-06-24 20:37       ` H. Peter Anvin
2012-06-26  9:13         ` Jean Delvare
2012-06-24 20:39       ` H. Peter Anvin
2012-06-24 20:59         ` H. Peter Anvin
2012-06-22 20:39   ` [tip:x86/urgent] x86, cpufeature: Catch duplicate CPU feature strings tip-bot for H. Peter Anvin
2012-06-25 16:13   ` [tip:x86/urgent] x86, cpufeature: Rename X86_FEATURE_DTS to X86_FEATURE_DTHERM tip-bot for H. Peter Anvin
2012-06-25 16:14   ` [tip:x86/urgent] x86, cpufeature: Catch duplicate CPU feature strings tip-bot for H. Peter Anvin
2012-06-26 12:32     ` Jean Delvare [this message]
2012-06-26 14:48       ` H. Peter Anvin
2012-06-26 15:20       ` [tip:x86/urgent] x86, cpufeature: Remove stray %s, add -w to mkcapflags.pl tip-bot for H. Peter Anvin

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=20120626143246.0c9bf301@endymion.delvare \
    --to=khali@linux-fr.org \
    --cc=JBeulich@suse.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®