linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Marchand <jmarchan@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH 0/7] trace-cmd: Fix misc issues uncoverd by static analysis
Date: Thu, 19 Dec 2024 10:06:23 +0100	[thread overview]
Message-ID: <6cc7ed3c-281e-4d52-983d-5cd87cbee705@redhat.com> (raw)
In-Reply-To: <20241218175343.6207107f@gandalf.local.home>

On 18/12/2024 23:53, Steven Rostedt wrote:
> On Thu,  5 Dec 2024 15:44:32 +0100
> "Jerome Marchand" <jmarchan@redhat.com> wrote:
> 
>> More issues were found by running static analysers on the code
>> of trace-cmd with openscanhub[1].
>>
>> [1] https://fedoraproject.org/wiki/OpenScanHub
>>
>> Jerome Marchand (7):
>>    trace-cmd lib: Close FDs in create_buffer_recorder_fd2 it allocation
>>      fails
>>    trace-cmd lib: Prevent a memory leak in tracecmd_tsync_with_guest()
>>    trace-cmd lib: Prevent a leaked FD in
>>      __tracecmd_create_buffer_recorder()
>>    trace-cmd lib: Prevent memory leak in tracecmd_msg_wait_for_cmd()
>>    trace-cmd sqlhist: Initialize name in trace_sqlhist()
>>    trace-cmd: Fix memory leak in stop_mapping_vcpus()
>>    trace-cmd record: Fix stdin redirection to /dev/null
>>
> 
> I'm going to apply all your patches except the two that deal with file
> descriptors. The functions should not be closing file descriptors that they
> did not open. The real fix there is to remove where it does close the file
> descriptors and move the closing in the error paths of the callers.
> 
> I must have gotten lazy and just let the functions do the closing when they
> failed, but that is just prone to bugs.

That makes sense. I'll send updated fixes after the holidays break.

Thanks,
Jerome

> 
> -- Steve
> 
> 
>>   lib/trace-cmd/trace-msg.c      |  4 +++-
>>   lib/trace-cmd/trace-recorder.c | 19 ++++++++++---------
>>   lib/trace-cmd/trace-timesync.c |  1 +
>>   tracecmd/trace-record.c        |  2 +-
>>   tracecmd/trace-sqlhist.c       |  2 +-
>>   tracecmd/trace-tsync.c         |  1 +
>>   6 files changed, 17 insertions(+), 12 deletions(-)
>>
> 


      reply	other threads:[~2024-12-19  9:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-05 14:44 [PATCH 0/7] trace-cmd: Fix misc issues uncoverd by static analysis Jerome Marchand
2024-12-05 14:44 ` [PATCH 1/7] trace-cmd lib: Close FDs in create_buffer_recorder_fd2 it allocation fails Jerome Marchand
2024-12-18 22:37   ` Steven Rostedt
2024-12-18 22:43     ` Steven Rostedt
2024-12-05 14:44 ` [PATCH 2/7] trace-cmd lib: Prevent a memory leak in tracecmd_tsync_with_guest() Jerome Marchand
2024-12-05 14:44 ` [PATCH 3/7] trace-cmd lib: Prevent a leaked FD in __tracecmd_create_buffer_recorder() Jerome Marchand
2024-12-05 14:44 ` [PATCH 4/7] trace-cmd lib: Prevent memory leak in tracecmd_msg_wait_for_cmd() Jerome Marchand
2024-12-05 14:44 ` [PATCH 5/7] trace-cmd sqlhist: Initialize name in trace_sqlhist() Jerome Marchand
2024-12-05 14:44 ` [PATCH 6/7] trace-cmd: Fix memory leak in stop_mapping_vcpus() Jerome Marchand
2024-12-05 14:44 ` [PATCH 7/7] trace-cmd record: Fix stdin redirection to /dev/null Jerome Marchand
2024-12-18 22:53 ` [PATCH 0/7] trace-cmd: Fix misc issues uncoverd by static analysis Steven Rostedt
2024-12-19  9:06   ` Jerome Marchand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cc7ed3c-281e-4d52-983d-5cd87cbee705@redhat.com \
    --to=jmarchan@redhat.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).