From nobody Tue Feb 10 10:07:49 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1768373302; cv=none; d=zohomail.com; s=zohoarc; b=knjOkot+yTpZA5ctJhTzjwVMvutVg16apHrW9cZXy4QChqhBhZm0ky7eng6E6Ck8U/VzZew9XpMmJ17Ox/Wdp9MRGvXcKnRFYqs+E9cMiuca6hrHqtCVOvD0Rn6FmjFp4/R0bNB2LITp/txGcl8OXYV6jOpgDStk9kzT2HnlT8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768373302; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=A8aHx7NDG7I0eOLZpPn11ukQ0g9iIT0KmhKkmcwKQQA=; b=n4dO1l0WdoJNGlr4zgmf2kOMT0qI2c4agT/MhiMZMbTA9BCGIuy/uG+UOWv+RT0NK4jBxiRBu9Ej2tJh8AjZ1f03F1JNNi9MPqBCzvi3AH0x3df7U58FI8b4JPhgzBp71d6BQKbDM438A4+GpPFP2mGYTDNEKrOc3xfbY85a7jM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1768373302089468.3189123298564; Tue, 13 Jan 2026 22:48:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vfufD-0001sJ-NX; Wed, 14 Jan 2026 01:47:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vfuf2-0001pm-Uf for qemu-devel@nongnu.org; Wed, 14 Jan 2026 01:47:21 -0500 Received: from forwardcorp1d.mail.yandex.net ([178.154.239.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vfuf0-0004A0-Q4 for qemu-devel@nongnu.org; Wed, 14 Jan 2026 01:47:20 -0500 Received: from mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:65a0:0:640:e1de:0]) by forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id 7FD2C807B9; Wed, 14 Jan 2026 09:47:14 +0300 (MSK) Received: from vsementsov-lin.. (unknown [2a02:6bf:8080:c88::1:7]) by mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id ClNQD90AqW20-3AvZsROj; Wed, 14 Jan 2026 09:47:14 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1768373234; bh=A8aHx7NDG7I0eOLZpPn11ukQ0g9iIT0KmhKkmcwKQQA=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=nWOJWikNpKQQ0UqfdnWhaDDn0NLiJgcDD2r9vRt0yMjsBmDjsaOYyCqhU8Y1jP2er fUtl7lYX15v3SPyedtsgW7DmdBK06mFPqOfINRjXw+HB/W0ejIAkcd4Gi5blxMOiFy yAYgKmBg+1NRj6vB0QepyF6uiTwOCj8Ukxt/7zSc= Authentication-Results: mail-nwsmtp-smtp-corp-main-56.klg.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: peterx@redhat.com Cc: farosas@suse.de, qemu-devel@nongnu.org, dtalexundeer@yandex-team.ru, vsementsov@yandex-team.ru, yc-core@yandex-team.ru, d-tatianin@yandex-team.ru Subject: [PATCH 1/5] vmstate-types: get_fd(): handle qemu_file_get_fd() failure Date: Wed, 14 Jan 2026 09:47:06 +0300 Message-ID: <20260114064710.176268-2-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20260114064710.176268-1-vsementsov@yandex-team.ru> References: <20260114064710.176268-1-vsementsov@yandex-team.ru> MIME-Version: 1.0 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 (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=178.154.239.200; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1d.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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.29 List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1768373304186158500 Content-Type: text/plain; charset="utf-8" qemu_file_get_fd() may fail, and return -1 in this case. We don't support passing "invalid" file descriptors (like -1), so we should not interpret error here like invalid descriptor. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas --- migration/vmstate-types.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c index 4b01dc19c2..e34bf4486e 100644 --- a/migration/vmstate-types.c +++ b/migration/vmstate-types.c @@ -321,12 +321,21 @@ const VMStateInfo vmstate_info_uint64 =3D { static int get_fd(QEMUFile *f, void *pv, size_t size, const VMStateField *field) { + int fd; int32_t *v =3D pv; + if (migrate_mode() =3D=3D MIG_MODE_CPR_EXEC) { qemu_get_sbe32s(f, v); return 0; } - *v =3D qemu_file_get_fd(f); + + fd =3D qemu_file_get_fd(f); + if (fd < 0) { + return -1; + } + + *v =3D fd; + return 0; } =20 --=20 2.48.1