[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/6] block: Assert BlockDriver::format_name is not NULL
From: |
Max Reitz |
Subject: |
[PULL 2/6] block: Assert BlockDriver::format_name is not NULL |
Date: |
Tue, 24 Mar 2020 13:20:40 +0100 |
From: Philippe Mathieu-Daudé <address@hidden>
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 <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
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.25.1
- [PULL 0/6] Block patches for 5.0-rc0, Max Reitz, 2020/03/24
- [PULL 1/6] block: Avoid memleak on qcow2 image info failure, Max Reitz, 2020/03/24
- [PULL 2/6] block: Assert BlockDriver::format_name is not NULL,
Max Reitz <=
- [PULL 3/6] block: bdrv_set_backing_bs: fix use-after-free, Max Reitz, 2020/03/24
- [PULL 4/6] block/qcow2: zero data_file child after free, Max Reitz, 2020/03/24
- [PULL 5/6] iotests: Fix cleanup path in some tests, Max Reitz, 2020/03/24
- [PULL 6/6] iotests/026: Move v3-exclusive test to new file, Max Reitz, 2020/03/24
- Re: [PULL 0/6] Block patches for 5.0-rc0, Peter Maydell, 2020/03/24