From nobody Fri May 3 09:43:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1636052080; cv=none; d=zohomail.com; s=zohoarc; b=aizIiMN/h3Qhq7XhYF6yqEsEODhV0XhfTqsNQX3aOWZZAEamDaJz8ZEdBsUJQjEYHPmHJedRNNH4LSGA7kbXJeRDbZ29k231I2ylK+yfJORMzxi6V3mf2C6JLFwju4m9Y74hzVGu6Gr5RxgYuPlhnp1eqb7poDf9w286MOLfhds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636052080; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=jcbTe4KhUX/Enpb+jcE/IFdvZIAU6BDqIB4dn43vpaM=; b=U2SLoBfaidYgsV24iQk8W/ouvyOO+jTfe6ikfI1AcLrQHQVH9FuYr/MP/bJtYQpyTM/d4SbosRmu5jvBCPmtCz/exmWuYwtt1cdxXRnS2IvzwSbrn4K9FklLzFZfRDhUdOYBNs7Nkb7sdeTLU1imnMQxpVlLc75N8/T9eOQY2Jk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1636052080091385.91919601326276; Thu, 4 Nov 2021 11:54:40 -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-292-oQse6q3MNKeUySbMd3MU4w-1; Thu, 04 Nov 2021 14:54:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C844F8799E0; Thu, 4 Nov 2021 18:54:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2B6213ABD; Thu, 4 Nov 2021 18:54:30 +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 3C7484A703; Thu, 4 Nov 2021 18:54:30 +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 1A4IsS95014187 for ; Thu, 4 Nov 2021 14:54:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id D09B719D9F; Thu, 4 Nov 2021 18:54:28 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.195.139]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A338F19723 for ; Thu, 4 Nov 2021 18:54:28 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id 2B48718013D; Thu, 4 Nov 2021 19:54:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636052079; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jcbTe4KhUX/Enpb+jcE/IFdvZIAU6BDqIB4dn43vpaM=; b=STE4yG4zn5pEYBEHmIhhrLiSPDRsF3nmqL53llC0XekFadtPDZuAkOwbP1bC3uEGRNyg6w rk+ssX/AcUrQmawr8SoH3meTETqhrqQLNVpe2dY9JfFgIdI5JNLygZ96bRnzWUpkZkhjN5 CIgdqhiwyKWFQePpY1n0a6A7h4W+kVM= X-MC-Unique: oQse6q3MNKeUySbMd3MU4w-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: Check return value of virJSONValueObjectAdd Date: Thu, 4 Nov 2021 19:54:23 +0100 Message-Id: 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.13 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) X-ZM-MESSAGEID: 1636052082067100001 Content-Type: text/plain; charset="utf-8" The return value was not properly checked in the code for input type evdev. Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 45278c7108..483041f584 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4336,13 +4336,15 @@ qemuBuildInputEvdevProps(virDomainInputDef *dev) NULL) < 0) return NULL; =20 - if (dev->source.grab =3D=3D VIR_DOMAIN_INPUT_SOURCE_GRAB_ALL) - virJSONValueObjectAdd(props, "b:grab_all", true, NULL); + if (dev->source.grab =3D=3D VIR_DOMAIN_INPUT_SOURCE_GRAB_ALL && + virJSONValueObjectAdd(props, "b:grab_all", true, NULL) < 0) + return NULL; =20 - if (dev->source.grabToggle !=3D VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_DE= FAULT) + if (dev->source.grabToggle !=3D VIR_DOMAIN_INPUT_SOURCE_GRAB_TOGGLE_DE= FAULT && virJSONValueObjectAdd(props, "s:grab-toggle", virDomainInputSourceGrabToggleTypeToString(d= ev->source.grabToggle), - NULL); + NULL) < 0) + return NULL; =20 return g_steal_pointer(&props); } --=20 2.33.1