[ovs-dev] [PATCH] ovn-nbctl, ovn-sbctl, ovs-vsctl: Remove gratuitous NULL checks.
Ben Pfaff
blp at ovn.org
Tue May 30 14:52:05 UTC 2017
Thank you! I applied this to master.
On Mon, May 29, 2017 at 01:32:21PM +0200, Miguel Angel Ajo Pelayo wrote:
> Acked-by: Miguel Angel Ajo <majopela at redhat.com>
>
> On Sat, May 27, 2017 at 5:44 AM, Ben Pfaff <blp at ovn.org> wrote:
>
> > These functions all set txn and do not un-set it within their main
> > command execution function, so it's gratuitous to check it along this path.
> >
> > Found by Coverity.
> >
> > Reported-at: https://scan3.coverity.com/reports.htm#v16889/p10449/
> > fileInstanceId=14763082&defectInstanceId=4305338&mergedDefectId=180417
> > Signed-off-by: Ben Pfaff <blp at ovn.org>
> > ---
> > ovn/utilities/ovn-nbctl.c | 9 ++++-----
> > ovn/utilities/ovn-sbctl.c | 9 ++++-----
> > utilities/ovs-vsctl.c | 9 ++++-----
> > 3 files changed, 12 insertions(+), 15 deletions(-)
> >
> > diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
> > index 9428a342bec5..b5143e6adfae 100644
> > --- a/ovn/utilities/ovn-nbctl.c
> > +++ b/ovn/utilities/ovn-nbctl.c
> > @@ -3309,11 +3309,10 @@ do_nbctl(const char *args, struct ctl_command
> > *commands, size_t n_commands,
> > try_again:
> > /* Our transaction needs to be rerun, or a prerequisite was not met.
> > Free
> > * resources and return so that the caller can try again. */
> > - if (txn) {
> > - ovsdb_idl_txn_abort(txn);
> > - ovsdb_idl_txn_destroy(txn);
> > - the_idl_txn = NULL;
> > - }
> > + ovsdb_idl_txn_abort(txn);
> > + ovsdb_idl_txn_destroy(txn);
> > + the_idl_txn = NULL;
> > +
> > ovsdb_symbol_table_destroy(symtab);
> > for (c = commands; c < &commands[n_commands]; c++) {
> > ds_destroy(&c->output);
> > diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
> > index 0142062fd13f..4a884232f8fd 100644
> > --- a/ovn/utilities/ovn-sbctl.c
> > +++ b/ovn/utilities/ovn-sbctl.c
> > @@ -1344,11 +1344,10 @@ do_sbctl(const char *args, struct ctl_command
> > *commands, size_t n_commands,
> > try_again:
> > /* Our transaction needs to be rerun, or a prerequisite was not met.
> > Free
> > * resources and return so that the caller can try again. */
> > - if (txn) {
> > - ovsdb_idl_txn_abort(txn);
> > - ovsdb_idl_txn_destroy(txn);
> > - the_idl_txn = NULL;
> > - }
> > + ovsdb_idl_txn_abort(txn);
> > + ovsdb_idl_txn_destroy(txn);
> > + the_idl_txn = NULL;
> > +
> > ovsdb_symbol_table_destroy(symtab);
> > for (c = commands; c < &commands[n_commands]; c++) {
> > ds_destroy(&c->output);
> > diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
> > index 9fe3df03af66..28c1c4457016 100644
> > --- a/utilities/ovs-vsctl.c
> > +++ b/utilities/ovs-vsctl.c
> > @@ -2670,11 +2670,10 @@ do_vsctl(const char *args, struct ctl_command
> > *commands, size_t n_commands,
> > try_again:
> > /* Our transaction needs to be rerun, or a prerequisite was not met.
> > Free
> > * resources and return so that the caller can try again. */
> > - if (txn) {
> > - ovsdb_idl_txn_abort(txn);
> > - ovsdb_idl_txn_destroy(txn);
> > - the_idl_txn = NULL;
> > - }
> > + ovsdb_idl_txn_abort(txn);
> > + ovsdb_idl_txn_destroy(txn);
> > + the_idl_txn = NULL;
> > +
> > ovsdb_symbol_table_destroy(symtab);
> > for (c = commands; c < &commands[n_commands]; c++) {
> > ds_destroy(&c->output);
> > --
> > 2.10.2
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
More information about the dev
mailing list