Skip to content

Commit 0e9e79a

Browse files
mrutland-armacmel
authored andcommitted
tools lib traceevent: fix pointer-integer size mismatch
The scsi and cfg80211 plugins cast between unsigned long long and pointers, which is problematic for architectures where unsigned long long is wider than the native pointer size: linux/tools/lib/traceevent/plugin_scsi.c: In function ‘process_scsi_trace_parse_cdb’: linux/tools/lib/traceevent/plugin_scsi.c:408:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] scsi_trace_parse_cdb(s, (unsigned char *) args[1], args[2]); linux/tools/lib/traceevent/plugin_cfg80211.c: In function ‘process___le16_to_cpup’: linux/tools/lib/traceevent/plugin_cfg80211.c:11:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] uint16_t *val = (uint16_t *) args[0]; This patch adds an intermediate cast to unsigned long, silencing the warning. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Will Deacon <will.deacon@arm.com> Link: http://lkml.kernel.org/r/1389782648-4417-3-git-send-email-mark.rutland@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent f39056f commit 0e9e79a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/lib/traceevent/plugin_cfg80211.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static unsigned long long
88
process___le16_to_cpup(struct trace_seq *s,
99
unsigned long long *args)
1010
{
11-
uint16_t *val = (uint16_t *) args[0];
11+
uint16_t *val = (uint16_t *) (unsigned long) args[0];
1212
return val ? (long long) le16toh(*val) : 0;
1313
}
1414

tools/lib/traceevent/plugin_scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ scsi_trace_parse_cdb(struct trace_seq *p, unsigned char *cdb, int len)
405405
unsigned long long process_scsi_trace_parse_cdb(struct trace_seq *s,
406406
unsigned long long *args)
407407
{
408-
scsi_trace_parse_cdb(s, (unsigned char *) args[1], args[2]);
408+
scsi_trace_parse_cdb(s, (unsigned char *) (unsigned long) args[1], args[2]);
409409
return 0;
410410
}
411411

0 commit comments

Comments
 (0)