[libvirt] [PATCH 5/5] storage_driver: Resolve Coverity CHECKED_RETURN warning

John Ferlan jferlan at redhat.com
Tue Dec 3 14:18:14 UTC 2013


The storageRegister() didn't check the return from the
virRegisterStorageDriver() like other callers did, so Coverity
flagged it.  Just check the return and handle.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 3b4715a..469d135 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2645,7 +2645,8 @@ static virStateDriver stateDriver = {
 };
 
 int storageRegister(void) {
-    virRegisterStorageDriver(&storageDriver);
+    if (virRegisterStorageDriver(&storageDriver) < 0)
+        return -1;
     virRegisterStateDriver(&stateDriver);
     return 0;
 }
-- 
1.8.3.1




More information about the libvir-list mailing list