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

[libvirt] [PATCH 1/2] virnetserverservice: Resolve Coverity ARRAY_VS_SINGLETON



Coverity complained about the following:

(3) Event ptr_arith:
   Performing pointer arithmetic on "cur_fd" in expression "cur_fd++".
130             return virNetServerServiceNewFD(*cur_fd++,

It seems the belief is their is pointer arithmetic taking place.  By using
(*cur_fd)++ we avoid this possible issue

Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/rpc/virnetserverservice.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c
index fea05c3..486f93e 100644
--- a/src/rpc/virnetserverservice.c
+++ b/src/rpc/virnetserverservice.c
@@ -127,7 +127,7 @@ virNetServerServiceNewFDOrUNIX(const char *path,
          * There's still enough file descriptors.  In this case we'll
          * use the current one and increment it afterwards.
          */
-        return virNetServerServiceNewFD(*cur_fd++,
+        return virNetServerServiceNewFD((*cur_fd)++,
                                         auth,
 #if WITH_GNUTLS
                                         tls,
-- 
1.9.3


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