Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/10028 )

Change subject: fix unaligned access in build_ipcp_pco()
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/10028/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/10028/1/ggsn/ggsn.c@514
PS1, Line 514:  ipcp = (struct pco_ipcp_hdr *)pco_contains_proto(&pdp->pco_req, 
PCO_P_IPCP);
> So we increased size of the struct prepending bytes, but we still pass same 
> pointer here and didn't  […]
The alignment problem occurs because of the + 3 addition to the pointer value 
in the old code. The pointer is 2-byte aligned before this addition, but is 
unaligned after + 3.

The new code uses an aligned struct pointer only, and passes it on, whereas the 
old code manually created an unaligned struct pointer and passed it on.

Accessing a struct through an unaligned pointer is a problem. Depending on the 
generated assembly and the platform, the consequences range from inefficiency 
to a fatal CPU trap exception.

But accessing any element of the struct through an aligned struct pointer is 
OK, and the new code makes that happen.



--
To view, visit https://gerrit.osmocom.org/10028
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia75ee0f64e660f6ff6d81d808f9c460b7cac93d2
Gerrit-Change-Number: 10028
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Stefan Sperling <[email protected]>
Gerrit-Comment-Date: Thu, 19 Jul 2018 12:34:46 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No

Reply via email to