3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-18 10:19:24 +01:00

unit: Fix compilation warning

Some compilers complained that:

../unit/test-ecc.c: In function ‘run_test’:
../unit/test-ecc.c:295:38: warning: ‘lres’ may be used uninitialized in
	this function [-Wmaybe-uninitialized]

assert(data->lres == lres);
                     ^
This commit is contained in:
Denis Kenzior 2018-08-10 14:46:03 -05:00
parent 51c6d2d391
commit db378dd2e8

View File

@ -195,7 +195,6 @@ static void run_test(const void *arg)
scalar[NUM_ECC_DIGITS], result[NUM_ECC_DIGITS],
check[NUM_ECC_DIGITS];
struct ecc_point point1, point2, point_ret;
int lres;
memset(result, 0, sizeof(result));
@ -256,8 +255,11 @@ static void run_test(const void *arg)
vli_mod_exp(result, a, b, mod);
break;
case TEST_LEGENDRE:
lres = vli_legendre(a, mod);
{
int lres = vli_legendre(a, mod);
assert(data->lres == lres);
break;
}
case TEST_POINT_ADD:
assert(ecc_valid_point(&point1) == true);
assert(ecc_valid_point(&point2) == true);
@ -290,9 +292,6 @@ static void run_test(const void *arg)
assert(memcmp(checkx, point_ret.x, 32) == 0);
assert(memcmp(checky, point_ret.y, 32) == 0);
assert(ecc_valid_point(&point_ret) == true);
} else if (data->type == TEST_LEGENDRE) {
assert(data->lres == lres);
}
}