From nobody Thu Nov 6 03:26:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539696139746130.92955541883714; Tue, 16 Oct 2018 06:22:19 -0700 (PDT) Received: from localhost ([::1]:58033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCPIg-0002q5-FT for importer@patchew.org; Tue, 16 Oct 2018 09:22:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCPH2-0001rw-BP for qemu-devel@nongnu.org; Tue, 16 Oct 2018 09:20:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCPGv-00056M-DS for qemu-devel@nongnu.org; Tue, 16 Oct 2018 09:20:34 -0400 Received: from relay.sw.ru ([185.231.240.75]:53896) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gCPGu-00050I-ED; Tue, 16 Oct 2018 09:20:29 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1gCPGl-00019f-K7; Tue, 16 Oct 2018 16:20:20 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 16 Oct 2018 16:20:18 +0300 Message-Id: <20181016132018.5054-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH] migration/block-dirty-bitmap: fix Coverity CID1390625 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, vsementsov@virtuozzo.com, famz@redhat.com, quintela@redhat.com, dgilbert@redhat.com, stefanha@redhat.com, den@openvz.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Theoretically possible that we finish the skipping loop with bs =3D NULL and the following code will crash trying to dereference it. Fix that. Signed-off-by: Vladimir Sementsov-Ogievskiy --- migration/block-dirty-bitmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 477826330c..6de808f95f 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -288,6 +288,10 @@ static int init_dirty_bitmap_migration(void) bs =3D backing_bs(bs); } =20 + if (!bs || bs->implicit) { + continue; + } + for (bitmap =3D bdrv_dirty_bitmap_next(bs, NULL); bitmap; bitmap =3D bdrv_dirty_bitmap_next(bs, bitmap)) { --=20 2.18.0