From: "Holger Hoffstätte" <holger.hoffstaette@googlemail.com>
To: Alexander Fougner <fougner89@gmail.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: btrfs-progs: initial scan-build results
Date: Tue, 1 Mar 2016 16:45:16 +0100 [thread overview]
Message-ID: <56D5B90C.6000101@googlemail.com> (raw)
In-Reply-To: <CAGGqMYRKppf3vxjLCHrgwCp5-E6jf8kc6Mdj-NVmhoux6W-eVQ@mail.gmail.com>
Hi,
thanks for taking a look. I hadn't actually delved in too deeply yet.
On 03/01/16 14:41, Alexander Fougner wrote:
> All zero-sized allocations are false positives, except the
> btrfs-image.c. This can be fixed by placing the num_threads at the top
> instead of after calloc().
Well..I stepped into metadump_init() and num_pthreads is definitely 0;
setting it to 1 before continuing starts & coordinates with a new thread,
as expected. What the analyser complains about, and what I also didn't
know until just now because I stopped remembering C standard details
shortly after approx. BSD 4.2 ;-) is the second half of the following bit
from calloc(1):
If nmemb or size is 0, then calloc() returns either NULL, or a
unique pointer value that can later be successfully passed to free()
So this works implicitly and is OK since it still checks for NULL
and num_pthreads==0 later on.
Well..good thing we talked about it. :-)
cheers
Holger
next prev parent reply other threads:[~2016-03-01 15:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-01 12:44 btrfs-progs: initial scan-build results Holger Hoffstätte
2016-03-01 13:41 ` Alexander Fougner
2016-03-01 15:45 ` Holger Hoffstätte [this message]
2016-03-01 16:39 ` Holger Hoffstätte
2016-03-02 15:04 ` David Sterba
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=56D5B90C.6000101@googlemail.com \
--to=holger.hoffstaette@googlemail.com \
--cc=fougner89@gmail.com \
--cc=linux-btrfs@vger.kernel.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).