All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-for-5.0] block: Assert BlockDriver::format_name is not NULL
@ 2020-03-18 22:22 Philippe Mathieu-Daudé
  2020-03-19 11:53 ` Alberto Garcia
  2020-03-23 13:36 ` Max Reitz
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-18 22:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Philippe Mathieu-Daudé,
	Mansour Ahmadi, qemu-block, Max Reitz

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 <ManSoSec@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 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.21.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH-for-5.0] block: Assert BlockDriver::format_name is not NULL
  2020-03-18 22:22 [PATCH-for-5.0] block: Assert BlockDriver::format_name is not NULL Philippe Mathieu-Daudé
@ 2020-03-19 11:53 ` Alberto Garcia
  2020-03-23 13:36 ` Max Reitz
  1 sibling, 0 replies; 3+ messages in thread
From: Alberto Garcia @ 2020-03-19 11:53 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Kevin Wolf, Mansour Ahmadi, Philippe Mathieu-Daudé,
	qemu-block, Max Reitz

On Wed 18 Mar 2020 11:22:35 PM CET, Philippe Mathieu-Daudé wrote:
> 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 <ManSoSec@gmail.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Alberto Garcia <berto@igalia.com>

Berto


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH-for-5.0] block: Assert BlockDriver::format_name is not NULL
  2020-03-18 22:22 [PATCH-for-5.0] block: Assert BlockDriver::format_name is not NULL Philippe Mathieu-Daudé
  2020-03-19 11:53 ` Alberto Garcia
@ 2020-03-23 13:36 ` Max Reitz
  1 sibling, 0 replies; 3+ messages in thread
From: Max Reitz @ 2020-03-23 13:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Kevin Wolf, Mansour Ahmadi, qemu-block


[-- Attachment #1.1: Type: text/plain, Size: 534 bytes --]

On 18.03.20 23:22, Philippe Mathieu-Daudé wrote:
> 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 <ManSoSec@gmail.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  block.c | 1 +
>  1 file changed, 1 insertion(+)

Thanks, applied to my block branch:

https://git.xanclic.moe/XanClic/qemu/commits/branch/block

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-23 13:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 22:22 [PATCH-for-5.0] block: Assert BlockDriver::format_name is not NULL Philippe Mathieu-Daudé
2020-03-19 11:53 ` Alberto Garcia
2020-03-23 13:36 ` Max Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.