From 8300fd964dcaa8f01c4ecaa0109f1e6f33fe53d2 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 20 Jul 2016 19:53:00 +0200 Subject: [PATCH 1/2] qcdm: avoid upsetting the compiler with wrong aliasing We shouldn't be accessiing u_int8_t * as u_int16_t *. Let's construct the 16-bit value by or-ing the 8-bit halves directly; avoiding the endianness conversion too. --- libqcdm/src/commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libqcdm/src/commands.c b/libqcdm/src/commands.c index fe436e9..1c1e93a 100644 --- a/libqcdm/src/commands.c +++ b/libqcdm/src/commands.c @@ -2081,7 +2081,7 @@ qcdm_cmd_gsm_subsys_state_info_result (const char *buf, size_t len, int *out_err qcdm_result_add_u32 (result, QCDM_CMD_GSM_SUBSYS_STATE_INFO_ITEM_LAI_MNC, mnc); qcdm_result_add_u32 (result, QCDM_CMD_GSM_SUBSYS_STATE_INFO_ITEM_LAI_LAC, - le16toh (*(u_int16_t *)(&rsp->lai[3]))); + rsp->lai[4] << 8 | rsp->lai[3]); qcdm_result_add_u32 (result, QCDM_CMD_GSM_SUBSYS_STATE_INFO_ITEM_CELLID, le16toh (rsp->cellid)); } -- 2.7.4