From 9cbaad2c3a8efaafb43f1019e90c824158797049 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 26 Jan 2017 00:35:02 +0100 Subject: [PATCH] Check maximum EARFCN --- srslte/lib/common/phy_common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/srslte/lib/common/phy_common.c b/srslte/lib/common/phy_common.c index 68532ebeb..4717c6ca7 100644 --- a/srslte/lib/common/phy_common.c +++ b/srslte/lib/common/phy_common.c @@ -439,15 +439,21 @@ int srslte_band_get_band(uint32_t earfcn) { } float srslte_band_fd(uint32_t earfcn) { + if (earfcn > lte_bands[SRSLTE_NOF_LTE_BANDS-1].earfcn_max) { + return -1; + } uint32_t i = SRSLTE_NOF_LTE_BANDS-1; while(i > 0 && lte_bands[i].earfcn_offset>earfcn) { i--; } - return get_fd(<e_bands[i], earfcn); + return get_fd(<e_bands[i], earfcn); } float srslte_band_fu(uint32_t earfcn) { + if (earfcn > lte_bands[SRSLTE_NOF_LTE_BANDS-1].earfcn_max) { + return -1; + } uint32_t i = SRSLTE_NOF_LTE_BANDS-1; while(i > 0 && lte_bands[i].earfcn_offset>earfcn) { i--;