From 4d358c00e1b3389291bdb3d5c40d0da8d6cf4d02 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 22 Feb 2018 03:19:05 +0100 Subject: gsm48_ra_id_by_bts(): struct gsm48_ra_id* instead of buf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move from using deprecated gsm48_construct_ra(), which uses a buf, to gsm48_encode_ra(), which uses a gsm48_ra_id argument. Pass struct gsm48_ra_id around instead of a buf. struct gsm48_ra_id is the "encoded" representation of the bytes in a typical MCC-MNC-LAC-RAC (04.08 Routing Area Id IE, 3GPP TS 24.008 ยง 10.5.5.15). Using the struct spares using magic numbers for byte offsets. In the process, fix a sanitizer warning for unaligned access by using memcpy() instead of pointer assignment: osmo-bsc/src/libbsc/abis_nm.c:2857:27: runtime error: store to misaligned address 0x7ffe8e0d6695 for type 'uint16_t', which requires 2 byte alignment Note that (besides removing a now unnecessary cast) the gsm0408_test and abis_test tests of RAI / CGI encoding remain stable, which indicates that the new code is still correct. Change-Id: I0d3908fb8ca1e2e669d257b5d59b40675fa85d06 --- include/osmocom/bsc/gsm_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/osmocom/bsc/gsm_data.h') diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 3c65c9c3f..8692469b4 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -1353,7 +1353,7 @@ enum bts_gprs_mode bts_gprs_mode_parse(const char *arg, int *valid); const char *bts_gprs_mode_name(enum bts_gprs_mode mode); int bts_gprs_mode_is_compat(struct gsm_bts *bts, enum bts_gprs_mode mode); -int gsm48_ra_id_by_bts(uint8_t *buf, struct gsm_bts *bts); +void gsm48_ra_id_by_bts(struct gsm48_ra_id *buf, struct gsm_bts *bts); void gprs_ra_id_by_bts(struct gprs_ra_id *raid, struct gsm_bts *bts); int gsm_btsmodel_set_feature(struct gsm_bts_model *model, enum gsm_bts_features feat); -- cgit v1.2.3