From nobody Mon Feb 9 17:07:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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=1585226411; cv=none; d=zohomail.com; s=zohoarc; b=DJCao4mg/WO+F+tB5D6m3fwo+t7baxhVzd7Yk1ikmkj1CZgmLDb1X8EiuemY/YVJ1T5KlH5PUgbFDcs+21ipzhaIcTWIs/gkEDwclhbnsFIJs7cXEZssP7/N6jMYEDXQwUfxRAvpyYg9eTx0iG9szswtGNGU4/jg72THlSFy1ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585226411; 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=ywqwoOrJ4FzApWQv0ZhTX9fO9qctqUIsbIG7Y1lE2KQ=; b=GMw5dhVnMnOHUlAy6f9AgCHh3uqZL8u6XJjgHkGvBtvYGiKqMvio9L3WDLVoGaMxG/ab6YXekTdMckTGr39YSCrXzsRxFwjqMliznhnuKe08Ppp/CL+792Mq1FVxXveIRcnhXipn74CtVe69P1XI/q0ddS+1lCzm+MfwqzEh69M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1585226411161762.496483222074; Thu, 26 Mar 2020 05:40:11 -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-86-UNEosI6IMEqIHvY38QiqvQ-1; Thu, 26 Mar 2020 08:40:07 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3C4D107ACCA; Thu, 26 Mar 2020 12:40:01 +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 CF5B7D767F; Thu, 26 Mar 2020 12:39:55 +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 E2F501832DAB; Thu, 26 Mar 2020 12:39:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02QCdq52022972 for ; Thu, 26 Mar 2020 08:39:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DA6719C70; Thu, 26 Mar 2020 12:39:52 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11E873AA for ; Thu, 26 Mar 2020 12:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585226409; 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=ywqwoOrJ4FzApWQv0ZhTX9fO9qctqUIsbIG7Y1lE2KQ=; b=N/36C1z4yFfMauMGQtIa8BV9AYSaWpDCwYXdJbJHxGaJq87emt3J0N+VyiJ1fRdTxgNSYq MVKXMICtqM1vMEJlb25xUaH/Rh+mXY7NF1I/W2L57ieCMEIB6doH7VQ57WgBVKZy2IcNuQ WRnxFxpmG0ZZKk6hk4VBGKkZDWNsWNA= X-MC-Unique: UNEosI6IMEqIHvY38QiqvQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/3] qemuBlockJobUpdate: Remove return value Date: Thu, 26 Mar 2020 13:39:40 +0100 Message-Id: <517f2c36cab96a731962e0fd6cc185a99a550603.1585226343.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.79 on 10.5.11.11 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" No callers use it any more. Additionally if qemuBlockJobUpdate was called with the last reference of the job e.g. in qemuBlockJobRefreshJobs, the reading of the job state would happen from freed memory. Reported-by: Pavel Mores Signed-off-by: Peter Krempa Reviewed-by: Pavel Mores --- src/qemu/qemu_blockjob.c | 8 ++------ src/qemu/qemu_blockjob.h | 7 ++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 21a043d369..6576f8721f 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1658,10 +1658,8 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver, * * Update disk's mirror state in response to a block job event stored in * blockJobStatus by qemuProcessHandleBlockJob event handler. - * - * Returns the block job event processed or -1 if there was no pending eve= nt. */ -int +void qemuBlockJobUpdate(virDomainObjPtr vm, qemuBlockJobDataPtr job, int asyncJob) @@ -1669,14 +1667,12 @@ qemuBlockJobUpdate(virDomainObjPtr vm, qemuDomainObjPrivatePtr priv =3D vm->privateData; if (job->newstate =3D=3D -1) - return -1; + return; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) qemuBlockJobEventProcess(priv->driver, vm, job, asyncJob); else qemuBlockJobEventProcessLegacy(priv->driver, vm, job, asyncJob); - - return job->state; } diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 9264c70217..19498b5bd8 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -232,9 +232,10 @@ int qemuBlockJobRefreshJobs(virQEMUDriverPtr driver, virDomainObjPtr vm); -int qemuBlockJobUpdate(virDomainObjPtr vm, - qemuBlockJobDataPtr job, - int asyncJob); +void +qemuBlockJobUpdate(virDomainObjPtr vm, + qemuBlockJobDataPtr job, + int asyncJob); void qemuBlockJobSyncBegin(qemuBlockJobDataPtr job); void qemuBlockJobSyncEnd(virDomainObjPtr vm, --=20 2.24.1