[tip: perf/core] perf cs-etm: Fix unsigned variable comparison to zero

From: tip-bot2 for Leo Yan
Date: Thu Mar 19 2020 - 10:13:00 EST


The following commit has been merged into the perf/core branch of tip:

Commit-ID: bc010dd657ee0309276c88ab828b9ad156f75b31
Gitweb: https://git.kernel.org/tip/bc010dd657ee0309276c88ab828b9ad156f75b31
Author: Leo Yan <leo.yan@xxxxxxxxxx>
AuthorDate: Wed, 19 Feb 2020 10:18:11 +08:00
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitterDate: Wed, 11 Mar 2020 10:48:44 -03:00

perf cs-etm: Fix unsigned variable comparison to zero

The variable 'offset' in function cs_etm__sample() is u64 type, it's not
appropriate to check it with 'while (offset > 0)'; this patch changes to
'while (offset)'.

Signed-off-by: Leo Yan <leo.yan@xxxxxxxxxx>
Reviewed-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
Reviewed-by: Mike Leach <mike.leach@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Robert Walker <robert.walker@xxxxxxx>
Cc: Suzuki Poulouse <suzuki.poulose@xxxxxxx>
Cc: coresight ml <coresight@xxxxxxxxxxxxxxxx>
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Link: http://lore.kernel.org/lkml/20200219021811.20067-6-leo.yan@xxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/cs-etm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 87d9943..62d2f9b 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -962,7 +962,7 @@ static inline u64 cs_etm__instr_addr(struct cs_etm_queue *etmq,
if (packet->isa == CS_ETM_ISA_T32) {
u64 addr = packet->start_addr;

- while (offset > 0) {
+ while (offset) {
addr += cs_etm__t32_instr_size(etmq,
trace_chan_id, addr);
offset--;