mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Ingo Molnar <mingo@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>, Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH 2/3] tools lib traceevent: fix pointer-integer size mismatch
Date: Wed, 15 Jan 2014 10:44:07 +0000	[thread overview]
Message-ID: <1389782648-4417-3-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1389782648-4417-1-git-send-email-mark.rutland@arm.com>

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>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@redhat.com>
---
 tools/lib/traceevent/plugin_cfg80211.c | 2 +-
 tools/lib/traceevent/plugin_scsi.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

I'm not sure about this one as I'm not certain I read all the sites
input values for args could be generated. I'd appreciate if someone more
familiar with traceevent plugins could verify this makes sense.

Mark.

diff --git a/tools/lib/traceevent/plugin_cfg80211.c b/tools/lib/traceevent/plugin_cfg80211.c
index dcab8e8..57e9822 100644
--- a/tools/lib/traceevent/plugin_cfg80211.c
+++ b/tools/lib/traceevent/plugin_cfg80211.c
@@ -8,7 +8,7 @@ static unsigned long long
 process___le16_to_cpup(struct trace_seq *s,
 		       unsigned long long *args)
 {
-	uint16_t *val = (uint16_t *) args[0];
+	uint16_t *val = (uint16_t *) (unsigned long) args[0];
 	return val ? (long long) le16toh(*val) : 0;
 }
 
diff --git a/tools/lib/traceevent/plugin_scsi.c b/tools/lib/traceevent/plugin_scsi.c
index 6fb8e3e..7ef16cc 100644
--- a/tools/lib/traceevent/plugin_scsi.c
+++ b/tools/lib/traceevent/plugin_scsi.c
@@ -405,7 +405,7 @@ scsi_trace_parse_cdb(struct trace_seq *p, unsigned char *cdb, int len)
 unsigned long long process_scsi_trace_parse_cdb(struct trace_seq *s,
 						unsigned long long *args)
 {
-	scsi_trace_parse_cdb(s, (unsigned char *) args[1], args[2]);
+	scsi_trace_parse_cdb(s, (unsigned char *) (unsigned long) args[1], args[2]);
 	return 0;
 }
 
-- 
1.8.1.1


  parent reply	other threads:[~2014-01-15 10:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 10:44 [PATCH 0/3] Fix perf tool issues in tip/perf/core Mark Rutland
2014-01-15 10:44 ` [PATCH 1/3] perf: tools: Fix aliasing violation in zfree uses Mark Rutland
2014-01-15 10:44 ` Mark Rutland [this message]
2014-01-15 18:14   ` [PATCH 2/3] tools lib traceevent: fix pointer-integer size mismatch Arnaldo Carvalho de Melo
2014-01-15 18:42     ` Jiri Olsa
2014-01-15 19:40     ` Steven Rostedt
2014-01-16 13:39   ` [tip:perf/core] " tip-bot for Mark Rutland
2014-01-15 10:44 ` [PATCH 3/3] perf: tools: fix cross building Mark Rutland
2014-01-16 13:38   ` [tip:perf/core] perf: tools: Fix " tip-bot for Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389782648-4417-3-git-send-email-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=acme@ghostprotocols.net \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®