In virStorageBackendDeviceIsEmpty, the return value for virStorageBackendPARTEDValidLabel is -1 or 0. That makes the later condition 'ret == -2' make always false. Remove the always false condition. Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE. Fixes: https://gitlab.com/libvirt/libvirt/-/issues/576 Signed-off-by: Han Han <hhan@xxxxxxxxxx> --- src/storage/storage_util.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 7bf815d978..82bcfa5838 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -3352,15 +3352,9 @@ virStorageBackendDeviceIsEmpty(const char *devpath, writelabel)) == -2) ret = virStorageBackendPARTEDValidLabel(devpath, format, writelabel); - if (ret == -2 && !writelabel) + if (!writelabel) ret = 0; - if (ret == -2) { - virReportError(VIR_ERR_OPERATION_INVALID, - _("Unable to probe '%1$s' for existing data, forced overwrite is necessary"), - devpath); - } - return ret == 0; } -- 2.43.0 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx