qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sheepdog: Remove unnecessary NULL check in sd_prealloc()
@ 2018-05-18 18:17 Peter Maydell
  2018-05-22 11:12 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2018-05-18 18:17 UTC (permalink / raw)
  To: qemu-devel
  Cc: patches, Hitoshi Mitake, Liu Yuan, Jeff Cody, Kevin Wolf,
	Max Reitz, qemu-block, sheepdog

In commit 8b9ad56e9cbfd852a, we removed the code that could result
in our getting to sd_prealloc()'s out_with_err_set label with a
NULL blk pointer. That makes the NULL check in the error-handling
path unnecessary, and Coverity gripes about it (CID 1390636).
Delete the redundant check.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 block/sheepdog.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 4237132419..2a5bc0a59a 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1859,9 +1859,7 @@ out:
         error_setg_errno(errp, -ret, "Can't pre-allocate");
     }
 out_with_err_set:
-    if (blk) {
-        blk_unref(blk);
-    }
+    blk_unref(blk);
     g_free(buf);
 
     return ret;
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] sheepdog: Remove unnecessary NULL check in sd_prealloc()
  2018-05-18 18:17 [Qemu-devel] [PATCH] sheepdog: Remove unnecessary NULL check in sd_prealloc() Peter Maydell
@ 2018-05-22 11:12 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2018-05-22 11:12 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, patches, Hitoshi Mitake, Liu Yuan, Jeff Cody,
	Max Reitz, qemu-block, sheepdog

Am 18.05.2018 um 20:17 hat Peter Maydell geschrieben:
> In commit 8b9ad56e9cbfd852a, we removed the code that could result
> in our getting to sd_prealloc()'s out_with_err_set label with a
> NULL blk pointer. That makes the NULL check in the error-handling
> path unnecessary, and Coverity gripes about it (CID 1390636).
> Delete the redundant check.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

In fact, it was unnecessary even before that, because blk_unref(NULL)
is valid (it does nothing).

Thanks, applied to the block branch.

Kevin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-22 11:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-18 18:17 [Qemu-devel] [PATCH] sheepdog: Remove unnecessary NULL check in sd_prealloc() Peter Maydell
2018-05-22 11:12 ` Kevin Wolf

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).