On Fri, Jun 20, 2025 at 11:08 AM Dorinda Bassey <dbas...@redhat.com> wrote:
>
> Hi Albert,
>
> Thank you for these patches, just a small issue you could add to your
> next series.
>
> >
> > +
> > +            memory_region_init(virtio_new_shmem_region(vdev, i)->mr,
> > +                               OBJECT(vdev), "vub-shm-" + i,
> > +                               memory_sizes[i]);
>
> Here, `"vub-shm-" + i` looks like string concatenation but uses
> pointer arithmetic,
> which could cause a crash at runtime for e.g., when `i` is > 0. I
> believe you can use
> g_strdup_printf("vub-shm-%d", i) to fix this, it constructs a new
> null-terminated
> string like "vub-shm-0", "vub-shm-1", "vub-shm-2", etc. If that was
> your intention.

Nice catch! Looks like I just didn't completely switch to the right
syntax when working on this patch.

Luckily, on patch 1 of this series I used the correct string
manipulation. I had to double check.

>
> BR,
> Dorinda.
>


Reply via email to