From nobody Mon Feb 9 10:32:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601628978; cv=none; d=zohomail.com; s=zohoarc; b=nx0oOPLGiL8HRi/IAxjIkz0stkD3RZv1Maz4eNBDo5rbtyULlCw0qZjukoAxlmiQo8Wz9mYPD06wVQ6Dl6pA726ckPXzI/GxxJFtavLeGSmG4wRbIiu4Cr2dUNml/pR0atpVzyEIOXwhkQPdawcZCn9AF7oQifiF8QyeeutkbEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601628978; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6OuYlp2ihP0v5efjswPrPsnz/OdtCA/mRXfmYhNFfqM=; b=WWOT/nY2zsROfuhUoOP/xhGwWzQ1qcIdYOU+2fJa2uy80kyevwM8JvAJ/cWv1YpgU/6TQ63mzipjbxdYVIlEgX7sV7sCV+v4dcmY4drbTt+xip3ysy1NdmiU5JZo3KrTpG8K8neX2czVmuoR/CbQ2bC4Xv5qUMhr5PeszsYXpkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1601628978475439.053355025; Fri, 2 Oct 2020 01:56:18 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-458-LXQcFOXzP9y-srNovYHErA-1; Fri, 02 Oct 2020 04:56:15 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D95B3186DD2C; Fri, 2 Oct 2020 08:56:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B53BF19C78; Fri, 2 Oct 2020 08:56:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8132C181A06C; Fri, 2 Oct 2020 08:56:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0928u8iR014668 for ; Fri, 2 Oct 2020 04:56:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id C3E845C1D7; Fri, 2 Oct 2020 08:56:08 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E21E5C1D0 for ; Fri, 2 Oct 2020 08:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601628977; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=6OuYlp2ihP0v5efjswPrPsnz/OdtCA/mRXfmYhNFfqM=; b=cAlLaoG0LI8em4xAwy8VnB0t/tnrCik0OlxD9s4hC5GxMLVDqY+OeTDe1bsmhGCzrY/2Pc zL1QTrBSo5rwZ4VB3iOf2tKcJSfJ3++NSiQ3pMNqssgA3WP3RXG2UntwDNdUZcjYRqq1nO UrJTgpWPNiSEH/TZ+jrUkV6K5SwcT70= X-MC-Unique: LXQcFOXzP9y-srNovYHErA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/6] virBitmapNewCopy: Reimplement bitmap copying to prevent failure Date: Fri, 2 Oct 2020 10:55:57 +0200 Message-Id: <2c3247d567ed02646f584d6f1baa68343a3d2f5c.1601628907.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" virBitmapCopy has a failure condition, which is impossible to meet when creating a new copy. Copy the contents directly to make it obvious that virBitmapNewCopy can't fail. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virbitmap.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 74d1883d94..c62438a3a6 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -655,20 +655,14 @@ virBitmapParseUnlimited(const char *str) * virBitmapNewCopy: * @src: the source bitmap. * - * Makes a copy of bitmap @src. - * - * returns the copied bitmap on success, or NULL otherwise. Caller - * should call virBitmapFree to free the returned bitmap. + * Returns a copy of bitmap @src. */ virBitmapPtr virBitmapNewCopy(virBitmapPtr src) { virBitmapPtr dst =3D virBitmapNew(src->nbits); - if (virBitmapCopy(dst, src) !=3D 0) { - virBitmapFree(dst); - return NULL; - } + memcpy(dst->map, src->map, src->map_len * sizeof(src->map[0])); return dst; } --=20 2.26.2