[PATCH] libosmocore[master]: utils: Fix false positive in compiler warning

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Nov 16 15:42:20 UTC 2017


Review at  https://gerrit.osmocom.org/4853

utils: Fix false positive in compiler warning

Fixes the warning below:
warning: ‘sqn’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    fprintf(stderr, "Requesting --sqn %"PRIu64" implies IND=%u,"
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     " so no further --ind argument is allowed.\n",
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     sqn, test_aud.u.umts.ind);
     ~~~~~~~~~~~~~~~~~~~~~~~~~

The warning is a false positive as sqn is only used in case
sqn_is_set!=0, and in that code path, sqn is set.

Change-Id: Ib5903db01ea6765bd6bb688e63f70925c5012f98
---
M utils/osmo-auc-gen.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/53/4853/1

diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index 9d1215c..ec9bad8 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -98,7 +98,7 @@
 	struct osmo_auth_vector _vec;
 	struct osmo_auth_vector *vec = &_vec;
 	uint8_t _rand[16], _auts[14];
-	uint64_t sqn;
+	uint64_t sqn = 0;
 	unsigned int ind = 0;
 	int rc, option_index;
 	int rand_is_set = 0;

-- 
To view, visit https://gerrit.osmocom.org/4853
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib5903db01ea6765bd6bb688e63f70925c5012f98
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list