提交 bab35f74 编写于 作者: J John Ferlan

storage_driver: Resolve Coverity REVERSE_INULL

There were two occurrances of attempting to initialize actualType by
calling virStorageSourceGetActualType(src) prior to a check if (!src)
resulting in Coverity complaining about the possible NULL dereference
in virStorageSourceGetActualType() of src.

Resolve by moving the actualType setting until after checking !src
上级 cfbbeb36
...@@ -2441,11 +2441,12 @@ virStorageFileIsInitialized(virStorageSourcePtr src) ...@@ -2441,11 +2441,12 @@ virStorageFileIsInitialized(virStorageSourcePtr src)
static bool static bool
virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src) virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src)
{ {
int actualType = virStorageSourceGetActualType(src); int actualType;
virStorageFileBackendPtr backend; virStorageFileBackendPtr backend;
if (!src) if (!src)
return false; return false;
actualType = virStorageSourceGetActualType(src);
if (src->drv) { if (src->drv) {
backend = src->drv->backend; backend = src->drv->backend;
...@@ -2473,11 +2474,12 @@ virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src) ...@@ -2473,11 +2474,12 @@ virStorageFileSupportsBackingChainTraversal(virStorageSourcePtr src)
bool bool
virStorageFileSupportsSecurityDriver(virStorageSourcePtr src) virStorageFileSupportsSecurityDriver(virStorageSourcePtr src)
{ {
int actualType = virStorageSourceGetActualType(src); int actualType;
virStorageFileBackendPtr backend; virStorageFileBackendPtr backend;
if (!src) if (!src)
return false; return false;
actualType = virStorageSourceGetActualType(src);
if (src->drv) { if (src->drv) {
backend = src->drv->backend; backend = src->drv->backend;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册