pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30223 )
Change subject: amr: Guard against incorrect AMR FT passed to osmo_amr_{bits,bytes}()
......................................................................
amr: Guard against incorrect AMR FT passed to osmo_amr_{bits,bytes}()
Fixes: Coverity CID#283433
Change-Id: Ib11d4b64c6df19a85c4374fde89e1b56f410e438
---
M src/amr.c
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
osmith: Looks good to me, but someone else must approve
msuraev: Looks good to me, but someone else must approve
diff --git a/src/amr.c b/src/amr.c
index 6ed5b6c..1b750eb 100644
--- a/src/amr.c
+++ b/src/amr.c
@@ -14,6 +14,8 @@
#include <unistd.h>
#include <string.h>
#include <stdbool.h>
+
+#include <osmocom/core/utils.h>
#include <osmocom/netif/amr.h>
/* According to TS 26.101:
@@ -56,11 +58,13 @@
size_t osmo_amr_bits(uint8_t amr_ft)
{
+ OSMO_ASSERT(amr_ft < AMR_FT_MAX);
return amr_ft_to_bits[amr_ft];
}
size_t osmo_amr_bytes(uint8_t amr_ft)
{
+ OSMO_ASSERT(amr_ft < AMR_FT_MAX);
return amr_ft_to_bytes[amr_ft];
}
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30223
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ib11d4b64c6df19a85c4374fde89e1b56f410e438
Gerrit-Change-Number: 30223
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: msuraev.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/30220 )
Change subject: Split tbf_fsm as tbf_{ul,dl}_fsm
......................................................................
Patch Set 3:
(1 comment)
File src/tbf_dl_fsm.c:
https://gerrit.osmocom.org/c/osmo-pcu/+/30220/comment/deb9f135_669bffe4
PS3, Line 7: * modify it under the terms of the GNU General Public License
> Which license should be used? For example bts. […]
The text explicitly states it: "version 2 or [...] any later version". So GPL2+.
In any case, I'm simply splitting the code here, so I'm not really changing the license here.
Since I'm the author and sysmocom holds teh copyright it can be changed to whatever we want.
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/30220
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I879af3f4b3e330687d498cd59f5f4933d6ca56f0
Gerrit-Change-Number: 30220
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: msuraev <msuraev(a)sysmocom.de>
Gerrit-Attention: msuraev <msuraev(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 21 Nov 2022 10:03:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: msuraev <msuraev(a)sysmocom.de>
Gerrit-MessageType: comment
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/30219 )
Change subject: Refactor tbf_is_tfi_assigned() to avoid accessing tbf->state_fsm
......................................................................
Refactor tbf_is_tfi_assigned() to avoid accessing tbf->state_fsm
The state_fsm field will be moved to subclass (DL_TBF/UL_TBF) in a
follow up commit when splitting the tbf_fsm.c implementation per
subclass.
Rearrange a bit the code to access the using the subclass pointer in the
only sublcass where it needs to be used (DL_TBF).
Change-Id: I360485c73be8636565f89ba29796d84ac94fd94e
---
M src/gprs_rlcmac_sched.cpp
M src/tbf.cpp
M src/tbf.h
3 files changed, 15 insertions(+), 14 deletions(-)
Approvals:
Jenkins Builder: Verified
msuraev: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 20b4f8e..1857c3c 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -57,7 +57,7 @@
if (tbf_ul_ass_rts(ul_tbf))
tbf_cand->ul_ass = ul_tbf;
/* NACC ready to send. TFI assigned is needed to send messages */
- if (ul_tbf->is_tfi_assigned() && ms_nacc_rts(ul_tbf->ms()))
+ if (tbf_is_tfi_assigned(ul_tbf) && ms_nacc_rts(ul_tbf->ms()))
tbf_cand->nacc = ul_tbf;
/* FIXME: Is this supposed to be fair? The last TBF for each wins? Maybe use llist_add_tail and skip once we have all
states? */
@@ -73,7 +73,7 @@
if (tbf_ul_ass_rts(dl_tbf))
tbf_cand->ul_ass = dl_tbf;
/* NACC ready to send. TFI assigned is needed to send messages */
- if (dl_tbf->is_tfi_assigned() && ms_nacc_rts(dl_tbf->ms()))
+ if (tbf_is_tfi_assigned(dl_tbf) && ms_nacc_rts(dl_tbf->ms()))
tbf_cand->nacc = dl_tbf;
}
}
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 87e85f0..4aa4089 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -851,7 +851,19 @@
bool tbf_is_tfi_assigned(const struct gprs_rlcmac_tbf *tbf)
{
- return tbf->is_tfi_assigned();
+ const struct gprs_rlcmac_dl_tbf *dl_tbf;
+
+ /* The TBF is established: */
+ if (tbf->state_fi->state > TBF_ST_ASSIGN)
+ return true;
+
+ /* The DL TBF has been assigned by a IMM.ASS: */
+ dl_tbf = tbf_as_dl_tbf_const(tbf);
+ if (tbf->state_fi->state == TBF_ST_ASSIGN && dl_tbf &&
+ (dl_tbf->state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
+ return true;
+
+ return false;
}
uint8_t tbf_tfi(const struct gprs_rlcmac_tbf *tbf)
diff --git a/src/tbf.h b/src/tbf.h
index fedf312..b1ff221 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -200,7 +200,6 @@
bool is_tlli_valid() const;
uint8_t tfi() const;
- bool is_tfi_assigned() const;
const char *imsi() const;
uint8_t ta() const;
@@ -315,16 +314,6 @@
return tlli() != GSM_RESERVED_TMSI;
}
-inline bool gprs_rlcmac_tbf::is_tfi_assigned() const
-{
- /* The TBF is established or has been assigned by a IMM.ASS for
- * download */
- return state_fi->state > TBF_ST_ASSIGN ||
- (direction == GPRS_RLCMAC_DL_TBF &&
- state_fi->state == TBF_ST_ASSIGN &&
- (state_fsm.state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)));
-}
-
inline uint8_t gprs_rlcmac_tbf::tfi() const
{
return m_tfi;
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/30219
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I360485c73be8636565f89ba29796d84ac94fd94e
Gerrit-Change-Number: 30219
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: msuraev <msuraev(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged