From nobody Mon Feb 9 13:38:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1620234083; cv=none; d=zohomail.com; s=zohoarc; b=gFI9K9Egvs7wtMsX+3z00OLaMqlIAgkFWblW3AIPHScJmrxuS2RuqkSyeXK51IFy0FL+KaYnyeitXhE44OnRMkJ3RgOFZmWNddl1nAA+VvCAP1f4zSBbkPNa6mVy7eotL13GOR4yPq7wstHearX70mzBiTOiRUt82Tmhm24EwKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620234083; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=HTcbf9xflzHTyoKg03h2p2pH+wnGCXbbU65n0yQBFMc=; b=XxFxP2HXDCCjZLJf1feWDIHqr0hJQ45CPcWnHL9nCTOuwKCeOvtDwaDCAzWuprTVZz4Dqou2wDpKgwUylBqT8yKutokg1lesCbJq69fCtI0Zlx6ePieAsmKMbstgHip31ptQNbjAKlAVx4XM4KvvfXRnonQMTgkOlLQOyZIQLRU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1620234083767371.7532286569085; Wed, 5 May 2021 10:01:23 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-333-QpcZCxBgP82tJozEs9Mwsg-1; Wed, 05 May 2021 13:01:17 -0400 Received: by mail-wm1-f70.google.com with SMTP id d9-20020a1cb4090000b02901494f55f719so669374wmf.9 for ; Wed, 05 May 2021 10:01:17 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (astrasbourg-653-1-188-220.w90-13.abo.wanadoo.fr. [90.13.127.220]) by smtp.gmail.com with ESMTPSA id v18sm24213571wro.18.2021.05.05.10.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 10:01:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620234081; 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=HTcbf9xflzHTyoKg03h2p2pH+wnGCXbbU65n0yQBFMc=; b=K8gKFmu9yTBrosTAimskoQ/uu6E+3r6SbzMgst8EWal2HU4mKhhJuEGg58kKyGiGTxxSTs g/jNuOj9jv/Mbu+pMwCacXV0QCmLWdO+y8dxs8ktfNSUO4pKVL+X6F9CN++wz+bAen6+GJ fAimuBzMzwVfLrvaCCfNNoes8/iy0Ng= X-MC-Unique: QpcZCxBgP82tJozEs9Mwsg-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=HTcbf9xflzHTyoKg03h2p2pH+wnGCXbbU65n0yQBFMc=; b=gevyt6ZJbCnY7c12bpHNwpyqVJPIWod5al3q2gjhpcsHca10HOLAwuQ4gdtQnqtOlI 456Zuej+h6uBeHFcsiOtFEV/ZiEDmI3ivTQXm76HKGhl8otXA/IrHS/+IiBm46LnHIqM MKoz4oHH9UsrPncRGyKtPZXNVvKitLU49/Cul//u6/fTHjynAb4UI3Le9MPcvNAMhE8V cdwpBH6PWinpGsRcFTqB59dU3Gu7BtSfkHwZqJY0Bc+EcxEJT2rX21N+MsE4NF4l5KKD U6+6pXtqMTAHu9SvRiLRbasZiSFz75thkXuetu4BTMRRR8TU7omnjWR/rD/E+vB3jZIF URiA== X-Gm-Message-State: AOAM533NEhhmtVV2FOQ6iZxUNSqRGYQ7+lgld2GnepbeuTmMtV6o12PV 9pTFS3BW3mbpGzQKU9K7WcXiR56bI9gh/oFLF/LvH8UGPlvNIeXxQQgh2HFdOPDt2E/EXM0fg69 1H593tWlGfUZuew== X-Received: by 2002:a05:6000:1789:: with SMTP id e9mr46343wrg.110.1620234076803; Wed, 05 May 2021 10:01:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVNOl9XyhslOnr9Z5qwwLZOpH94LvB1BxuuJ5+7dkBrOMXzT4/nk0o52wVuxUxBRv/bIV84Q== X-Received: by 2002:a05:6000:1789:: with SMTP id e9mr46326wrg.110.1620234076675; Wed, 05 May 2021 10:01:16 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , David Gibson , Paolo Bonzini , Warner Losh , Kyle Evans , Greg Kurz , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PATCH 4/5] gdbstub: Replace alloca() by g_new() Date: Wed, 5 May 2021 19:00:54 +0200 Message-Id: <20210505170055.1415360-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210505170055.1415360-1-philmd@redhat.com> References: <20210505170055.1415360-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The ALLOCA(3) man-page mentions its "use is discouraged". Replace it by a g_new() call. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- gdbstub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 0d5569ee539..72b4be89c7b 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1475,7 +1475,9 @@ static int process_string_cmd(void *user_ctx, const c= har *data, const GdbCmdParseEntry *cmds, int num_cmds) { int i, schema_len, max_num_params =3D 0; - GdbCmdContext gdb_ctx; + g_autofree GdbCmdVariant *params =3D g_new(GdbCmdVariant, + GDB_CMD_PARSE_ENTRY_SCHEMA_SIZE / = 2); + GdbCmdContext gdb_ctx =3D { .params =3D params }; =20 if (!cmds) { return -1; @@ -1499,8 +1501,6 @@ static int process_string_cmd(void *user_ctx, const c= har *data, max_num_params =3D schema_len / 2; } =20 - gdb_ctx.params =3D - (GdbCmdVariant *)alloca(sizeof(*gdb_ctx.params) * max_num_para= ms); memset(gdb_ctx.params, 0, sizeof(*gdb_ctx.params) * max_num_params= ); =20 if (cmd_parse_params(&data[strlen(cmd->cmd)], cmd->schema, --=20 2.26.3