All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>, Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PULL 17/31] migration: Add a qdev property for StrOrNull
Date: Thu, 22 Jan 2026 10:49:46 -0300	[thread overview]
Message-ID: <871pjhlptx.fsf@suse.de> (raw)
In-Reply-To: <CAFEAcA89vswCip53OAPFzLwz5EMnWBtsM61YD0Nc_kYrM4NuCw@mail.gmail.com>

Peter Maydell <peter.maydell@linaro.org> writes:

> On Tue, 23 Dec 2025 at 14:32, Peter Xu <peterx@redhat.com> wrote:
>>
>> From: Fabiano Rosas <farosas@suse.de>
>>
>> The MigrationState is a QOM object with TYPE_DEVICE as a parent. This
>> was done about eight years ago so the migration code could make use of
>> qdev properties to define the defaults for the migration parameters
>> and to be able to expose migration knobs for debugging via the
>> '-global migration' command line option.
>>
>> Due to unrelated historical reasons, three of the migration parameters
>> (TLS options) received different types when used via the
>> query-migrate-parameters QMP command than with the
>> migrate-set-parameters command. This has created a lot of duplication
>> in the migration code and in the QAPI documentation because the whole
>> of MigrationParameters had to be duplicated as well.
>>
>> The migration code is now being fixed to remove the duplication and
>> for that to happen the offending fields need to be reconciled into a
>> single type. The StrOrNull type is going to be used.
>>
>> To keep the command line compatibility, the parameters need to
>> continue being exposed via qdev properties accessible from the command
>> line. Introduce a qdev property StrOrNull just for that.
>>
>> Note that this code is being kept in migration/options.c as this
>> version of StrOrNull doesn't need to handle QNULL because it was never
>> a valid option in the previous command line, which took a string.
>>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> Acked-by: Peter Xu <peterx@redhat.com>
>> Link: https://lore.kernel.org/r/20251215220041.12657-4-farosas@suse.de
>> Signed-off-by: Peter Xu <peterx@redhat.com>
>
> Coverity also suspects a leak in the get function (CID 1643920):
>
>> +static void get_StrOrNull(Object *obj, Visitor *v, const char *name,
>> +                          void *opaque, Error **errp)
>> +{
>> +    const Property *prop = opaque;
>> +    StrOrNull **ptr = object_field_prop_ptr(obj, prop);
>> +    StrOrNull *str_or_null = *ptr;
>> +
>> +    if (!str_or_null) {
>> +        str_or_null = g_new0(StrOrNull, 1);
>
> We allocate memory here, but we never pass this pointer
> on to anybody else, and we don't free it either.
>

Thank you, I'll look into both issues right away.


  reply	other threads:[~2026-01-22 13:50 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23 14:29 [PULL 00/31] Next patches Peter Xu
2025-12-23 14:29 ` [PULL 01/31] migration: fix parsing snapshots with x-ignore-shared flag Peter Xu
2025-12-23 14:29 ` [PULL 02/31] migration: Fix writing mapped_ram + ignore_shared snapshots Peter Xu
2025-12-23 14:29 ` [PULL 03/31] scripts/analyze-migration: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO Peter Xu
2025-12-23 14:29 ` [PULL 04/31] scripts/analyze-migration: Support mapped-ram snapshot format Peter Xu
2025-12-23 14:29 ` [PULL 05/31] migration: Use explicit error_free() instead of g_autoptr Peter Xu
2025-12-23 14:29 ` [PULL 06/31] Revert "error: define g_autoptr() cleanup function for the Error type" Peter Xu
2025-12-23 14:29 ` [PULL 07/31] error: Poison g_autoptr(Error) to prevent its use Peter Xu
2025-12-23 14:29 ` [PULL 08/31] migration: Make migration_connect_set_error() own the error Peter Xu
2025-12-23 14:29 ` [PULL 09/31] migration: Make multifd_send_set_error() " Peter Xu
2025-12-23 14:29 ` [PULL 10/31] migration: Make multifd_recv_terminate_threads() " Peter Xu
2025-12-23 14:29 ` [PULL 11/31] migration: Replace migrate_set_error() with migrate_error_propagate() Peter Xu
2025-12-23 14:29 ` [PULL 12/31] migration: Use error_propagate() in migrate_error_propagate() Peter Xu
2025-12-23 14:29 ` [PULL 13/31] migration/options: Add x-ignore-shared Peter Xu
2025-12-23 14:29 ` [PULL 14/31] MAINTAINERS: Update reviewers for CPR Peter Xu
2025-12-23 14:29 ` [PULL 15/31] migration: Fix leak of block_bitmap_mapping Peter Xu
2025-12-23 14:29 ` [PULL 16/31] migration: Fix leak of cpr_exec_command Peter Xu
2025-12-23 14:29 ` [PULL 17/31] migration: Add a qdev property for StrOrNull Peter Xu
2026-01-22 13:21   ` Peter Maydell
2026-01-22 13:23   ` Peter Maydell
2026-01-22 13:49     ` Fabiano Rosas [this message]
2025-12-23 14:29 ` [PULL 18/31] tests/qtest/migration: Add a NULL parameters test for TLS Peter Xu
2025-12-23 14:29 ` [PULL 19/31] migration: Normalize tls arguments Peter Xu
2026-04-14 16:56   ` Maciej S. Szmigiero
2026-04-14 18:58     ` Peter Xu
2026-04-14 19:34       ` Fabiano Rosas
2025-12-23 14:29 ` [PULL 20/31] migration: Remove MigrateSetParameters Peter Xu
2025-12-23 14:29 ` [PULL 21/31] qapi/migration: Don't document MigrationParameter Peter Xu
2025-12-23 14:29 ` [PULL 22/31] migration: Run a post update routine after setting parameters Peter Xu
2025-12-23 14:29 ` [PULL 23/31] migration: Add a flag to track block-bitmap-mapping input Peter Xu
2025-12-23 14:29 ` [PULL 24/31] migration: Remove checks for s->parameters has_* fields Peter Xu
2025-12-23 14:29 ` [PULL 25/31] migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE Peter Xu
2025-12-23 14:29 ` [PULL 26/31] migration: Extract code to mark all parameters as present Peter Xu
2025-12-23 14:29 ` [PULL 27/31] migration: Use QAPI_CLONE_MEMBERS in query_migrate_parameters Peter Xu
2025-12-23 14:29 ` [PULL 28/31] tests/qtest/migration: Pass MigrateCommon into test functions Peter Xu
2025-12-23 14:29 ` [PULL 29/31] tests/qtest/migration: Pass MigrateStart into cancel tests Peter Xu
2025-12-23 14:29 ` [PULL 30/31] migration: merge fragmented clear_dirty ioctls Peter Xu
2025-12-23 14:29 ` [PULL 31/31] MAINTAINERS: remove David from "Memory API" section Peter Xu
2025-12-28 22:08 ` [PULL 00/31] Next patches Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871pjhlptx.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.