From a15f08dceebce63ee15c91c7d74265d61d882ae5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 18 Mar 2020 23:22:35 +0100 Subject: [PATCH] block: Assert BlockDriver::format_name is not NULL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit bdrv_do_find_format() calls strcmp() using BlockDriver::format_name as argument, which must not be NULL. Assert this field is not null when we register a block driver in bdrv_register(). Reported-by: Mansour Ahmadi Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20200318222235.23856-1-philmd@redhat.com> Reviewed-by: Alberto Garcia Signed-off-by: Max Reitz --- block.c | 1 + 1 file changed, 1 insertion(+) 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); } -- 2.11.0