summaryrefslogtreecommitdiff
path: root/tools/tracing/rtla/src/utils.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-08-05 09:35:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-08-05 09:35:46 -0700
commit29b1d469f3f6842ee4115f0b21f018fc44176468 (patch)
treee491dad91a4a635a280811f488bd1963f98c7e92 /tools/tracing/rtla/src/utils.c
parentb2a88c212e652e94f1e4b635910972ac57ba4e97 (diff)
parentdd0b15bda48f59eb7dee17fab91eda8389f0e98d (diff)
Merge tag 'trace-rtla-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull real time analysis tool (rtla) updates from Steven Rostedt: - Fix a double free - Define syscall numbers for RISCV - Fix Makefile when called from -C tools - Use calloc() to check for memory allocation failures * tag 'trace-rtla-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: rtla: Define syscall numbers for riscv rtla: Fix double free rtla: Fix Makefile when called from -C tools/ rtla/utils: Use calloc and check the potential memory allocation failure
Diffstat (limited to 'tools/tracing/rtla/src/utils.c')
-rw-r--r--tools/tracing/rtla/src/utils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c
index 5352167a1e75..663a047f794d 100644
--- a/tools/tracing/rtla/src/utils.c
+++ b/tools/tracing/rtla/src/utils.c
@@ -106,8 +106,9 @@ int parse_cpu_list(char *cpu_list, char **monitored_cpus)
nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
- mon_cpus = malloc(nr_cpus * sizeof(char));
- memset(mon_cpus, 0, (nr_cpus * sizeof(char)));
+ mon_cpus = calloc(nr_cpus, sizeof(char));
+ if (!mon_cpus)
+ goto err;
for (p = cpu_list; *p; ) {
cpu = atoi(p);
@@ -224,7 +225,7 @@ long parse_ns_duration(char *val)
#elif __arm__
# define __NR_sched_setattr 380
# define __NR_sched_getattr 381
-#elif __aarch64__
+#elif __aarch64__ || __riscv
# define __NR_sched_setattr 274
# define __NR_sched_getattr 275
#elif __powerpc__