diff mbox

[ovs-dev] test-packets: Check that ipv6_parse_masked() is successful.

Message ID 20170526231409.8818-1-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff May 26, 2017, 11:14 p.m. UTC
Otherwise it returns an allocated string that we should print and free.

Found by Coverity.

Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14763114&defectInstanceId=4305332&mergedDefectId=180408
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 tests/test-packets.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Justin Pettit June 1, 2017, 11:11 p.m. UTC | #1
> On May 26, 2017, at 4:14 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> Otherwise it returns an allocated string that we should print and free.
> 
> Found by Coverity.
> 
> Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14763114&defectInstanceId=4305332&mergedDefectId=180408
> Signed-off-by: Ben Pfaff <blp@ovn.org>

Acked-by: Justin Pettit <jpettit@ovn.org>

--Justin
Ben Pfaff June 1, 2017, 11:36 p.m. UTC | #2
On Thu, Jun 01, 2017 at 04:11:33PM -0700, Justin Pettit wrote:
> 
> > On May 26, 2017, at 4:14 PM, Ben Pfaff <blp@ovn.org> wrote:
> > 
> > Otherwise it returns an allocated string that we should print and free.
> > 
> > Found by Coverity.
> > 
> > Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/fileInstanceId=14763114&defectInstanceId=4305332&mergedDefectId=180408
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> 
> Acked-by: Justin Pettit <jpettit@ovn.org>

Thanks, applied to master.
diff mbox

Patch

diff --git a/tests/test-packets.c b/tests/test-packets.c
index c4494cfdd524..da074f74dc9d 100644
--- a/tests/test-packets.c
+++ b/tests/test-packets.c
@@ -1,5 +1,5 @@ 
 /*
- * Copyright (c) 2011, 2014 Nicira, Inc.
+ * Copyright (c) 2011, 2014, 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.
@@ -159,16 +159,16 @@  test_ipv6_parsing(void)
 
     inet_pton(AF_INET6, "2001:db8:0:0:0:0:2:1", &o_ipv6);
 
-    ipv6_parse_masked("2001:db8:0:0:0:0:2:1/64", &p_ipv6, &mask);
+    assert(!ipv6_parse_masked("2001:db8:0:0:0:0:2:1/64", &p_ipv6, &mask));
     assert(ipv6_addr_equals(&o_ipv6, &p_ipv6));
     assert(ipv6_count_cidr_bits(&mask) == 64);
 
-    ipv6_parse_masked("2001:db8:0:0:0:0:2:1/ffff:ffff:ffff:ffff::",
-                      &p_ipv6, &mask);
+    assert(!ipv6_parse_masked("2001:db8:0:0:0:0:2:1/ffff:ffff:ffff:ffff::",
+                              &p_ipv6, &mask));
     assert(ipv6_addr_equals(&o_ipv6, &p_ipv6));
     assert(ipv6_count_cidr_bits(&mask) == 64);
 
-    ipv6_parse_masked("2001:db8:0:0:0:0:2:1", &p_ipv6, &mask);
+    assert(!ipv6_parse_masked("2001:db8:0:0:0:0:2:1", &p_ipv6, &mask));
     assert(ipv6_addr_equals(&o_ipv6, &p_ipv6));
     assert(ipv6_count_cidr_bits(&mask) == 128);
 }