From nobody Thu May 2 01:19:19 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498327917156943.9042817322489; Sat, 24 Jun 2017 11:11:57 -0700 (PDT) Received: from localhost ([::1]:40086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOpXG-0000S0-Od for importer@patchew.org; Sat, 24 Jun 2017 14:11:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOpVn-0007zO-Pl for qemu-devel@nongnu.org; Sat, 24 Jun 2017 14:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOpVm-0006L8-Sw for qemu-devel@nongnu.org; Sat, 24 Jun 2017 14:10:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33554) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dOpVk-0006IT-KY; Sat, 24 Jun 2017 14:10:20 -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 mx1.redhat.com (Postfix) with ESMTPS id 9FADFC049D5C; Sat, 24 Jun 2017 18:10:19 +0000 (UTC) Received: from red.redhat.com (ovpn-116-84.phx2.redhat.com [10.3.116.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF0D5708FC; Sat, 24 Jun 2017 18:10:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9FADFC049D5C Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9FADFC049D5C From: Eric Blake To: qemu-devel@nongnu.org Date: Sat, 24 Jun 2017 12:10:07 -0600 Message-Id: <20170624181008.25497-2-eblake@redhat.com> In-Reply-To: <20170624181008.25497-1-eblake@redhat.com> References: <20170624181008.25497-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 24 Jun 2017 18:10:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/2] qobject: Catch another straggler for use of qdict_put_str() 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: Kevin Wolf , "open list:Block layer core" , armbru@redhat.com, Max Reitz , stefanha@redhat.com, marcandre.lureau@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Dan's addition of key-secret improvements in commit 29cf9336 was developed prior to the addition of QDict scalar insertion macros, but merged after the general cleanup in commit 46f5ac20. Patch created mechanically by rerunning: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place Signed-off-by: Eric Blake Reviewed-by: Alberto Garcia Reviewed-by: Stefan Hajnoczi --- v2: reorder series --- qemu-img.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index 0ad698d..6c972f7 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -355,7 +355,7 @@ static int img_add_key_secrets(void *opaque, QDict *options =3D opaque; if (g_str_has_suffix(name, "key-secret")) { - qdict_put(options, name, qstring_from_str(value)); + qdict_put_str(options, name, value); } return 0; --=20 2.9.4 From nobody Thu May 2 01:19:19 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498327922856257.1867322435246; Sat, 24 Jun 2017 11:12:02 -0700 (PDT) Received: from localhost ([::1]:40087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOpXN-0000Uk-FA for importer@patchew.org; Sat, 24 Jun 2017 14:12:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOpVn-0007zN-Da for qemu-devel@nongnu.org; Sat, 24 Jun 2017 14:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOpVm-0006Kh-FJ for qemu-devel@nongnu.org; Sat, 24 Jun 2017 14:10:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48370) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dOpVm-0006K1-8X for qemu-devel@nongnu.org; Sat, 24 Jun 2017 14:10:22 -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 mx1.redhat.com (Postfix) with ESMTPS id 5BBD6C057FAD for ; Sat, 24 Jun 2017 18:10:21 +0000 (UTC) Received: from red.redhat.com (ovpn-116-84.phx2.redhat.com [10.3.116.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2F4D708E3; Sat, 24 Jun 2017 18:10:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5BBD6C057FAD Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=eblake@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5BBD6C057FAD From: Eric Blake To: qemu-devel@nongnu.org Date: Sat, 24 Jun 2017 12:10:08 -0600 Message-Id: <20170624181008.25497-3-eblake@redhat.com> In-Reply-To: <20170624181008.25497-1-eblake@redhat.com> References: <20170624181008.25497-1-eblake@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 24 Jun 2017 18:10:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/2] qobject: Update coccinelle script to catch Q{INC, DEC}REF 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: marcandre.lureau@redhat.com, armbru@redhat.com, stefanha@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The recent commit b097efc0 used qobject_decref(QOBJECT(E)), even though we already have QDECREF(E) for that purpose. We can update our coccinelle script to catch any future relapses; with that in place, the rest of the patch is generated with: spatch --sp-file scripts/coccinelle/qobject.cocci \ --macro-file scripts/cocci-macro-file.h --dir . --in-place Signed-off-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- v2: fix a misuse that crept in since v1 --- monitor.c | 2 +- scripts/coccinelle/qobject.cocci | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/monitor.c b/monitor.c index 3c369f4..b0fde7f 100644 --- a/monitor.c +++ b/monitor.c @@ -3829,7 +3829,7 @@ static void handle_qmp_command(JSONMessageParser *par= ser, GQueue *tokens) req_json =3D qobject_to_json(req); trace_handle_qmp_command(mon, qstring_get_str(req_json)); - qobject_decref(QOBJECT(req_json)); + QDECREF(req_json); rsp =3D qmp_dispatch(cur_mon->qmp.commands, req); diff --git a/scripts/coccinelle/qobject.cocci b/scripts/coccinelle/qobject.= cocci index c3253de..c518caf 100644 --- a/scripts/coccinelle/qobject.cocci +++ b/scripts/coccinelle/qobject.cocci @@ -3,6 +3,12 @@ expression Obj, Key, E; @@ ( +- qobject_incref(QOBJECT(E)); ++ QINCREF(E); +| +- qobject_decref(QOBJECT(E)); ++ QDECREF(E); +| - qdict_put_obj(Obj, Key, QOBJECT(E)); + qdict_put(Obj, Key, E); | --=20 2.9.4