On Fri, Nov 15, 2024 at 05:25:19PM +0000, Daniel P. Berrangé wrote: > qdev_new() has a failure scenario where it will assert() if given > an abstract type. Callers which are creating qdevs based on user > input, or unknown/untrusted type names, must manually check the > result of qdev_class_is_abstract() before calling qdev_new() > to propagate an Error, instead of asserting. > > Introduce a qdev_new_dynamic() method which is a counterpart to > qdev_new() that directly returns an Error, instead of asserting. > This new method is to be used where the typename is specified > dynamically by code separate from the immediate caller. > > Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>
Reviewed-by: Peter Xu <pet...@redhat.com> -- Peter Xu