Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 3ba5a2e

Browse files
captain5050gregkh
authored andcommitted
perf time-utils: Fix 32-bit nsec parsing
[ Upstream commit 38e2648 ] The "time utils" test fails in 32-bit builds: ... parse_nsec_time("18446744073.709551615") Failed. ptime 4294967295709551615 expected 18446744073709551615 ... Switch strtoul to strtoull as an unsigned long in 32-bit build isn't 64-bits. Fixes: c284d66 ("perf tools: Move parse_nsec_time to time-utils.c") Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Chaitanya S Prakash <chaitanyas.prakash@arm.com> Cc: Colin Ian King <colin.i.king@gmail.com> Cc: David Ahern <dsa@cumulusnetworks.com> Cc: Dominique Martinet <asmadeus@codewreck.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Junhao He <hejunhao3@huawei.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Yang Jihong <yangjihong@bytedance.com> Link: https://lore.kernel.org/r/20240831070415.506194-3-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 022f932 commit 3ba5a2e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/util/time-utils.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int parse_nsec_time(const char *str, u64 *ptime)
2020
u64 time_sec, time_nsec;
2121
char *end;
2222

23-
time_sec = strtoul(str, &end, 10);
23+
time_sec = strtoull(str, &end, 10);
2424
if (*end != '.' && *end != '\0')
2525
return -1;
2626

@@ -38,7 +38,7 @@ int parse_nsec_time(const char *str, u64 *ptime)
3838
for (i = strlen(nsec_buf); i < 9; i++)
3939
nsec_buf[i] = '0';
4040

41-
time_nsec = strtoul(nsec_buf, &end, 10);
41+
time_nsec = strtoull(nsec_buf, &end, 10);
4242
if (*end != '\0')
4343
return -1;
4444
} else

0 commit comments

Comments
 (0)