Message ID | 20170304185533.10618-4-f4bug@amsat.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sat, Mar 4, 2017 at 10:58 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > static code analyzer complain: > > qga/commands-posix.c:2127:9: warning: Null pointer passed as an argument > to a 'nonnull' parameter > closedir(dp); > ^~~~~~~~~~~~ > > Reported-by: Clang Static Analyzer > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > qga/commands-posix.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/qga/commands-posix.c b/qga/commands-posix.c > index ea37c097cf..9c4ef2d640 100644 > --- a/qga/commands-posix.c > +++ b/qga/commands-posix.c > @@ -2119,9 +2119,11 @@ static void transfer_memory_block(GuestMemoryBlock > *mem_blk, bool sys2memblk, > * we think this VM does not support online/offline memory block, > * any other solution? > */ > - if (!dp && errno == ENOENT) { > - result->response = > - GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; > + if (!dp) { > + if (errno == ENOENT) { > + result->response = > + > GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; > + } > goto out1; > } > closedir(dp); > -- > 2.11.0 > > > -- Marc-André Lureau
diff --git a/qga/commands-posix.c b/qga/commands-posix.c index ea37c097cf..9c4ef2d640 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -2119,9 +2119,11 @@ static void transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk, * we think this VM does not support online/offline memory block, * any other solution? */ - if (!dp && errno == ENOENT) { - result->response = - GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; + if (!dp) { + if (errno == ENOENT) { + result->response = + GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; + } goto out1; } closedir(dp);
static code analyzer complain: qga/commands-posix.c:2127:9: warning: Null pointer passed as an argument to a 'nonnull' parameter closedir(dp); ^~~~~~~~~~~~ Reported-by: Clang Static Analyzer Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- qga/commands-posix.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)