Message ID | 20170527055559.14775-1-blp@ovn.org |
---|---|
State | Accepted |
Headers | show |
> On May 26, 2017, at 10:55 PM, Ben Pfaff <blp@ovn.org> wrote: > > 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@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org> --Justin
On Thu, Jun 01, 2017 at 04:57:42PM -0700, Justin Pettit wrote: > > > On May 26, 2017, at 10:55 PM, Ben Pfaff <blp@ovn.org> wrote: > > > > 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@ovn.org> > > Acked-by: Justin Pettit <jpettit@ovn.org> Thanks, applied to master, branch-2.7, and branch-2.6.
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; } }
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@ovn.org> --- ovn/controller/patch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)