From nobody Wed Apr 15 02:28:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94864C00140 for ; Sun, 31 Jul 2022 21:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238497AbiGaVJt (ORCPT ); Sun, 31 Jul 2022 17:09:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231566AbiGaVJn (ORCPT ); Sun, 31 Jul 2022 17:09:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0FB9DF83 for ; Sun, 31 Jul 2022 14:09:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8E7B5B80D81 for ; Sun, 31 Jul 2022 21:09:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 619DEC433C1; Sun, 31 Jul 2022 21:09:40 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oIGBv-007GiH-1E; Sun, 31 Jul 2022 17:09:39 -0400 Message-ID: <20220731210939.214097203@goodmis.org> User-Agent: quilt/0.66 Date: Sun, 31 Jul 2022 17:09:19 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , jianchunfu Subject: [for-next][PATCH 1/4] rtla/utils: Use calloc and check the potential memory allocation failure References: <20220731210918.097591536@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: jianchunfu Replace malloc with calloc and add memory allocating check of mon_cpus before used. Link: https://lkml.kernel.org/r/20220615073348.6891-1-jianchunfu@cmss.china= mobile.com Fixes: 7d0dc9576dc3 ("rtla/timerlat: Add --dma-latency option") Signed-off-by: jianchunfu Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- tools/tracing/rtla/src/utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 5352167a1e75..5ae2fa96fde1 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_cpu= s) =20 nr_cpus =3D sysconf(_SC_NPROCESSORS_CONF); =20 - mon_cpus =3D malloc(nr_cpus * sizeof(char)); - memset(mon_cpus, 0, (nr_cpus * sizeof(char))); + mon_cpus =3D calloc(nr_cpus, sizeof(char)); + if (!mon_cpus) + goto err; =20 for (p =3D cpu_list; *p; ) { cpu =3D atoi(p); --=20 2.35.1 From nobody Wed Apr 15 02:28:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 318CEC00140 for ; Sun, 31 Jul 2022 21:09:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238501AbiGaVJw (ORCPT ); Sun, 31 Jul 2022 17:09:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232529AbiGaVJn (ORCPT ); Sun, 31 Jul 2022 17:09:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 209C6DF85 for ; Sun, 31 Jul 2022 14:09:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD1FEB80DCD for ; Sun, 31 Jul 2022 21:09:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BDDCC433D7; Sun, 31 Jul 2022 21:09:40 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oIGBv-007Giq-1o; Sun, 31 Jul 2022 17:09:39 -0400 Message-ID: <20220731210939.401925191@goodmis.org> User-Agent: quilt/0.66 Date: Sun, 31 Jul 2022 17:09:20 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Sedat Dilek Subject: [for-next][PATCH 2/4] rtla: Fix Makefile when called from -C tools/ References: <20220731210918.097591536@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Daniel Bristot de Oliveira Sedat Dilek reported an error on rtla Makefile when running: $ make -C tools/ clean [...] make[2]: Entering directory '/home/dileks/src/linux-kernel/git/tools/tracing/rtla' [...] '/home/dileks/src/linux-kernel/git/Documentation/tools/rtla' /bin/sh: 1: test: rtla-make[2]:: unexpected operator <------ The pro= blem rm: cannot remove '/home/dileks/src/linux-kernel/git': Is a directory make[2]: *** [Makefile:120: clean] Error 1 make[2]: Leaving directory This occurred because the rtla calls kernel's Makefile to get the version in silence mode, e.g., $ make -sC ../../.. kernelversion 5.19.0-rc4 But the -s is being ignored when rtla's makefile is called indirectly, so the output looks like this: $ make -C ../../.. kernelversion make: Entering directory '/root/linux' 5.19.0-rc4 make: Leaving directory '/root/linux' Using 'grep -v make' avoids this problem, e.g., $ make -C ../../.. kernelversion | grep -v make 5.19.0-rc4 Thus, add | grep -v make. Link: https://lkml.kernel.org/r/870c02d4d97a921f02a31fa3b229fc549af61a20.16= 57747763.git.bristot@kernel.org Fixes: 8619e32825fd ("rtla: Follow kernel version") Reported-by: Sedat Dilek Tested-by: Sedat Dilek Signed-off-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- tools/tracing/rtla/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile index 3822f4ea5f49..1bea2d16d4c1 100644 --- a/tools/tracing/rtla/Makefile +++ b/tools/tracing/rtla/Makefile @@ -1,6 +1,6 @@ NAME :=3D rtla # Follow the kernel version -VERSION :=3D $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelv= ersion) +VERSION :=3D $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelv= ersion | grep -v make) =20 # From libtracefs: # Makefiles suck: This macro sets a default value of $(2) for the --=20 2.35.1 From nobody Wed Apr 15 02:28:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0658DC00140 for ; Sun, 31 Jul 2022 21:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238472AbiGaVJp (ORCPT ); Sun, 31 Jul 2022 17:09:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbiGaVJn (ORCPT ); Sun, 31 Jul 2022 17:09:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD79DF59 for ; Sun, 31 Jul 2022 14:09:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 410F261137 for ; Sun, 31 Jul 2022 21:09:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DCE4C43140; Sun, 31 Jul 2022 21:09:40 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oIGBv-007GjO-2O; Sun, 31 Jul 2022 17:09:39 -0400 Message-ID: <20220731210939.578899044@goodmis.org> User-Agent: quilt/0.66 Date: Sun, 31 Jul 2022 17:09:21 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Andreas Schwab Subject: [for-next][PATCH 3/4] rtla: Fix double free References: <20220731210918.097591536@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Andreas Schwab Avoid double free by making trace_instance_destroy indempotent. When trace_instance_init fails, it calls trace_instance_destroy, but its only caller osnoise_destroy_tool calls it again. Link: https://lkml.kernel.org/r/mvmilnlkyzx.fsf_-_@suse.de Fixes: 0605bf009f18 ("rtla: Add osnoise tool") Signed-off-by: Andreas Schwab Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- tools/tracing/rtla/src/trace.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c index 5784c9f9e570..e1ba6d9f4265 100644 --- a/tools/tracing/rtla/src/trace.c +++ b/tools/tracing/rtla/src/trace.c @@ -134,13 +134,18 @@ void trace_instance_destroy(struct trace_instance *tr= ace) if (trace->inst) { disable_tracer(trace->inst); destroy_instance(trace->inst); + trace->inst =3D NULL; } =20 - if (trace->seq) + if (trace->seq) { free(trace->seq); + trace->seq =3D NULL; + } =20 - if (trace->tep) + if (trace->tep) { tep_free(trace->tep); + trace->tep =3D NULL; + } } =20 /* --=20 2.35.1 From nobody Wed Apr 15 02:28:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44547C00140 for ; Sun, 31 Jul 2022 21:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238242AbiGaVKA (ORCPT ); Sun, 31 Jul 2022 17:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238321AbiGaVJo (ORCPT ); Sun, 31 Jul 2022 17:09:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E9B0E017 for ; Sun, 31 Jul 2022 14:09:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1FE8AB80DD1 for ; Sun, 31 Jul 2022 21:09:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDD08C43143; Sun, 31 Jul 2022 21:09:40 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oIGBv-007Gjw-2z; Sun, 31 Jul 2022 17:09:39 -0400 Message-ID: <20220731210939.761903601@goodmis.org> User-Agent: quilt/0.66 Date: Sun, 31 Jul 2022 17:09:22 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Andreas Schwab Subject: [for-next][PATCH 4/4] rtla: Define syscall numbers for riscv References: <20220731210918.097591536@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Andreas Schwab RISC-V uses the same (generic) syscall numbers as ARM64. Link: https://lkml.kernel.org/r/mvma68wl2ul.fsf@suse.de Signed-off-by: Andreas Schwab Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- tools/tracing/rtla/src/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c index 5ae2fa96fde1..663a047f794d 100644 --- a/tools/tracing/rtla/src/utils.c +++ b/tools/tracing/rtla/src/utils.c @@ -225,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__ --=20 2.35.1