Change in osmo-hlr[master]: Fix Coverity Warnings.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

keith gerrit-no-reply at lists.osmocom.org
Sat Jan 30 19:51:10 UTC 2021


keith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/22554 )


Change subject: Fix Coverity Warnings.
......................................................................

Fix Coverity Warnings.

Explicitly check filter_type is not NULL even though the current code
never passed NULL filter_type unless filter was also NULL

Remove unreachable code.

Change-Id: Ib2bd9b2d6e9e559e61a895a25235669dae05fdf6
Related: coverity CID#216865
Related: coverity CID#216867
---
M src/db_hlr.c
1 file changed, 3 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/54/22554/1

diff --git a/src/db_hlr.c b/src/db_hlr.c
index a181c0c..a4c467e 100644
--- a/src/db_hlr.c
+++ b/src/db_hlr.c
@@ -663,7 +663,7 @@
 		return -EIO;
 	}
 
-	if (filter && strcmp(filter_type, "last_lu_seen") != 0) {
+	if (filter_type && filter && strcmp(filter_type, "last_lu_seen") != 0) {
 		if (strcmp(filter, "on") == 0) {
 			sprintf(search, "%s", "1");
 		} else if (strcmp(filter, "off") == 0) {
@@ -704,15 +704,11 @@
 	db_remove_reset(stmt);
 	if (rc != SQLITE_DONE) {
 		*err = sqlite3_errmsg(dbc->db);
-		return -EIO;
-	} else if (rc == SQLITE_DONE) {
-		*err = NULL;
-		return 0;
-	} else {
-		*err = sqlite3_errmsg(dbc->db);
 		LOGP(DAUC, LOGL_ERROR, "Cannot read subscribers from db:: %s\n", *err);
 		return rc;
 	}
+	*err = NULL;
+	return 0;
 }
 
 /*! Retrieve subscriber data from the HLR database.

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/22554
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: Ib2bd9b2d6e9e559e61a895a25235669dae05fdf6
Gerrit-Change-Number: 22554
Gerrit-PatchSet: 1
Gerrit-Owner: keith <keith at rhizomatica.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210130/2396a8bf/attachment.htm>


More information about the gerrit-log mailing list