get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2225796/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2225796,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2225796/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260421155219.14506-1-viking4@gmail.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260421155219.14506-1-viking4@gmail.com>",
    "list_archive_url": null,
    "date": "2026-04-21T15:52:19",
    "name": "migration/vmstate: replace NULL pointer assert with proper error",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "2a00643a5b5d19ea98195c6e732fb6a498c9bd6b",
    "submitter": {
        "id": 92831,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/92831/?format=api",
        "name": "Trieu Huynh",
        "email": "vikingtc4@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260421155219.14506-1-viking4@gmail.com/mbox/",
    "series": [
        {
            "id": 500840,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/500840/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500840",
            "date": "2026-04-21T15:52:19",
            "name": "migration/vmstate: replace NULL pointer assert with proper error",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500840/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2225796/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2225796/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=RzvqIZGf;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0Rh93PwCz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 01:52:41 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wFDOr-0001pp-Kq; Tue, 21 Apr 2026 11:52:33 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <vikingtc4@gmail.com>)\n id 1wFDOp-0001pb-Ms\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 11:52:31 -0400",
            "from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <vikingtc4@gmail.com>)\n id 1wFDOn-000258-QT\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 11:52:31 -0400",
            "by mail-pf1-x42a.google.com with SMTP id\n d2e1a72fcca58-82d0b68837aso2872031b3a.2\n for <qemu-devel@nongnu.org>; Tue, 21 Apr 2026 08:52:28 -0700 (PDT)",
            "from localhost.localdomain ([42.114.219.141])\n by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82f8e981a0asm14848193b3a.3.2026.04.21.08.52.25\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 21 Apr 2026 08:52:27 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776786748; x=1777391548; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=3xAss2Zrtrg0dH9Eea4Ig0ZJK+cZEfXpf8g8d6E127s=;\n b=RzvqIZGf82Vm3aWGrHxg5iFogZdpjYHNBA5oJBDlNRAXcw0IHB31VpV4u32Ew39hLb\n A1ILIgKn0c20P9Udkt0XG54yauL9aLpbl1xUiAEsd1mJfEbMjtXoIz+wt06gDL5buDSY\n HWgdlx7lyf1iTK+P5HIyRg81IsDahroQqDLPr5IHc+eQW3yqRYJ/jnSFMGD5Iim4YpbV\n c9P9CRSSmLn18u1J4vlM2ZFUU1HaJYubAmPiAf1zgHkEplEmuY3Rmq8c7Z1J6lvr+buX\n yieEDjfY0FBpTLqKuqVDnbT6yaMIkcP7/nn2s3L2DS15ImaKQWIFa1yPGMSxDjFFURcP\n zT7Q==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776786748; x=1777391548;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=3xAss2Zrtrg0dH9Eea4Ig0ZJK+cZEfXpf8g8d6E127s=;\n b=c51YMrW7zP21wDxyPUayvWklhn8h7VmFbTeQ4FC296+qdeyZfmebhxzKOgQFKJN2UT\n h6ivW7xr2lW26fxvW30JNIb3RfTLn0S9v3GtvfwpF1huy+0Md21apNqaWDCzCuzZN/ys\n w8duDkTCLllDSe9XhyG7qcsh3X/wzDcKsRFD221cpF2sowrtS8eQ0PJ9fH1t8tdF/1Tz\n CCjc0Z9irggJ6MtEJEmJSGRAyE1CU4LD/pw4/HrGIM8vf+wbI/5VpKlS/vIZoY4JrE3T\n xmkAk0j8dFJ28vLGKB9trpKsjj+J76uJhIYW80oWLeZG2FgLpClv1OG67T9+XHE87YGI\n Z7gA==",
        "X-Gm-Message-State": "AOJu0Yw//5LIhr3YydI2VJQrXAWuW3fjCnQ9GX2gPQu2WHL8AmRqnPio\n WDAj/VdHbMzgGANdluObtvt6naVAv0zKNMQI+Ukz1RZAFAZ1SpYVO0bI5sBvAGT1",
        "X-Gm-Gg": "AeBDieswKTais8l0yk9z24Qi7chcpfTqnm4EJkxpD6ZYA0sm4iup7ciTcCAJ/L68yz7\n IiZnqMhTWiuqVsp8n64Mi+3IcpDF6alsMIpj7/1LFLeMHQ2/inMAqB/zXjk69NOb1zNK+8kai31\n 20bQktFbKz1FlRh4N2aRPM7uiSgTfm+Jb5pTbwuUswWca8z6tCp2YtPHdjtlRUaZbUDs+G8C0C1\n GmtghPuw9UBnhgMnurSeiwPH//oCX+irqEbpt9wTX9OHhNrFbFpuxvN2aYyIO00rvCRUa1oRMF/\n I3TFNoZu1uNuyfIBbcWc/SvnGF3LTfXYjV8HfcLKnIjlPU25R4Tr01Ra6W4ZChCPv6o8JHS4wIz\n yWHm9snYhlskpqSEUvcBvtUd3eVjca1CZUQW90SVhUxZyhfrVl8gJDicGlFPb57OZTKHWClitb3\n Vp8oas7HpuE6clZMuOcgQFMYhu+FBJM/thmK7tGdxsGG4Nr2HYqGxhbODAzQ==",
        "X-Received": "by 2002:a05:6a00:908a:b0:81f:9b4c:81c0 with SMTP id\n d2e1a72fcca58-82f8c90c380mr21266848b3a.41.1776786747592;\n Tue, 21 Apr 2026 08:52:27 -0700 (PDT)",
        "From": "Trieu Huynh <vikingtc4@gmail.com>",
        "X-Google-Original-From": "Trieu Huynh <viking4@gmail.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Trieu Huynh <vikingtc4@gmail.com>, Peter Xu <peterx@redhat.com>,\n Fabiano Rosas <farosas@suse.de>",
        "Subject": "[PATCH] migration/vmstate: replace NULL pointer assert with proper\n error",
        "Date": "Tue, 21 Apr 2026 22:52:19 +0700",
        "Message-ID": "<20260421155219.14506-1-viking4@gmail.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::42a;\n envelope-from=vikingtc4@gmail.com; helo=mail-pf1-x42a.google.com",
        "X-Spam_score_int": "-17",
        "X-Spam_score": "-1.8",
        "X-Spam_bar": "-",
        "X-Spam_report": "(-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "From: Trieu Huynh <vikingtc4@gmail.com>\n\nvmstate_load_state() contains an assert added in commit\n(\"migration/vmstate: split up vmstate_base_addr\" [1])\nto catch NULL pointer dereferences early:\n\n  assert(first_elem || !n_elems || !size);\n\nHowever, the assert fires as an unrecoverable crash in a valid user\nscenario, for instance: loading a snapshot saved with -icount auto\ninto a QEMU started without -icount. The \"timer/icount/warp_timer\"\nsubsection is present in the stream, but icount_warp_timer is NULL\nbecause icount was never initialized. QEMU aborts with:\n\n  qemu-system-x86_64: ../migration/vmstate.c:185:\n  vmstate_load_state: Assertion `first_elem || !n_elems || !size'\n  failed.\n\nReplace the assert with a proper error_setg() and -EINVAL return so\nQEMU reports a clear diagnostic instead of crashing.\n\nAlso remove the error_prepend() in vmstate_subsection_load() that\nwrapped the error at each subsection level, producing a redundant and\nnoisy error chain. The original error message is now propagated as-is.\n\n[1] https://lore.kernel.org/qemu-devel/20170228124056.5074-4-dgilbert@redhat.com/\nResolves: https://gitlab.com/qemu-project/qemu/-/work_items/2736\n\nSigned-off-by: Trieu Huynh <vikingtc4@gmail.com>\n---\nSteps to reproduce:\n* 1. Start src with icount config:\n./qemu-system-x86_64 \\\n  -icount auto \\\n  -<other_options>\n\n* 2. Save snapshot\n(qemu) savevm snap1\n\n* 3. Start dest without icount config:\n./qemu-system-x86_64 \\\n  -<other_options>\n\n* 4. Load snapshot\n* As-is:\n~ # QEMU 10.2.94 monitor - type 'help' for more information\n(qemu) loadvm snap1\nqemu-system-x86_64: ../migration/vmstate.c:185: vmstate_load_state:\nAssertion `first_elem || !n_elems || !size' failed.\nAborted (core dumped)\n\n* To-be:\n** Before removing error_prepend()\n~ # QEMU 10.2.94 monitor - type 'help' for more information\n(qemu) loadvm snap1\nError: error while loading state for instance 0x0 of device 'timer':\nLoading VM subsection 'timer/icount' in 'timer' failed: -22:\nLoading VM subsection 'timer/icount/warp_timer' in 'timer/icount' failed: -22:\nVM load of device 'timer/icount/warp_timer': field 'icount_warp_timer'\nis a NULL pointer but snapshot contains data for it.\n\n** After removing error_prepend()\n~ # QEMU 10.2.94 monitor - type 'help' for more information\n(qemu) loadvm snap1\nError: error while loading state for instance 0x0 of device 'timer':\nVM load of device 'timer/icount/warp_timer': field 'icount_warp_timer'\nis a NULL pointer but snapshot contains data for it.\n\n migration/vmstate.c | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/migration/vmstate.c b/migration/vmstate.c\nindex 4d28364f7b..32ecc8ed35 100644\n--- a/migration/vmstate.c\n+++ b/migration/vmstate.c\n@@ -182,7 +182,13 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,\n             vmstate_handle_alloc(first_elem, field, opaque);\n             if (field->flags & VMS_POINTER) {\n                 first_elem = *(void **)first_elem;\n-                assert(first_elem || !n_elems || !size);\n+                if (!first_elem && n_elems && size) {\n+                    error_setg(errp,\n+                               \"VM load of device '%s': field '%s' is a NULL \"\n+                               \"pointer but snapshot contains data for it.\",\n+                               vmsd->name, field->name);\n+                    return -EINVAL;\n+                }\n             }\n             for (i = 0; i < n_elems; i++) {\n                 void *curr_elem = first_elem + size * i;\n@@ -651,9 +657,6 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,\n         ret = vmstate_load_state(f, sub_vmsd, opaque, version_id, errp);\n         if (ret) {\n             trace_vmstate_subsection_load_bad(vmsd->name, idstr, \"(child)\");\n-            error_prepend(errp,\n-                          \"Loading VM subsection '%s' in '%s' failed: %d: \",\n-                          idstr, vmsd->name, ret);\n             return ret;\n         }\n     }\n",
    "prefixes": []
}