Attention is currently required from: osmith, fixeria.
pespin has posted comments on this change. (
https://gerrit.osmocom.org/c/osmo-sgsn/+/29279 )
Change subject: llc: gprs_llc_hdr_parse(): make the input data pointer const
......................................................................
Patch Set 1:
(1 comment)
File src/gprs/gprs_llc_parse.c:
https://gerrit.osmocom.org/c/osmo-sgsn/+/29279/comment/5d198a3d_6d1a71a1
PS1, Line 138: ghp->data = (uint8_t *)&ctrl[3];
Yes, but why doing this is wrong? gprs_llc_hdr_parse()
itself does not modify *llc_hdr, so it's cons […]
The compiler may make
optimizations based on what passed to the function. If a const pointer is passed to a
function, that means it can be inferred that the content of array remains invariable
regardless of whether the function was called or not. You are actually telling the
compiler one thing while actually sneakily changing what you announced. That's why
casting should be done carefully and with a good reason.
If the data content being passed here will need to be writeable, bear with it and
don't announce it's const.
--
To view, visit
https://gerrit.osmocom.org/c/osmo-sgsn/+/29279
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I9757d2be5af589ccbe4d3d406637a33690284754
Gerrit-Change-Number: 29279
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 07 Sep 2022 09:07:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment