Clang reports possible optarg as null passed to atoi.
Fix it by adding ovs_assert check.

Signed-off-by: William Tu <[email protected]>
---
 utilities/ovs-testcontroller.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utilities/ovs-testcontroller.c b/utilities/ovs-testcontroller.c
index b4a451286455..be28d5494ec0 100644
--- a/utilities/ovs-testcontroller.c
+++ b/utilities/ovs-testcontroller.c
@@ -318,6 +318,7 @@ parse_options(int argc, char *argv[])
             if (!strcmp(optarg, "permanent")) {
                 max_idle = OFP_FLOW_PERMANENT;
             } else {
+                ovs_assert(optarg);
                 max_idle = atoi(optarg);
                 if (max_idle < 1 || max_idle > 65535) {
                     ovs_fatal(0, "--max-idle argument must be between 1 and "
@@ -327,6 +328,7 @@ parse_options(int argc, char *argv[])
             break;
 
         case 'q':
+            ovs_assert(optarg);
             default_queue = atoi(optarg);
             break;
 
-- 
2.7.4

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to