[PATCH] libosmocore[master]: osmo-auc-gen.c: squelch compiler warnings, move local var

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Sep 12 02:39:25 UTC 2017


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

osmo-auc-gen.c: squelch compiler warnings, move local var

The compiler thinks that ind or ind_mask may be used uninitialized, because it
doesn't analyze the conditionality of command line arguments and other
variables set accordingly. Make the compiler happy by zero initializing.

Change-Id: I9ddcb0525159da520aceaeb6e908a735a003bb5a
---
M utils/osmo-auc-gen.c
1 file changed, 3 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/08/3908/1

diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c
index fee9767..1f5c838 100644
--- a/utils/osmo-auc-gen.c
+++ b/utils/osmo-auc-gen.c
@@ -98,15 +98,14 @@
 	struct osmo_auth_vector *vec = &_vec;
 	uint8_t _rand[16], _auts[14];
 	uint64_t sqn;
-	unsigned int ind;
+	unsigned int ind = 0;
 	int rc, option_index;
 	int rand_is_set = 0;
 	int auts_is_set = 0;
 	int sqn_is_set = 0;
 	int ind_is_set = 0;
 	int fmt_triplets_dat = 0;
-	uint64_t seq_1;
-	uint64_t ind_mask;
+	uint64_t ind_mask = 0;
 
 	printf("osmo-auc-gen (C) 2011-2012 by Harald Welte\n");
 	printf("This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY\n\n");
@@ -270,7 +269,7 @@
 	memset(vec, 0, sizeof(*vec));
 
 	if (test_aud.type == OSMO_AUTH_TYPE_UMTS) {
-		seq_1 = 1LL << test_aud.u.umts.ind_bitlen;
+		uint64_t seq_1 = 1LL << test_aud.u.umts.ind_bitlen;
 		ind_mask = seq_1 - 1;
 
 		if (sqn_is_set) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ddcb0525159da520aceaeb6e908a735a003bb5a
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list