The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] [TRIVIAL] FIX: unintended variable name reuse
@ 2013-04-05 16:17 Jan-Simon Möller
  2013-04-05 17:08 ` PaX Team
  0 siblings, 1 reply; 4+ messages in thread
From: Jan-Simon Möller @ 2013-04-05 16:17 UTC (permalink / raw)
  To: trivial, linux-kernel, pageexec

Cleanup a variable name reuse. 


Fix suggested by PaX Team <pageexec@freemail.hu>
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
---
 arch/x86/kernel/cpu/perf_event_intel_uncore.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c 
b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index b43200d..4c783be 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2428,7 +2428,7 @@ static void __init uncore_types_exit(struct 
intel_uncore_type **types)
 static int __init uncore_type_init(struct intel_uncore_type *type)
 {
 	struct intel_uncore_pmu *pmus;
-	struct attribute_group *events_group;
+	struct attribute_group *attr_group;
 	struct attribute **attrs;
 	int i, j;
 
@@ -2455,19 +2455,19 @@ static int __init uncore_type_init(struct 
intel_uncore_type *type)
 		while (type->event_descs[i].attr.attr.name)
 			i++;
 
-		events_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
-					sizeof(*events_group), GFP_KERNEL);
-		if (!events_group)
+		attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
+					sizeof(*attr_group), GFP_KERNEL);
+		if (!attr_group)
 			goto fail;
 
-		attrs = (struct attribute **)(events_group + 1);
-		events_group->name = "events";
-		events_group->attrs = attrs;
+		attrs = (struct attribute **)(attr_group + 1);
+		attr_group->name = "events";
+		attr_group->attrs = attrs;
 
 		for (j = 0; j < i; j++)
 			attrs[j] = &type->event_descs[j].attr.attr;
 
-		type->events_group = events_group;
+		type->events_group = attr_group;
 	}
 
 	type->pmu_group = &uncore_pmu_attr_group;
-- 
1.8.1.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] [TRIVIAL] FIX: unintended variable name reuse
  2013-04-05 16:17 [PATCH] [TRIVIAL] FIX: unintended variable name reuse Jan-Simon Möller
@ 2013-04-05 17:08 ` PaX Team
  0 siblings, 0 replies; 4+ messages in thread
From: PaX Team @ 2013-04-05 17:08 UTC (permalink / raw)
  To: trivial, linux-kernel, Jan-Simon Möller

On 5 Apr 2013 at 18:17, Jan-Simon Möller wrote:

> Cleanup a variable name reuse. 
> 
> 
> Fix suggested by PaX Team <pageexec@freemail.hu>

Reviewed-by: PaX Team <pageexec@freemail.hu>

> Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
> ---
>  arch/x86/kernel/cpu/perf_event_intel_uncore.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] [TRIVIAL] FIX: unintended variable name reuse
@ 2013-04-30 10:02 dl9pf
  2013-04-30 13:04 ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: dl9pf @ 2013-04-30 10:02 UTC (permalink / raw)
  To: dl9pf
  Cc: tglx, hpa, rostedt, a.p.zijlstra, paulus, mingo, acme, x86,
	linux-kernel

From: Jan-Simon Möller <dl9pf@gmx.de>

The variable name events_group is already in used and led to a compilation error
when using clang to build the Linux Kernel . The fix is just to rename the var.
No functional change. Please apply.

Fix suggested in discussion by PaX Team <pageexec@freemail.hu>
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>

CC: tglx@linutronix.de
CC: hpa@zytor.com
CC: rostedt@goodmis.org
CC: a.p.zijlstra@chello.nl
CC: paulus@samba.org
CC: mingo@redhat.com
CC: acme@ghostprotocols.net
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
---
 arch/x86/kernel/cpu/perf_event_intel_uncore.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index d0f9e5a..c01d159 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -3093,7 +3093,7 @@ static void __init uncore_types_exit(struct intel_uncore_type **types)
 static int __init uncore_type_init(struct intel_uncore_type *type)
 {
 	struct intel_uncore_pmu *pmus;
-	struct attribute_group *events_group;
+	struct attribute_group *attr_group;
 	struct attribute **attrs;
 	int i, j;
 
@@ -3120,19 +3120,19 @@ static int __init uncore_type_init(struct intel_uncore_type *type)
 		while (type->event_descs[i].attr.attr.name)
 			i++;
 
-		events_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
-					sizeof(*events_group), GFP_KERNEL);
-		if (!events_group)
+		attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
+					sizeof(*attr_group), GFP_KERNEL);
+		if (!attr_group)
 			goto fail;
 
