[PATCH] osmo-bsc[master]: pcu_sock.c: Avoid breaking strict-aliasing on ptr derreference

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Sat Mar 17 20:04:59 UTC 2018


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/7333

to look at the new patch set (#3).

pcu_sock.c: Avoid breaking strict-aliasing on ptr derreference

Fixes following warning:
pcu_sock.c: In function 'pcu_rx_data_req':
pcu_sock.c:406:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   tlli = *((uint32_t *)data_req->data);
   ^

Change-Id: I5c93487c72d15b061e73ed4f9acbf2e77dec967a
---
M src/libbsc/pcu_sock.c
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/33/7333/3

diff --git a/src/libbsc/pcu_sock.c b/src/libbsc/pcu_sock.c
index caec40d..094a8d2 100644
--- a/src/libbsc/pcu_sock.c
+++ b/src/libbsc/pcu_sock.c
@@ -403,7 +403,7 @@
 					"invalid/small length %d\n", data_req->len);
 			break;
 		}
-		tlli = *((uint32_t *)data_req->data);
+		tlli = osmo_load32be(data_req->data);
 
 		msg = msgb_alloc(data_req->len - 4, "pcu_agch");
 		if (!msg) {
@@ -737,4 +737,3 @@
 	talloc_free(state);
 	bts->pcu_state = NULL;
 }
-

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5c93487c72d15b061e73ed4f9acbf2e77dec967a
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list