Skip to contentSkip to conversation

tools lib traceevent: Fix conversion of pointer to integer of different size

tip:perf/urgent tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Nov 20, 2013

lore
Share & tools
lore
#0 lore raw
Commit-ID:  6b5fa0ba4f85a8499287aefaf3f1375450c40c6d
Gitweb:     http://git.kernel.org/tip/6b5fa0ba4f85a8499287aefaf3f1375450c40c6d
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 19 Nov 2013 16:14:51 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 19 Nov 2013 16:37:59 -0300

tools lib traceevent: Fix conversion of pointer to integer of different size

gcc complaint on 32-bit system:

/home/acme/git/linux/tools/lib/traceevent/event-parse.c: In function ‘eval_num_arg’:
/home/acme/git/linux/tools/lib/traceevent/event-parse.c:3468:9: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

This is because the eval_num_arg returns everything as an 'unsigned long long', so it converts a void pointer to a wider integer, fix it by converting the void pointer to an integer of the same size, 'unsigned long', before casting it to 'unsigned long long'.

Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/lib/traceevent/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/traceevent/event-parse.c +1 -1
index 8a5b65d..217c82e 100644
@@ -3465,7 +3465,7 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
 		 * is in the bottom half of the 32 bit field.
 		 */
 		offset &= 0xffff;
-		val = (unsigned long long)(data + offset);
+		val = (unsigned long long)((unsigned long)data + offset);
 		break;
 	default: /* not sure what to do there */
 		return 0;