qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration/block-dirty-bitmap: Silence coverity CID 1390625
@ 2018-11-16 18:43 John Snow
  2018-11-20 15:15 ` Vladimir Sementsov-Ogievskiy
  0 siblings, 1 reply; 8+ messages in thread
From: John Snow @ 2018-11-16 18:43 UTC (permalink / raw)
  To: qemu-block, qemu-devel
  Cc: Fam Zheng, Stefan Hajnoczi, Dr. David Alan Gilbert, peter.maydell,
	Juan Quintela, John Snow

Coverity warns that backing_bs() could give us a NULL pointer, which
we then use without checking that it isn't.

In our loop condition, we check bs && bs->drv as a point of habit, but
by nature of the block graph, we cannot have null bs pointers here.

This loop skips only implicit nodes, which always have children, so
this loop should never encounter a null value.

Tighten the loop condition to coax Coverity into dropping
its false positive.

Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
 migration/block-dirty-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c
index 5e90f44c2f..00c068fda3 100644
--- a/migration/block-dirty-bitmap.c
+++ b/migration/block-dirty-bitmap.c
@@ -284,7 +284,7 @@ static int init_dirty_bitmap_migration(void)
         const char *drive_name = bdrv_get_device_or_node_name(bs);
 
         /* skip automatically inserted nodes */
-        while (bs && bs->drv && bs->implicit) {
+        while (bs->drv && bs->implicit) {
             bs = backing_bs(bs);
         }
 
-- 
2.17.2

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

end of thread, other threads:[~2019-05-01 16:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-16 18:43 [Qemu-devel] [PATCH] migration/block-dirty-bitmap: Silence coverity CID 1390625 John Snow
2018-11-20 15:15 ` Vladimir Sementsov-Ogievskiy
2019-04-30 23:08   ` John Snow
2019-04-30 23:08     ` John Snow
2019-05-01 15:24     ` Eric Blake
2019-05-01 15:24       ` Eric Blake
2019-05-01 16:31       ` John Snow
2019-05-01 16:31         ` John Snow

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