Re: btrfs-progs: initial scan-build results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux