Thanks for the fix! Best, Mansour
On Wed, Mar 18, 2020 at 4:14 AM Philippe Mathieu-Daudé <phi...@redhat.com> wrote: > On 3/17/20 9:40 PM, Mansour Ahmadi wrote: > > Is a NULL check on 'drv1->format_name' missing here? > > > https://github.com/qemu/qemu/blob/cc818a2148c5f321bdeb8e5564bdb2914e824600/block.c#L400-L403 > > > > if(!strcmp(drv1->format_name, format_name)) { > > This could be NULL indeed. I'd rather assertions in the entry function, > bdrv_register(): > > -- >8 -- > diff --git a/block.c b/block.c > index a2542c977b..6b984dc883 100644 > --- a/block.c > +++ b/block.c > @@ -363,6 +363,7 @@ char > *bdrv_get_full_backing_filename(BlockDriverState *bs, Error **errp) > > void bdrv_register(BlockDriver *bdrv) > { > + assert(bdrv->format_name); > QLIST_INSERT_HEAD(&bdrv_drivers, bdrv, list); > } > > --- > > > While it is checked in similar case: > > > https://github.com/qemu/qemu/blob/cc818a2148c5f321bdeb8e5564bdb2914e824600/block.c#L797-L800 > > > > if(drv1->protocol_name&& !strcmp(drv1->protocol_name, protocol)) { > > Because 'protocol_name' is optional. > > Regards, > > Phil. > >