[ovs-dev] [PATCH] ovsdb-client: Use correct operand to 'sizeof' in do_dump().

Ben Pfaff blp at ovn.org
Sat May 27 04:59:53 UTC 2017


When copying an object, one must calculate the size of the object itself,
not of its address.

No visible effect, though, since both the object and its address are
pointers in this case.

Found by Coverity.

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

diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index 1df4fb4da92c..9ef3311270aa 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 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.
@@ -1291,7 +1291,7 @@ do_dump(struct jsonrpc *rpc, const char *database,
         if (!node) {
             ovs_fatal(0, "No table \"%s\" found.", argv[0]);
         }
-        tables = xmemdup(&node, sizeof(&node));
+        tables = xmemdup(&node, sizeof node);
         n_tables = 1;
         tschema = tables[0]->data;
         for (i = 1; i < argc; i++) {
-- 
2.10.2



More information about the dev mailing list