Skip to contentSkip to conversation

FRV: Fix no-hardware-breakpoint case

PATCH In review David Howells 3 participants 3 messages Dec 14, 2009 – Dec 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 FRV: Fix no-hardware-breakpoint case

If there is no hardware breakpoint support, modify_user_hw_breakpoint() tries to return a NULL pointer through as an 'int' return value:

In file included from kernel/exit.c:53:
include/linux/hw_breakpoint.h: In function 'modify_user_hw_breakpoint':
include/linux/hw_breakpoint.h:96: warning: return makes integer from pointer without a cast

Return 0 instead.

---

 include/linux/hw_breakpoint.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/hw_breakpoint.h +1 -1
index 69f07a9..e268388 100644
@@ -93,7 +93,7 @@ register_user_hw_breakpoint(struct perf_event_attr *attr,
 			    struct task_struct *tsk)	{ return NULL; }
 static inline int
 modify_user_hw_breakpoint(struct perf_event *bp,
-			  struct perf_event_attr *attr)	{ return NULL; }
+			  struct perf_event_attr *attr)	{ return 0; }
 static inline struct perf_event *
 register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
 				perf_overflow_handler_t	 triggered,
#1 lore raw
Quoted 10 lines · David Howells

If there is no hardware breakpoint support, modify_user_hw_breakpoint() tries to return a NULL pointer through as an 'int' return value:

In file included from kernel/exit.c:53:
include/linux/hw_breakpoint.h: In function 'modify_user_hw_breakpoint':
include/linux/hw_breakpoint.h:96: warning: return makes integer from pointer without a cast

Return 0 instead.

Thanks, we have this fixed in tip:/perf/urgent already. It should reach upstream soon.

#2 lore raw
In reply to David Howells
Quoted 21 lines · David Howells

If there is no hardware breakpoint support, modify_user_hw_breakpoint() tries to return a NULL pointer through as an 'int' return value:

In file included from kernel/exit.c:53:
include/linux/hw_breakpoint.h: In function 'modify_user_hw_breakpoint':
include/linux/hw_breakpoint.h:96: warning: return makes integer from pointer without a cast

Return 0 instead.

---

 include/linux/hw_breakpoint.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/hw_breakpoint.h +0 -0
index 69f07a9..e268388 100644

include/linux/hw_breakpoint.h register_user_hw_breakpoint(struct perf_event_attr *attr, · line 96

Quoted 5 lines
include/linux/hw_breakpoint.h +1 -1
@@ -93,7 +93,7 @@ register_user_hw_breakpoint(struct perf_event_attr *attr,
 			    struct task_struct *tsk)	{ return NULL; }
 static inline int
 modify_user_hw_breakpoint(struct perf_event *bp,
-			  struct perf_event_attr *attr)	{ return NULL; }
+			  struct perf_event_attr *attr)	{ return 0; }

Note, this patch is wrong as it only papers over the warning without understanding the underlying bug: the right fix is to return an error code.

The latest perf update has the right fix - AFAICS Linus did the conflict resolution correctly so upstream should be fine.

Ingo