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 <pes...@sysmocom.de>

Reply via email to