Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2194992/?format=api
{ "id": 2194992, "url": "http://patchwork.ozlabs.org/api/patches/2194992/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260210112436.315197-2-osteffen@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/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": "<20260210112436.315197-2-osteffen@redhat.com>", "list_archive_url": null, "date": "2026-02-10T11:24:36", "name": "[1/1] igvm: Add NULL checks for igvm_get_buffer()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "2d295740d75f66ce7829aff913c93cdc503c85f3", "submitter": { "id": 91181, "url": "http://patchwork.ozlabs.org/api/people/91181/?format=api", "name": "Oliver Steffen", "email": "osteffen@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260210112436.315197-2-osteffen@redhat.com/mbox/", "series": [ { "id": 491655, "url": "http://patchwork.ozlabs.org/api/series/491655/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=491655", "date": "2026-02-10T11:24:35", "name": "igvm: Add NULL checks for igvm_get_buffer()", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491655/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2194992/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2194992/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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=jNw0zy1t;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.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 4f9K434wQbz1xtV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 22:25:23 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vplrM-0003l3-LV; Tue, 10 Feb 2026 06:24:48 -0500", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <osteffen@redhat.com>)\n id 1vplrL-0003ke-Nr\n for qemu-devel@nongnu.org; Tue, 10 Feb 2026 06:24:47 -0500", "from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <osteffen@redhat.com>)\n id 1vplrK-0007Lw-28\n for qemu-devel@nongnu.org; Tue, 10 Feb 2026 06:24:47 -0500", "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-KLLloTtcODyObOuwRKDASQ-1; Tue,\n 10 Feb 2026 06:24:44 -0500", "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 299881800465\n for <qemu-devel@nongnu.org>; Tue, 10 Feb 2026 11:24:43 +0000 (UTC)", "from osteffen-thinkpadx1carbongen12.rmtde.csb (unknown\n [10.44.32.26])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 46A7418003F5; Tue, 10 Feb 2026 11:24:40 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1770722685;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=w+P+r8J1Ki0gjCmax5Qvp7m+UKxoCgT5HwqLkgCdBAU=;\n b=jNw0zy1txwivZrR4MH6myeLRRHpulzlpjvAAi5hjkTyeIjUbLV0Va6+MndpTtM5oKsXTTt\n R53IWrjYT2vGb9mS2NMXd5JVNTtcGVFO5M8YbTNYM7xiM9nSHokTqL6VSqQo7y+z9V+hAF\n MgPfJesEO29pWYt/rqZZUM5ge0raqU8=", "X-MC-Unique": "KLLloTtcODyObOuwRKDASQ-1", "X-Mimecast-MFC-AGG-ID": "KLLloTtcODyObOuwRKDASQ_1770722683", "From": "Oliver Steffen <osteffen@redhat.com>", "To": "qemu-devel@nongnu.org", "Cc": "Gerd Hoffmann <kraxel@redhat.com>,\n Stefano Garzarella <sgarzare@redhat.com>, Ani Sinha <anisinha@redhat.com>,\n Oliver Steffen <osteffen@redhat.com>", "Subject": "[PATCH 1/1] igvm: Add NULL checks for igvm_get_buffer()", "Date": "Tue, 10 Feb 2026 12:24:36 +0100", "Message-ID": "<20260210112436.315197-2-osteffen@redhat.com>", "In-Reply-To": "<20260210112436.315197-1-osteffen@redhat.com>", "References": "<20260210112436.315197-1-osteffen@redhat.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111", "Received-SPF": "pass client-ip=170.10.133.124;\n envelope-from=osteffen@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com", "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, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-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", "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": "According to the documentation we are supposed to do a null-pointer\ncheck on the buffers returned by igvm_get_buffer() (part of the IGVM C\nlibrary).\nAdd these checks in the IGVM backend.\n\nSigned-off-by: Oliver Steffen <osteffen@redhat.com>\n---\n backends/igvm.c | 86 ++++++++++++++++++++++++++++++++-----------------\n 1 file changed, 56 insertions(+), 30 deletions(-)", "diff": "diff --git a/backends/igvm.c b/backends/igvm.c\nindex b01a19ba46..049cb36891 100644\n--- a/backends/igvm.c\n+++ b/backends/igvm.c\n@@ -152,9 +152,17 @@ static int qigvm_handler(QIgvm *ctx, uint32_t type, Error **errp)\n (int)header_handle);\n return -1;\n }\n- header_data = igvm_get_buffer(ctx->file, header_handle) +\n- sizeof(IGVM_VHS_VARIABLE_HEADER);\n- result = handlers[handler].handler(ctx, header_data, errp);\n+ header_data = igvm_get_buffer(ctx->file, header_handle);\n+ if (header_data != NULL) {\n+ header_data += sizeof(IGVM_VHS_VARIABLE_HEADER);\n+ result = handlers[handler].handler(ctx, header_data, errp);\n+ } else {\n+ error_setg(errp,\n+ \"IGVM: No buffer for handle %d: \"\n+ \"(type 0x%X)\",\n+ header_handle, type);\n+ result = -1;\n+ }\n igvm_free_buffer(ctx->file, header_handle);\n return result;\n }\n@@ -316,7 +324,13 @@ static int qigvm_process_mem_region(QIgvm *ctx, unsigned start_index,\n return -1;\n }\n data = igvm_get_buffer(ctx->file, data_handle);\n- memcpy(®ion[page_index * page_size], data, data_size);\n+ if (data != NULL) {\n+ memcpy(®ion[page_index * page_size], data, data_size);\n+ } else {\n+ error_setg(errp, \"IGVM: No buffer for handle %d: \", data_handle);\n+ igvm_free_buffer(ctx->file, data_handle);\n+ return -1;\n+ }\n igvm_free_buffer(ctx->file, data_handle);\n }\n }\n@@ -426,6 +440,11 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,\n }\n \n data = (uint8_t *)igvm_get_buffer(ctx->file, data_handle);\n+ if (data == NULL) {\n+ error_setg(errp, \"IGVM: No buffer for handle %d: \", data_handle);\n+ result = -1;\n+ goto exit;\n+ }\n \n if (ctx->machine_state->cgs) {\n result = ctx->cgsc->set_guest_state(\n@@ -441,6 +460,7 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,\n result = -1;\n }\n \n+exit:\n igvm_free_buffer(ctx->file, data_handle);\n if (result < 0) {\n return result;\n@@ -778,33 +798,39 @@ static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp)\n }\n platform =\n (IGVM_VHS_SUPPORTED_PLATFORM *)(igvm_get_buffer(ctx->file,\n- header_handle) +\n- sizeof(\n- IGVM_VHS_VARIABLE_HEADER));\n- if ((platform->platform_type == IGVM_PLATFORM_TYPE_SEV_ES) &&\n- ctx->machine_state->cgs) {\n- if (ctx->cgsc->check_support(\n- CGS_PLATFORM_SEV_ES, platform->platform_version,\n- platform->highest_vtl, platform->shared_gpa_boundary)) {\n- compatibility_mask_sev_es = platform->compatibility_mask;\n- }\n- } else if ((platform->platform_type == IGVM_PLATFORM_TYPE_SEV) &&\n- ctx->machine_state->cgs) {\n- if (ctx->cgsc->check_support(\n- CGS_PLATFORM_SEV, platform->platform_version,\n- platform->highest_vtl, platform->shared_gpa_boundary)) {\n- compatibility_mask_sev = platform->compatibility_mask;\n+ header_handle));\n+ if (platform != NULL) {\n+ platform = (IGVM_VHS_SUPPORTED_PLATFORM *)((void *)platform\n+ + sizeof(IGVM_VHS_VARIABLE_HEADER));\n+ if ((platform->platform_type == IGVM_PLATFORM_TYPE_SEV_ES) &&\n+ ctx->machine_state->cgs) {\n+ if (ctx->cgsc->check_support(\n+ CGS_PLATFORM_SEV_ES, platform->platform_version,\n+ platform->highest_vtl, platform->shared_gpa_boundary)) {\n+ compatibility_mask_sev_es = platform->compatibility_mask;\n+ }\n+ } else if ((platform->platform_type == IGVM_PLATFORM_TYPE_SEV) &&\n+ ctx->machine_state->cgs) {\n+ if (ctx->cgsc->check_support(\n+ CGS_PLATFORM_SEV, platform->platform_version,\n+ platform->highest_vtl, platform->shared_gpa_boundary)) {\n+ compatibility_mask_sev = platform->compatibility_mask;\n+ }\n+ } else if ((platform->platform_type ==\n+ IGVM_PLATFORM_TYPE_SEV_SNP) &&\n+ ctx->machine_state->cgs) {\n+ if (ctx->cgsc->check_support(\n+ CGS_PLATFORM_SEV_SNP, platform->platform_version,\n+ platform->highest_vtl, platform->shared_gpa_boundary)) {\n+ compatibility_mask_sev_snp = platform->compatibility_mask;\n+ }\n+ } else if (platform->platform_type == IGVM_PLATFORM_TYPE_NATIVE) {\n+ compatibility_mask = platform->compatibility_mask;\n }\n- } else if ((platform->platform_type ==\n- IGVM_PLATFORM_TYPE_SEV_SNP) &&\n- ctx->machine_state->cgs) {\n- if (ctx->cgsc->check_support(\n- CGS_PLATFORM_SEV_SNP, platform->platform_version,\n- platform->highest_vtl, platform->shared_gpa_boundary)) {\n- compatibility_mask_sev_snp = platform->compatibility_mask;\n- }\n- } else if (platform->platform_type == IGVM_PLATFORM_TYPE_NATIVE) {\n- compatibility_mask = platform->compatibility_mask;\n+ } else {\n+ error_setg(errp, \"IGVM: No buffer for handle %d: \", header_handle);\n+ igvm_free_buffer(ctx->file, header_handle);\n+ return -1;\n }\n igvm_free_buffer(ctx->file, header_handle);\n }\n", "prefixes": [ "1/1" ] }