Am Mi., 8. Juli 2026 um 12:28 Uhr schrieb Klaus Jensen <[email protected]>:
>
>
>
> On Wed, Jul 8, 2026, at 12:23, Alexander Mikhalitsyn wrote:
> > On Wed, 2026-07-08 at 11:11 +0100, Peter Maydell wrote:
> >> On Mon, 6 Jul 2026 at 23:44, Klaus Jensen <[email protected]> wrote:
> >> >
> >> > From: Alexander Mikhalitsyn <[email protected]>
> >> >
> >> > Let's block migration for cases we don't support:
> >> > - SR-IOV
> >> > - CMB
> >> > - PMR
> >> > - SPDM
> >> >
> >> > No functional changes here, because NVMe migration is
> >> > not supported at all as of this commit.
> >>
> >> Hi; Coverity has a complaint about this commit (CID 1663673):
> >
> > Dear Peter,
> >
> >>
> >> > +#define BLOCKER_FEATURES_MAX_LEN 256
> >> > +
> >> > +static inline void nvme_add_blocker_feature(char *blocker_features,
> >> > +                                            const char *feature)
> >> > +{
> >> > +    if (strlen(blocker_features) > 0) {
> >> > +        g_strlcat(blocker_features, ", ", BLOCKER_FEATURES_MAX_LEN);
> >> > +    }
> >> > +    g_strlcat(blocker_features, feature, BLOCKER_FEATURES_MAX_LEN);
> >>
> >> g_strlcat has a return value to tell us whether it managed to fit
> >> all the text in, but we aren't checking it.
> >>
> >> In this case it looks like that's not a big deal (it does always NUL
> >> terminate even if it truncates, and we're only using the string
> >> to report migration blockers), but I think it would be nicer to
> >> avoid using a fixed-size char array: they're usually a bit more
> >> bug-prone.
> >>
> >> How about we use glib's GPtrArray and g_strjoinv() instead of
> >> manually building the string? Something like:
> >>
> >>
> >>     g_autoptr(GPtrArray) blocker_features = g_ptr_array_new();
> >>
> >>     if (...) {
> >>         g_ptr_array_add(blocker_features, "SR-IOV");
> >>     }
> >>     [etc...]
> >>
> >>
> >>     if (blocker_features->len > 0) {
> >>         g_autofree blocker_list = NULL;
> >>
> >>         g_ptr_array_add(blocker_features, NULL);
> >>         blocker_list = g_strjoinv(", ", (void *)blocker_features->pdata);
> >>         error_setg(&n->migration_blocker,
> >>                    "Migration is not supported for %s", blocker_list);
> >>         if (migrate_add_blocker(&n->migration_blocker, errp) < 0) {
> >>             return false;
> >>         }
> >>     }
> >
> > oh, thanks. My bad. :-( Would you like to submit your fix as a patch, or
> > should I take your suggestions and send a fixup patch (or update my series)?
> >
>
> Alex,

Hi Klaus,

>
> Please send as a patch for master, you can add Suggested-by for Peter :)

will do, thanks! ;-)

Kind regards,
Alex

>
> Cheers,
> Klaus

Reply via email to