mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
perf time-utils: Fix 32-bit nsec parsing
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: c284d669a20d408b ("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>
This commit is contained in:
parent
6c99903e08
commit
38e2648a81
@ -20,7 +20,7 @@ int parse_nsec_time(const char *str, u64 *ptime)
|
||||
u64 time_sec, time_nsec;
|
||||
char *end;
|
||||
|
||||
time_sec = strtoul(str, &end, 10);
|
||||
time_sec = strtoull(str, &end, 10);
|
||||
if (*end != '.' && *end != '\0')
|
||||
return -1;
|
||||
|
||||
@ -38,7 +38,7 @@ int parse_nsec_time(const char *str, u64 *ptime)
|
||||
for (i = strlen(nsec_buf); i < 9; i++)
|
||||
nsec_buf[i] = '0';
|
||||
|
||||
time_nsec = strtoul(nsec_buf, &end, 10);
|
||||
time_nsec = strtoull(nsec_buf, &end, 10);
|
||||
if (*end != '\0')
|
||||
return -1;
|
||||
} else
|
||||
|
Loading…
x
Reference in New Issue
Block a user