[MERGED] osmo-sgsn[master]: sgsn_test: guard against struct gprs_ra_id changing

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Feb 22 07:51:27 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: sgsn_test: guard against struct gprs_ra_id changing
......................................................................


sgsn_test: guard against struct gprs_ra_id changing

sgsn_test initializes various struct gprs_ra_id without naming the actual
members, which is vulnerable to struct member re-ordering. Name the members
explicitly.

An upcoming ABI change in libosmocore would cause test failures here without
this patch.

Change-Id: I517ed9edf77fac37d9de7a39df24c419a8a65d96
---
M tests/sgsn/sgsn_test.c
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/tests/sgsn/sgsn_test.c b/tests/sgsn/sgsn_test.c
index 4237349..2fbd6e4 100644
--- a/tests/sgsn/sgsn_test.c
+++ b/tests/sgsn/sgsn_test.c
@@ -1644,7 +1644,7 @@
  */
 static void test_gmm_ptmsi_allocation(void)
 {
-	struct gprs_ra_id raid = {332, 112, 16464, 96};
+	struct gprs_ra_id raid = { .mnc=332, .mcc=112, .lac=16464, .rac=96};
 	struct sgsn_mm_ctx *ctx = NULL;
 	struct sgsn_mm_ctx *ictx;
 	uint32_t foreign_tlli;
@@ -1847,8 +1847,8 @@
  */
 static void test_gmm_routing_areas(void)
 {
-	struct gprs_ra_id raid1 = {332, 112, 16464, 96};
-	struct gprs_ra_id raid2 = {332, 112, 16464, 97};
+	struct gprs_ra_id raid1 = { .mnc=332, .mcc=112, .lac=16464, .rac=96};
+	struct gprs_ra_id raid2 = { .mnc=332, .mcc=112, .lac=16464, .rac=97};
 	struct sgsn_mm_ctx *ctx = NULL;
 	struct sgsn_mm_ctx *ictx;
 	uint32_t ptmsi1;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I517ed9edf77fac37d9de7a39df24c419a8a65d96
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list