pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/41539?usp=email )
Change subject: tcap_as_loadshare_vty: Avoid possible NULL pointer dereference ......................................................................
tcap_as_loadshare_vty: Avoid possible NULL pointer dereference
argv[1]/as_name is always set so the `if (as_name)` guard can be removed. This lets Coverity verify that as is never dereferenced if NULL.
Related: Coverity CID#551555 Change-Id: Ia9151ae63be3977c2eccf246316b99c20284dbe2 --- M src/tcap_as_loadshare_vty.c 1 file changed, 8 insertions(+), 12 deletions(-)
Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/src/tcap_as_loadshare_vty.c b/src/tcap_as_loadshare_vty.c index dcd8ccf..e6506e8 100644 --- a/src/tcap_as_loadshare_vty.c +++ b/src/tcap_as_loadshare_vty.c @@ -66,12 +66,10 @@ return CMD_WARNING; }
- if (as_name) { - as = osmo_ss7_as_find_by_name(inst, as_name); - if (!as) { - vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE); - return CMD_WARNING; - } + as = osmo_ss7_as_find_by_name(inst, as_name); + if (!as) { + vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE); + return CMD_WARNING; }
vty_out(vty, "Tid Min Tid Max SSN PC ASP Name %s", VTY_NEWLINE); @@ -108,12 +106,10 @@ return CMD_WARNING; }
- if (as_name) { - as = osmo_ss7_as_find_by_name(inst, as_name); - if (!as) { - vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE); - return CMD_WARNING; - } + as = osmo_ss7_as_find_by_name(inst, as_name); + if (!as) { + vty_out(vty, "No AS %s found%s", as_name, VTY_NEWLINE); + return CMD_WARNING; }
vty_out(vty, "Tid Min Tid Max SSN PC ASP Name %s", VTY_NEWLINE);