[S] Change in osmo-mgw[master]: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email ) Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() .. Patch Set 2: (1 comment) File include/osmocom/mgcp/mgcp_common.h: https://gerrit.osmocom.org/c/osmo-mgw/+/35321/comment/7cd0ee9b_d1cdd7d9 PS1, Line 86: > The code writes to `tail[-1]`, which corresponds to the last character of the > received MGCP message. […] https://gerrit.osmocom.org/c/osmo-mgw/+/35381 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Gerrit-Change-Number: 35321 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: fixeria Gerrit-Reviewer: pespin Gerrit-CC: laforge Gerrit-Comment-Date: Sun, 17 Dec 2023 11:55:41 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge Comment-In-Reply-To: fixeria Gerrit-MessageType: comment
[S] Change in osmo-mgw[master]: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email ) Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() .. mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() The current statement: msg->l2h + msgb_l2len(msg) looks as follows, if we expand the msgb_l2len(): msg->l2h + msgb->tail - msg->l2h so this is basically equal to msgb->tail alone. Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Related: CID#272990 --- M include/osmocom/mgcp/mgcp_common.h 1 file changed, 21 insertions(+), 1 deletion(-) Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified daniel: Looks good to me, approved diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h index 7de45f9..be5a0d6 100644 --- a/include/osmocom/mgcp/mgcp_common.h +++ b/include/osmocom/mgcp/mgcp_common.h @@ -68,7 +68,7 @@ /* Ensure that the msg->l2h is NUL terminated. */ static inline int mgcp_msg_terminate_nul(struct msgb *msg) { - unsigned char *tail = msg->l2h + msgb_l2len(msg); /* char after l2 data */ + unsigned char *tail = msg->tail; /* char after l2 data */ if (tail[-1] == '\0') /* nothing to do */; else if (msgb_tailroom(msg) > 0) -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Gerrit-Change-Number: 35321 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: fixeria Gerrit-Reviewer: pespin Gerrit-CC: laforge Gerrit-MessageType: merged
[S] Change in osmo-mgw[master]: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
Attention is currently required from: laforge. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email ) Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() .. Patch Set 1: (1 comment) File include/osmocom/mgcp/mgcp_common.h: https://gerrit.osmocom.org/c/osmo-mgw/+/35321/comment/76d96d20_338ca5c4 PS1, Line 86: > the original code looks neoken. […] The code writes to `tail[-1]`, which corresponds to the last character of the received MGCP message. Ah, you're likely talking about line 75? In that case yes, we should do `msgb_put(msg, '\0')` instead. I will fix this in a separate patch. -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Gerrit-Change-Number: 35321 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: pespin Gerrit-CC: laforge Gerrit-Attention: laforge Gerrit-Comment-Date: Sun, 17 Dec 2023 11:50:28 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge Gerrit-MessageType: comment
[S] Change in osmo-mgw[master]: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
Attention is currently required from: fixeria. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email ) Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() .. Patch Set 1: (1 comment) File include/osmocom/mgcp/mgcp_common.h: https://gerrit.osmocom.org/c/osmo-mgw/+/35321/comment/9f8d970b_c6d1727f PS1, Line 86: the original code looks neoken. if we want to write to tail[0] we actually have to use something like msgb_put. -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Gerrit-Change-Number: 35321 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: pespin Gerrit-CC: laforge Gerrit-Attention: fixeria Gerrit-Comment-Date: Sat, 16 Dec 2023 21:55:30 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
[S] Change in osmo-mgw[master]: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
Attention is currently required from: fixeria. daniel has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email ) Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Gerrit-Change-Number: 35321 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel Gerrit-Reviewer: pespin Gerrit-Attention: fixeria Gerrit-Comment-Date: Tue, 12 Dec 2023 13:26:06 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in osmo-mgw[master]: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
Attention is currently required from: fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email ) Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Gerrit-Change-Number: 35321 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin Gerrit-Attention: fixeria Gerrit-Comment-Date: Mon, 11 Dec 2023 14:38:24 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in osmo-mgw[master]: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email ) Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() .. mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() The current statement: msg->l2h + msgb_l2len(msg) looks as follows, if we expand the msgb_l2len(): msg->l2h + msgb->tail - msg->l2h so this is basically equal to msgb->tail alone. Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Related: CID#272990 --- M include/osmocom/mgcp/mgcp_common.h 1 file changed, 21 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/21/35321/1 diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h index 7de45f9..be5a0d6 100644 --- a/include/osmocom/mgcp/mgcp_common.h +++ b/include/osmocom/mgcp/mgcp_common.h @@ -68,7 +68,7 @@ /* Ensure that the msg->l2h is NUL terminated. */ static inline int mgcp_msg_terminate_nul(struct msgb *msg) { - unsigned char *tail = msg->l2h + msgb_l2len(msg); /* char after l2 data */ + unsigned char *tail = msg->tail; /* char after l2 data */ if (tail[-1] == '\0') /* nothing to do */; else if (msgb_tailroom(msg) > 0) -- To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-mgw Gerrit-Branch: master Gerrit-Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54 Gerrit-Change-Number: 35321 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria Gerrit-MessageType: newchange