[ovs-dev] [PATCH] patch: Check the right variable for null.

Ben Pfaff blp at ovn.org
Sat May 27 05:55:59 UTC 2017


This function tried to check 'iface_peer' for null, but it actually
checked its always-nonnull 'peer' argument instead.  This fixes the
problem.

Found by Coverity.

Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14763064&defectInstanceId=4305294&mergedDefectId=179852
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 ovn/controller/patch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ovn/controller/patch.c b/ovn/controller/patch.c
index 158413e91f8c..27c6ac385de1 100644
--- a/ovn/controller/patch.c
+++ b/ovn/controller/patch.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, 2016 Nicira, Inc.
+/* Copyright (c) 2015, 2016, 2017 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@ match_patch_port(const struct ovsrec_port *port, const char *peer)
             continue;
         }
         const char *iface_peer = smap_get(&iface->options, "peer");
-        if (peer && !strcmp(iface_peer, peer)) {
+        if (iface_peer && !strcmp(iface_peer, peer)) {
             return true;
         }
     }
-- 
2.10.2



More information about the dev mailing list