[MERGED] 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 16:16:08 UTC 2017


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: utils: Fix false positive in compiler warning
......................................................................


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(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: Ib5903db01ea6765bd6bb688e63f70925c5012f98
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list