Skip to contentSkip to conversation

kernel/events: using uninitialized variable: slots.flexible for arm cross-compiling

PATCH In review Chen Gang 1 participant 2 messages Feb 6, 2013 perf events

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 kernel/events: using uninitialized variable: slots.flexible for arm cross-compiling

for arm cross-compiling, in function __reserve_bp_slot:

slots.flexible may be used without initializing.

slots.flexible is not initialized when define it. it is as a parameter passed to fetch_bp_busy_slots. in function fetch_bp_busy_slots:
if bp->cpu < 0
slots->flexible will be used for comparing, firstly. that will cause issue.

building:
make EXTRA_CFLAGS=-W ARCH=arm
...
linux/kernel/events/hw_breakpoint.c:300:
warning: missing initializer
linux/kernel/events/hw_breakpoint.c:300:
warning: (near initialization for 'slots.flexible')
...

---
 kernel/events/hw_breakpoint.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/events/hw_breakpoint.c +1 -1
index fe8a916..ef69215 100644
@@ -297,7 +297,7 @@ __weak void arch_unregister_hw_breakpoint(struct perf_event *bp)
  */
 static int __reserve_bp_slot(struct perf_event *bp)
 {
-	struct bp_busy_slots slots = {0};
+	struct bp_busy_slots slots = {0, 0};
 	enum bp_type_idx type;
 	int weight;
 
Signature · 1 line
1.7.7.6
author
#1 lore raw

oh, sorry, it is my fault, please skip this patch.

gchen.

Quoted 41 lines · Chen Gang

for arm cross-compiling, in function __reserve_bp_slot:

slots.flexible may be used without initializing.

slots.flexible is not initialized when define it. it is as a parameter passed to fetch_bp_busy_slots. in function fetch_bp_busy_slots:
if bp->cpu < 0
slots->flexible will be used for comparing, firstly. that will cause issue.

building:
make EXTRA_CFLAGS=-W ARCH=arm
...
linux/kernel/events/hw_breakpoint.c:300:
warning: missing initializer
linux/kernel/events/hw_breakpoint.c:300:
warning: (near initialization for 'slots.flexible')
...

---
 kernel/events/hw_breakpoint.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/events/hw_breakpoint.c +1 -1
index fe8a916..ef69215 100644
@@ -297,7 +297,7 @@ __weak void arch_unregister_hw_breakpoint(struct perf_event *bp)
  */
 static int __reserve_bp_slot(struct perf_event *bp)
 {
-	struct bp_busy_slots slots = {0};
+	struct bp_busy_slots slots = {0, 0};
 	enum bp_type_idx type;
 	int weight;
 
Signature · 3 lines
Chen Gang

Asianux Corporation