From nobody Sat May 18 09:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594657670; cv=none; d=zohomail.com; s=zohoarc; b=cpzBOakLzE2mmEly7SZ9+4ZaMB5GkGgqMWvEhcbvbf0S6/uKHBC563KPm/Kne6Xlkh7b1IcyQp6iU6SJQ6FNfPIcAvjEImNgxgnrF6s1CFL/53rfQat2/fIiti/FH3d0JRLj8meNDFs9gWNp1cr0FhlUi/IVwrDgVDduKs1nxIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594657670; h=Content-Type:Content-Transfer-Encoding:Cc: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=nB/uzKuZZDiL83rkEbZGDB7cJ1ANtuAgCpQb5NzfACg=; b=UeiQXwqvBiCFGPc6vFJnxr5QXVEzvIJ6ziqak8VQ6BrViHnb5apfDXWkGJIbbYdDXxWVOUvr9y1Qlt1k7IjMol04ef2tLoGT+0TuDbIptI5jrGYCEAor7uc/zCGXIZEqCbXvHp7RdpBh9iaxV2KsW4mKKM+8G8y6pR7ktqqmgxg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594657670709441.7519449051971; Mon, 13 Jul 2020 09:27:50 -0700 (PDT) Received: from localhost ([::1]:36778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jv1Iz-0003FS-FW for importer@patchew.org; Mon, 13 Jul 2020 12:27:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jv1Fh-00008q-HU for qemu-devel@nongnu.org; Mon, 13 Jul 2020 12:24:25 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55600 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jv1Fe-0003Bg-8V for qemu-devel@nongnu.org; Mon, 13 Jul 2020 12:24:25 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-375-T6Les0_mOqmvUaq6gBV1zA-1; Mon, 13 Jul 2020 12:24:15 -0400 Received: by mail-wr1-f69.google.com with SMTP id a18so18032696wrm.14 for ; Mon, 13 Jul 2020 09:24:14 -0700 (PDT) Received: from localhost (trasno.trasno.org. [83.165.45.250]) by smtp.gmail.com with ESMTPSA id x185sm112705wmg.41.2020.07.13.09.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 09:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594657456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nB/uzKuZZDiL83rkEbZGDB7cJ1ANtuAgCpQb5NzfACg=; b=LB1xFDOVB5saXDkTzVRYHjjda4JdIfQtB+lH/CUwqwRqjp8gBbKLAcUgjGzFkrucoIXoi1 ttL5mA4V8vkGSg/SjRF895aoWIR2/+70eTnwstmK6QgDZIZLsBES44DOK7w/LiVZciamI6 wzrYn0DaAQeAwXwGKCp1jEMKKPbkLzM= X-MC-Unique: T6Les0_mOqmvUaq6gBV1zA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nB/uzKuZZDiL83rkEbZGDB7cJ1ANtuAgCpQb5NzfACg=; b=tmIw2Tfk3siPtczoG8/M9DISkvDrWfZUI6gE0itikoD3Tf0deOu5ocaFNpvM/dd6oc CIyyyL8BCGabs7WWYTZZK+ZgFquEGsAgXhd+Iu6VxjdFJFC6Oi4WV219GI9/buWezU7r ZqkLf80iZjmyvPra1awvod2cEwGlIgVIXLdY7X5klTgXsq8Fh5C7td0qoho1kAeN1v4T kYezp7A61A0yUip9VePVlkwfiMijLCxUpt+VH3ktlh9NbCTL6SQEELGq3HUHV4pcVOp/ y9ADWSdUblikf9htE3X4AtKhBKBV6yl3TkfXunq5yA8aolNlO4btr4lUrSz6XETtXuF3 igHw== X-Gm-Message-State: AOAM5328I92cB/Vuy+4m6WSM6+EoAbMp6NYDnSmP9HvQu/uqPsJpUN6l h2TjgbpKaBN04Hol0faJyBEHlmQYJcOT532jAEYMkLEaYwGgo9WroXvq9ODBzChUh1ujugaWaz3 6ClKF6hUWXKVgk3U= X-Received: by 2002:a7b:c090:: with SMTP id r16mr126529wmh.143.1594657453805; Mon, 13 Jul 2020 09:24:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpo3LaFaWXFwhgsrTspy9LvHuoEkREsmxkYt/4YaUhfcBsOh/UvcnyFfvPKgbhO2klyqYNmg== X-Received: by 2002:a7b:c090:: with SMTP id r16mr126514wmh.143.1594657453562; Mon, 13 Jul 2020 09:24:13 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH v3 1/3] migration: fix memory leak in qmp_migrate_set_parameters Date: Mon, 13 Jul 2020 18:24:08 +0200 Message-Id: <20200713162410.11577-2-quintela@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200713162410.11577-1-quintela@redhat.com> References: <20200713162410.11577-1-quintela@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=quintela@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 02:19:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: HaiLiang , Juan Quintela , "Dr. David Alan Gilbert" , Zheng Chuan , quintela@trasno.org, KeQian Zhu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Zheng Chuan "tmp.tls_hostname" and "tmp.tls_creds" allocated by migrate_params_test_app= ly() is forgot to free at the end of qmp_migrate_set_parameters(). Fix that. The leak stack: Direct leak of 2 byte(s) in 2 object(s) allocated from: #0 0xffffb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd32= 0b) #1 0xffffb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b) #2 0xffffb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143) #3 0xaaaac52447fb in migrate_params_test_apply (/usr/src/debug/qemu-4.1.= 0/migration/migration.c:1377) #4 0xaaaac52fdca7 in qmp_migrate_set_parameters (/usr/src/debug/qemu-4.1= .0/qapi/qapi-commands-migration.c:192) #5 0xaaaac551d543 in qmp_dispatch (/usr/src/debug/qemu-4.1.0/qapi/qmp-di= spatch.c:165) #6 0xaaaac52a0a8f in qmp_dispatch (/usr/src/debug/qemu-4.1.0/monitor/qmp= .c:125) #7 0xaaaac52a1c7f in monitor_qmp_dispatch (/usr/src/debug/qemu-4.1.0/mon= itor/qmp.c:214) #8 0xaaaac55cb0cf in aio_bh_call (/usr/src/debug/qemu-4.1.0/util/async.c= :117) #9 0xaaaac55d4543 in aio_bh_poll (/usr/src/debug/qemu-4.1.0/util/aio-pos= ix.c:459) #10 0xaaaac55cae0f in aio_dispatch (/usr/src/debug/qemu-4.1.0/util/async= .c:268) #11 0xffffb52d6a7b in g_main_context_dispatch (/usr/lib64/libglib-2.0.so= .0+0x52a7b) #12 0xaaaac55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b) #13 0xaaaac4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb) #14 0xaaaac47f45ef(/usr/bin/qemu-kvm-4.1.0+0x8455ef) #15 0xffffb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f) #16 0xaaaac47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb) Direct leak of 2 byte(s) in 2 object(s) allocated from: #0 0xffffb597c20b in __interceptor_malloc (/usr/lib64/libasan.so.4+0xd32= 0b) #1 0xffffb52dcb1b in g_malloc (/usr/lib64/libglib-2.0.so.0+0x58b1b) #2 0xffffb52f8143 in g_strdup (/usr/lib64/libglib-2.0.so.0+0x74143) #3 0xaaaac5244893 in migrate_params_test_apply (/usr/src/debug/qemu-4.1.= 0/migration/migration.c:1382) #4 0xaaaac52fdca7 in qmp_migrate_set_parameters (/usr/src/debug/qemu-4.1= .0/qapi/qapi-commands-migration.c:192) #5 0xaaaac551d543 in qmp_dispatch (/usr/src/debug/qemu-4.1.0/qapi/qmp-di= spatch.c) #6 0xaaaac52a0a8f in qmp_dispatch (/usr/src/debug/qemu-4.1.0/monitor/qmp= .c:125) #7 0xaaaac52a1c7f in monitor_qmp_dispatch (/usr/src/debug/qemu-4.1.0/mon= itor/qmp.c:214) #8 0xaaaac55cb0cf in aio_bh_call (/usr/src/debug/qemu-4.1.0/util/async.c= :117) #9 0xaaaac55d4543 in aio_bh_poll (/usr/src/debug/qemu-4.1.0/util/aio-pos= ix.c:459) #10 0xaaaac55cae0f in in aio_dispatch (/usr/src/debug/qemu-4.1.0/util/as= ync.c:268) #11 0xffffb52d6a7b in g_main_context_dispatch (/usr/lib64/libglib-2.0.so= .0+0x52a7b) #12 0xaaaac55d1e3b(/usr/bin/qemu-kvm-4.1.0+0x1622e3b) #13 0xaaaac4e314bb(/usr/bin/qemu-kvm-4.1.0+0xe824bb) #14 0xaaaac47f45ef (/usr/bin/qemu-kvm-4.1.0+0x8455ef) #15 0xffffb4bfef3f in __libc_start_main (/usr/lib64/libc.so.6+0x23f3f) #16 0xaaaac47ffacb(/usr/bin/qemu-kvm-4.1.0+0x850acb) Signed-off-by: Chuan Zheng Reviewed-by: KeQian Zhu Reviewed-by: HaiLiang Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 4e658c397e..08519de56f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1343,12 +1343,12 @@ static void migrate_params_test_apply(MigrateSetPar= ameters *params, =20 if (params->has_tls_creds) { assert(params->tls_creds->type =3D=3D QTYPE_QSTRING); - dest->tls_creds =3D g_strdup(params->tls_creds->u.s); + dest->tls_creds =3D params->tls_creds->u.s; } =20 if (params->has_tls_hostname) { assert(params->tls_hostname->type =3D=3D QTYPE_QSTRING); - dest->tls_hostname =3D g_strdup(params->tls_hostname->u.s); + dest->tls_hostname =3D params->tls_hostname->u.s; } =20 if (params->has_max_bandwidth) { --=20 2.25.4 From nobody Sat May 18 09:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594657593; cv=none; d=zohomail.com; s=zohoarc; b=i39HiPUHOo3ErUKIEPG1hnNhCZHevt6jpJs0qllmiODa2L+cI4uvBuOklBGONiSMGG5Lcrk5pqtSc6VNmD8+kEx6Qiz2eq9yoA9zhZPv0nJxzQVa/0kZD9NDwPe0MecKIgbvnwf6US5zDyhXFXWhpeh7BSeKAL5VQn/QMrxDT/w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594657593; h=Content-Type:Content-Transfer-Encoding:Cc: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=yfIb0WoSohr36CI5PC7CR58EVtgqFNPY3VFIqPoN2Bk=; b=Z5V1le6Ss/tmVwCioIpHJXTo8u+txy2SFpjQ/SOAcBJ47qaWFQcMW+sjCtP04VsplwdewGOSE8hGByEUPYRBL75oYzoRDuy4ko0sNXlv3re/VOy6Y3aNaM4NFY/+WPkbd3GU24T2ijixz37cWzHxxk4RgeEbmzjgRIbN6f56Sl4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594657593102284.91539474336446; Mon, 13 Jul 2020 09:26:33 -0700 (PDT) Received: from localhost ([::1]:32910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jv1Hj-0001e1-QQ for importer@patchew.org; Mon, 13 Jul 2020 12:26:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jv1Fh-00008a-Aw for qemu-devel@nongnu.org; Mon, 13 Jul 2020 12:24:25 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46377 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jv1Fe-0003Bm-9C for qemu-devel@nongnu.org; Mon, 13 Jul 2020 12:24:25 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-9Lj3PjDoNMKmVrQ81NBzWA-1; Mon, 13 Jul 2020 12:24:17 -0400 Received: by mail-wm1-f72.google.com with SMTP id c124so75348wme.0 for ; Mon, 13 Jul 2020 09:24:17 -0700 (PDT) Received: from localhost (trasno.trasno.org. [83.165.45.250]) by smtp.gmail.com with ESMTPSA id y7sm24170187wrt.11.2020.07.13.09.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 09:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594657458; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yfIb0WoSohr36CI5PC7CR58EVtgqFNPY3VFIqPoN2Bk=; b=AuGzD9p74CklMtLPTA/0K5n8zcb73rOBefCAqz0dl3YYTjWRO3BOU7TJZYVyBNMEP8fefs Vb/nx4ueCnc6U9hSgO/ya7k9Ao0Ts6Z+HTusjdHNqScDr2hbm/QAcUr8zIGKbvsCuDaotU pP7u9hUHII9V3B0NgiDmfohux66sqQM= X-MC-Unique: 9Lj3PjDoNMKmVrQ81NBzWA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yfIb0WoSohr36CI5PC7CR58EVtgqFNPY3VFIqPoN2Bk=; b=dabUQ7FYw6NjG1+v/A5LmBENnF7bjciGq5xvsOF8hIbzlG59MoudgpOxtES/BUoZMt 3wXw6nLxmhearUxHSuNKbo+vXfKJOK2b/B33q5EDmB3LSMlwIlhvqe5fJmSUkBdl48JC 9gp3dr2yuP2mOukrFBKJLYRmOU+voLOj6rB0Y2DKhcA4kiMSmZsgY1yAZIRFPl+Mta/N 43S3HB5T4E2FgWDUvHqDGipJN6L/Pg6OfPCaqpqkbqkBWIbWa4JcsdN3oS+WzK/vfSdi 5Y1bNMrexWB7zWeU+K+G6NmoQx6yyflbBwrTbuDcvFpsWI+8LWET2+J1XlkvoLfLttuc 4/vw== X-Gm-Message-State: AOAM531AzmhK7eYM/vQrNWkuR+M1JcX9CP3ZKX0TQ56m9ltc8HpYbBYw vRK070hhOm5DtVf3SutrWaA7ENvq2DQQ2KoZJzGD0cT+RP1aax5Fqt8Ad98KWNb5lXzV07ZdUka 1qTpg8S6gVzZ6I/c= X-Received: by 2002:adf:f34e:: with SMTP id e14mr105240wrp.299.1594657456147; Mon, 13 Jul 2020 09:24:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSlrhKWVoCLF6tFLsTt5zcpG7y3hBnMGxp/7hsM6fDML95BUHkMregMTet+ZCwLnYL63yQ1A== X-Received: by 2002:adf:f34e:: with SMTP id e14mr105126wrp.299.1594657455015; Mon, 13 Jul 2020 09:24:15 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH v3 2/3] migration/savevm: respect qemu_fclose() error code in save_snapshot() Date: Mon, 13 Jul 2020 18:24:09 +0200 Message-Id: <20200713162410.11577-3-quintela@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200713162410.11577-1-quintela@redhat.com> References: <20200713162410.11577-1-quintela@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 01:36:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Fam Zheng , Vladimir Sementsov-Ogievskiy , Juan Quintela , "Dr. David Alan Gilbert" , Max Reitz , Denis Plotnikov , quintela@trasno.org, Stefan Hajnoczi , "Denis V. Lunev" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: "Denis V. Lunev" qemu_fclose() could return error, f.e. if bdrv_co_flush() will return the error. This validation will become more important once we will start waiting of asynchronous IO operations, started from bdrv_write_vmstate(), which are coming soon. Signed-off-by: Denis V. Lunev Reviewed-by: "Dr. David Alan Gilbert" Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Juan Quintela CC: Kevin Wolf CC: Max Reitz CC: Stefan Hajnoczi CC: Fam Zheng CC: Juan Quintela CC: Denis Plotnikov Signed-off-by: Juan Quintela --- migration/savevm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index 6e01724605..45c9dd9d8a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2635,7 +2635,7 @@ int save_snapshot(const char *name, Error **errp) { BlockDriverState *bs, *bs1; QEMUSnapshotInfo sn1, *sn =3D &sn1, old_sn1, *old_sn =3D &old_sn1; - int ret =3D -1; + int ret =3D -1, ret2; QEMUFile *f; int saved_vm_running; uint64_t vm_state_size; @@ -2719,10 +2719,14 @@ int save_snapshot(const char *name, Error **errp) } ret =3D qemu_savevm_state(f, errp); vm_state_size =3D qemu_ftell(f); - qemu_fclose(f); + ret2 =3D qemu_fclose(f); if (ret < 0) { goto the_end; } + if (ret2 < 0) { + ret =3D ret2; + goto the_end; + } =20 /* The bdrv_all_create_snapshot() call that follows acquires the AioCo= ntext * for itself. BDRV_POLL_WHILE() does not support nested locking beca= use --=20 2.25.4 From nobody Sat May 18 09:22:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594657744; cv=none; d=zohomail.com; s=zohoarc; b=eY0G0gDuV7Q+ImNJOlzV5NrvTkvS4VwWOUfUQQY59Tf8SmFSBIxfFkbPqsSKzZDIcU0eWogvJDksAsWyvafZO7aDBpyWtRzSdPUDrvNK05Pg4O9OKVzAQqkuYUPHjf2cvwvz7WwCzykjnBrfRaymmmXS/wo1G8K85I2ns2AZPgY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594657744; h=Content-Type:Content-Transfer-Encoding:Cc: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=FSXs5uHMzPA+HV1XAvpWMRauXPt+1ol/OUGDFgw63qY=; b=dDsqbK8RtcOEdy0Ocb5p7nOdPWS1WTttLnUyWmSvBFLcokhAQqzxcKjMPBZdDHa1PVeGydyxivrzQwNBCittLBYLAMO7v8VcXaIWfe0czw0IuxMVobcl/P61g/+PMQ3dAyIdMo515VCs4Zg0WsJlZi9V/ySaVSXaUADG4XafY7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594657744089125.10176052046404; Mon, 13 Jul 2020 09:29:04 -0700 (PDT) Received: from localhost ([::1]:39242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jv1KA-0004Lr-Tt for importer@patchew.org; Mon, 13 Jul 2020 12:29:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jv1Fi-00009g-8A for qemu-devel@nongnu.org; Mon, 13 Jul 2020 12:24:26 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:60082 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jv1Fe-0003Bq-8d for qemu-devel@nongnu.org; Mon, 13 Jul 2020 12:24:25 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-Ixvqw307NsmdRK9YeqjLrQ-1; Mon, 13 Jul 2020 12:24:18 -0400 Received: by mail-wm1-f72.google.com with SMTP id b13so51428wme.9 for ; Mon, 13 Jul 2020 09:24:17 -0700 (PDT) Received: from localhost (trasno.trasno.org. [83.165.45.250]) by smtp.gmail.com with ESMTPSA id 5sm160256wmk.9.2020.07.13.09.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 09:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594657459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FSXs5uHMzPA+HV1XAvpWMRauXPt+1ol/OUGDFgw63qY=; b=gu3xPkgmrz5aa2Sinb4LLFLu9N1h3A+uIXV6F+zjcXU+u/2hNAzVvM9kzMBU5sLtUuvTVE hhAsWk31hSXkiiJNAXVMYNJyrlro+gE7HbDQVI0Qd36CNSRiSGDvNeKHvAN8ix3MISzRfh MPUc/C+mN/BI9kmbbSOsrEX7oaBcKko= X-MC-Unique: Ixvqw307NsmdRK9YeqjLrQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FSXs5uHMzPA+HV1XAvpWMRauXPt+1ol/OUGDFgw63qY=; b=AwaWiY9rIC1YJEeDpGURZWNJ10QmEvjCp1FOrsSEtpYFt4YIrFedQN5K7eGSaW9ids zQWni9Xko9DFY9YEYfqkdRYupyxykqdEuoMT4+LwCG4uEJpp4OU5t32jbt+Hhodejfcz /ABAxH3AxWECYzOMKTajc15b3vL0hfTaqVLuxJ4Z9MgCgX+bNiyHLQPTHK5b/6kjy90w 8ZVDfyf9L4/1ltMl1dBUtOJCH/semxXQbV9eQs6cU7Lop2f4jGZOQ5deJcOLPztQmCCl JyK08O0GnOZ4qgJy/gcAbZkscYKciHS9cAiNTjnGnx18NWvXCi/Kr1lUi81g1cshg4Ae oTuQ== X-Gm-Message-State: AOAM531qPnZRxhkd9yQCBOunlZbEvlD9ahZzsTFFhuOFB992Tuw8TKr4 1RizVsFAAYlWkkhIOYHab5scFVeR4nVIfnjA11M64fyE+SQCI+/SLYjkJ0emUfPGr18jRKAMFZB /l9SERk7twjV53dw= X-Received: by 2002:a5d:4991:: with SMTP id r17mr129187wrq.1.1594657456617; Mon, 13 Jul 2020 09:24:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlyu/vttlSbFE4bghzHFeKyoRFT9d/rv6UBkI5ixk1yVGOdtCkBnNyfDSuDKIRIFQ8vG+FIQ== X-Received: by 2002:a5d:4991:: with SMTP id r17mr129170wrq.1.1594657456432; Mon, 13 Jul 2020 09:24:16 -0700 (PDT) From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PATCH v3 3/3] migration/migration.c: Remove superfluous breaks Date: Mon, 13 Jul 2020 18:24:10 +0200 Message-Id: <20200713162410.11577-4-quintela@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200713162410.11577-1-quintela@redhat.com> References: <20200713162410.11577-1-quintela@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=quintela@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/13 02:19:41 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yi Wang , Thomas Huth , Juan Quintela , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" , quintela@trasno.org, Liao Pingfang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Liao Pingfang Remove superfluous breaks, as there is a "return" before them. Signed-off-by: Liao Pingfang Signed-off-by: Yi Wang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Juan Quintela --- migration/migration.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 08519de56f..2ed9923227 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -986,7 +986,6 @@ static void fill_source_migration_info(MigrationInfo *i= nfo) /* no migration has happened ever */ /* do not overwrite destination migration status */ return; - break; case MIGRATION_STATUS_SETUP: info->has_status =3D true; info->has_total_time =3D false; @@ -1105,7 +1104,6 @@ static void fill_destination_migration_info(Migration= Info *info) switch (mis->state) { case MIGRATION_STATUS_NONE: return; - break; case MIGRATION_STATUS_SETUP: case MIGRATION_STATUS_CANCELLING: case MIGRATION_STATUS_CANCELLED: --=20 2.25.4