Message ID | 1509211918-14829-6-git-send-email-u9012063@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
Series | Fix clang static analysis null pointer bugs. | expand |
Looks good to me. On Sat, Oct 28, 2017 at 12:35 PM William Tu <u9012063@gmail.com> wrote: > Clang reports possible null pointer of optarg as argument to strtoul. > Fix it by adding ovs_assert check. > > Signed-off-by: William Tu <u9012063@gmail.com> > Acked-by: Mark Michelson <mmichels@redhat.com> > --- > utilities/ovs-ofctl.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c > index 5b7f1b02104f..05c5995fa775 100644 > --- a/utilities/ovs-ofctl.c > +++ b/utilities/ovs-ofctl.c > @@ -262,6 +262,7 @@ parse_options(int argc, char *argv[]) > > switch (c) { > case 't': > + ovs_assert(optarg); > timeout = strtoul(optarg, NULL, 10); > if (timeout <= 0) { > ovs_fatal(0, "value %s on -t or --timeout is not at least > 1", > -- > 2.7.4 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 5b7f1b02104f..05c5995fa775 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -262,6 +262,7 @@ parse_options(int argc, char *argv[]) switch (c) { case 't': + ovs_assert(optarg); timeout = strtoul(optarg, NULL, 10); if (timeout <= 0) { ovs_fatal(0, "value %s on -t or --timeout is not at least 1",
Clang reports possible null pointer of optarg as argument to strtoul. Fix it by adding ovs_assert check. Signed-off-by: William Tu <u9012063@gmail.com> --- utilities/ovs-ofctl.c | 1 + 1 file changed, 1 insertion(+)