On 21-01-21 14:52:02, Keith Busch wrote:
> On Fri, Jan 22, 2021 at 07:09:03AM +0900, Minwoo Im wrote:
> > +static void nvme_subsys_setup(NvmeSubsystem *subsys)
> > +{
> > +    char *subnqn;
> > +
> > +    subnqn = g_strdup_printf("nqn.2019-08.org.qemu:%s", 
> > subsys->parent_obj.id);
> > +    strpadcpy((char *)subsys->subnqn, sizeof(subsys->subnqn), subnqn, 
> > '\0');
> > +    g_free(subnqn);
> 
> Instead of the duplication and copy, you could format the string
> directly into the destination:
> 
>     snprintf(subsys->subnqn, sizeof(subsys->subnqn), 
> "nqn.2019-08.org.qemu:%s",
>              subsys->parent_obj.id);

Oh, Thanks. Will fix it!

Reply via email to