[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 3/8] virstoragefile: Resolve Coverity DEADCODE



Coverity complains that the condition "size + 1 == 0" cannot happen.
It's already been determined that offset+size is not larger than
buf_size (and buf_size is smaller than UINT_MAX); and also that
offset+size didn't overflow.

So just remove the check

Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/util/virstoragefile.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 5db9184..1a02b18 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -393,8 +393,6 @@ qcowXGetBackingStore(char **res,
     }
     if (offset + size > buf_size || offset + size < offset)
         return BACKING_STORE_INVALID;
-    if (size + 1 == 0)
-        return BACKING_STORE_INVALID;
     if (VIR_ALLOC_N(*res, size + 1) < 0)
         return BACKING_STORE_ERROR;
     memcpy(*res, buf + offset, size);
-- 
1.9.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]