From nobody Thu Apr 25 08:08:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1605879990; cv=none; d=zohomail.com; s=zohoarc; b=VlxFOUCf20fGriK9Av2+6rI8OR/HzO0f42kYdRApmkNIe4FcpUZ70n0E6NcXNqg+XWk5c+Rq3JDF6cnj5SFTvMDQ5xlNIwD4O2o8zIK9boJmRWoxEXEU1b9yi3ryKBwz1+l5dd4qUvXh7iuyDBpGEaoWmcMwAv/1QQPOyx/bxRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605879990; 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=E+5t0Na+5ge8SZJrVtHv+sRGzrxPlzF5CXiBSx3Z10U=; b=N7eCIP8qtuJD49tQxbdZdvxDmm3yGSFh04Uvd17myHVeS9Hvyy3WU6abpReB9Jj9TZUXK0H62mjDS6SxsycOZt9p161Z4aUa5w4Sn8zqTXNIpWT5+fPBh6t3Se9wqsgu4j2jAIenhywkJShYCAEBewywFu/AgETjCNWHhsBjclQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605879990734905.1687427294016; Fri, 20 Nov 2020 05:46:30 -0800 (PST) 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-427-dIfLv0khP4-h1F9PFj99Lg-1; Fri, 20 Nov 2020 08:46:26 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1D7A518BA297; Fri, 20 Nov 2020 13:46:20 +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 EFBCA60C05; Fri, 20 Nov 2020 13:46:19 +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 A39EE180954D; Fri, 20 Nov 2020 13:46:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AKDkGQr030049 for ; Fri, 20 Nov 2020 08:46:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 14B9A1349A; Fri, 20 Nov 2020 13:46:16 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9177860636 for ; Fri, 20 Nov 2020 13:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605879989; 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=E+5t0Na+5ge8SZJrVtHv+sRGzrxPlzF5CXiBSx3Z10U=; b=aR0s4/5a/o2bngGYBlt9iUZpnqjojdEVmDGafhW0W6WIAKUUxFMrJ8Zy0fl6X9yey8tARk uLEBn9yKtDemtGfR0aNJ4lMafnlJH5MZ4b8nqnapKM5OBhZp5eXmiq4ttWL8pq+ZsJZ9QW +H9AGEjdqD/dqWDuu+OQdGxtRO9iNeE= X-MC-Unique: dIfLv0khP4-h1F9PFj99Lg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] qemu: json: check return value of virJSONValueObjectGetBoolean Date: Fri, 20 Nov 2020 14:46:06 +0100 Message-Id: <68107b326aa89c8c58eec984d7f89ba277c92dce.1605879873.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Fixes: 7555a554706e8a6d492804debbacfaae9f5d8b05 --- src/qemu/qemu_monitor_json.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 723bdb4426..0428ed0b6f 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1370,8 +1370,10 @@ qemuMonitorJSONHandleMemoryFailure(qemuMonitorPtr mo= n, } =20 if (flagsjson) { - virJSONValueObjectGetBoolean(flagsjson, "action-required", &ar); - virJSONValueObjectGetBoolean(flagsjson, "recursive", &recursive); + if (virJSONValueObjectGetBoolean(flagsjson, "action-required", &ar= ) < 0) + return; + if (virJSONValueObjectGetBoolean(flagsjson, "recursive", &recursiv= e) < 0) + return; } =20 mf.recipient =3D recipient; --=20 2.26.2 From nobody Thu Apr 25 08:08:50 2024 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=1605879989; cv=none; d=zohomail.com; s=zohoarc; b=NmL1mDb80ct1YxxamWovgz55k/LUMYEa6n7y1CwyRUyJFtGY4gg5TAHI3MQ+0rX8tnfK0VmraxNXN3e93PawsqgGBqtsVknvsPfShiXqF5zvWfCAR+dU9B6+AnHIM04N2DW5V/IjQyM9Dq+6R34SboAuvzoQWWVs2UosbqrySvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605879989; 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=PcBuf9cXeghd1SkxjDKLde3190x7IuRz00U14j/N7/4=; b=Fjwu9gL3UyVPa0QFiZU9x82hEYaXTSAJva66/KDCL9BlS0fAM2TGP+vy8OyTI/dbjDfA0DpC8IngyOTsCPM3da3OtPF25UGouTfGOmustQQgrs1bZ1pVuC1FqkjX4NFE8VHaqbpNOCsFFFDz6yjLDmzdbBR6Ql5ceLOEpUDYeJs= 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 1605879989869286.724494539439; Fri, 20 Nov 2020 05:46:29 -0800 (PST) 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-488-wB5SEOWBNoOb2sbYtFw0qw-1; Fri, 20 Nov 2020 08:46:25 -0500 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 EBA171015960; Fri, 20 Nov 2020 13:46:19 +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 45EC319C46; Fri, 20 Nov 2020 13:46:19 +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 D3CDB1809C9F; Fri, 20 Nov 2020 13:46:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AKDkGYY030058 for ; Fri, 20 Nov 2020 08:46:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id D9BA01349A; Fri, 20 Nov 2020 13:46:16 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6269860636 for ; Fri, 20 Nov 2020 13:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605879988; 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=PcBuf9cXeghd1SkxjDKLde3190x7IuRz00U14j/N7/4=; b=QDOg3H4HRlYXtzMf1CzyVhZv/j6nAOwIkiT3QGubuzOvELI9iUAe/LOGycF1ISvoq86S2n cWvUJQigJ/j4ICOLcVQvrD8iA7kqtNg0ebw0n7lYvzEWe3hMiTnl8Fh4NqIJZbWxBYHinQ RBidDUcI1SsbSaf92W4hd88vcQG+6gE= X-MC-Unique: wB5SEOWBNoOb2sbYtFw0qw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] testsutilsqemu: check return value of virQEMUCapsNewCopy Date: Fri, 20 Nov 2020 14:46:07 +0100 Message-Id: <848a166fc214440c2e5e7d3ca8539a7cf34caa5c.1605879873.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) While for virQEMUCapsNew this should not be needed (the possible failures in VIR_CLASS_NEW are only hit on bad API usage which we don't do here), virQEMUCapsNewCopy calls into many other functions, some of which actually fail. Check the return value of both. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- tests/testutilsqemu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 906fdf5c1a..cea4f84b14 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -349,6 +349,9 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache, tmpCaps =3D virQEMUCapsNew(); } =20 + if (!tmpCaps) + return -1; + if (!virQEMUCapsHasMachines(tmpCaps)) { const char *defaultRAMid =3D NULL; =20 --=20 2.26.2