-		attrs = (struct attribute **)(events_group + 1);
-		events_group->name = "events";
-		events_group->attrs = attrs;
+		attrs = (struct attribute **)(attr_group + 1);
+		attr_group->name = "events";
+		attr_group->attrs = attrs;
 
 		for (j = 0; j < i; j++)
 			attrs[j] = &type->event_descs[j].attr.attr;
 
-		type->events_group = events_group;
+		type->events_group = attr_group;
 	}
 
 	type->pmu_group = &uncore_pmu_attr_group;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] [TRIVIAL] FIX: unintended variable name reuse
  2013-04-30 10:02 dl9pf
@ 2013-04-30 13:04 ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2013-04-30 13:04 UTC (permalink / raw)
  To: dl9pf; +Cc: tglx, hpa, a.p.zijlstra, paulus, mingo, acme, x86, linux-kernel

On Tue, 2013-04-30 at 12:02 +0200, dl9pf@gmx.de wrote:
> From: Jan-Simon Möller <dl9pf@gmx.de>
> 
> The variable name events_group is already in used and led to a compilation error
> when using clang to build the Linux Kernel . The fix is just to rename the var.
> No functional change. Please apply.

Need to be a little more specific on the problem in the change log. I'm
guessing that the issue is with the events_group define in
perf_event_intel_uncore.h:

#define events_group attr_groups[2]

I can see that causing issues with something like:

	struct attribute_group *events_group;

I don't think we really want that to end up being:

	struct attribute_group *attr_groups[2];

I'm surprised gcc allowed that :-/

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> 
> Fix suggested in discussion by PaX Team <pageexec@freemail.hu>
> Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
> 
> CC: tglx@linutronix.de
> CC: hpa@zytor.com
> CC: rostedt@goodmis.org
> CC: a.p.zijlstra@chello.nl
> CC: paulus@samba.org
> CC: mingo@redhat.com
> CC: acme@ghostprotocols.net
> CC: x86@kernel.org
> CC: linux-kernel@vger.kernel.org
> ---
>  arch/x86/kernel/cpu/perf_event_intel_uncore.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> index d0f9e5a..c01d159 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
> @@ -3093,7 +3093,7 @@ static void __init uncore_types_exit(struct intel_uncore_type **types)
>  static int __init uncore_type_init(struct intel_uncore_type *type)
>  {
>  	struct intel_uncore_pmu *pmus;
> -	struct attribute_group *events_group;
> +	struct attribute_group *attr_group;
>  	struct attribute **attrs;
>  	int i, j;
>  
> @@ -3120,19 +3120,19 @@ static int __init uncore_type_init(struct intel_uncore_type *type)
>  		while (type->event_descs[i].attr.attr.name)
>  			i++;
>  
> -		events_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
> -					sizeof(*events_group), GFP_KERNEL);
> -		if (!events_group)
> +		attr_group = kzalloc(sizeof(struct attribute *) * (i + 1) +
> +					sizeof(*attr_group), GFP_KERNEL);
> +		if (!attr_group)
>  			goto fail;
>  
> -		attrs = (struct attribute **)(events_group + 1);
> -		events_group->name = "events";
> -		events_group->attrs = attrs;
> +		attrs = (struct attribute **)(attr_group + 1);
> +		attr_group->name = "events";
> +		attr_group->attrs = attrs;
>  
>  		for (j = 0; j < i; j++)
>  			attrs[j] = &type->event_descs[j].attr.attr;
>  
> -		type->events_group = events_group;
> +		type->events_group = attr_group;
>  	}
>  
>  	type->pmu_group = &uncore_pmu_attr_group;



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-30 13:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-05 16:17 [PATCH] [TRIVIAL] FIX: unintended variable name reuse Jan-Simon Möller
2013-04-05 17:08 ` PaX Team
  -- strict thread matches above, loose matches on Subject: below --
2013-04-30 10:02 dl9pf
2013-04-30 13:04 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox