On Tue, Jul 12, 2022 at 04:13:28PM -0500, Eric Blake wrote:
On Tue, Jul 12, 2022 at 07:22:31PM +0100, Richard W.M. Jones wrote:
Hi Eric,
None of this is important, and may not even be bugs, but here are a few issues raised with the latest run of Coverity on nbdkit 1.30.7.
********************************************************************** *** server/protocol-handshake-newstyle.c
I think Coverity has a point here. Certainly there is code before this point which assigns conn->top_context = NULL, and it's not immediately clear to me that the code that Coverity has highlighted is unreachable in that case.
I'll look into those.
The code setting conn->top_context = NULL is followed by continue (it is only used as an error path); the NBD_INFO code (that uses conn->top_context) is only reachable if finish_newstyle_options() succeeded, which in turn means protocol_common_open() succeeded. But as chasing through different files is hard for Coverity (let alone humans) to see that a successful protocol_common_open() implies conn->top_context is non-NULL, I just added an assert(). I've pushed 18e1504d..21e43619 that should address all of these Coverity findings. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org