mirror of https://github.com/PentHertz/srsLTE.git
fix coverity issues
This commit is contained in:
parent
8258c28a4c
commit
07cd9ae528
|
@ -185,7 +185,8 @@ void parse_args(int argc, char **argv) {
|
|||
cell.id = atoi(argv[optind]);
|
||||
break;
|
||||
case 'x':
|
||||
strncpy(mimo_type_str, argv[optind], 32);
|
||||
strncpy(mimo_type_str, argv[optind], 31);
|
||||
mimo_type_str[31] = 0;
|
||||
break;
|
||||
case 'b':
|
||||
multiplex_pmi = (uint32_t) atoi(argv[optind]);
|
||||
|
|
|
@ -2243,9 +2243,9 @@ LIBLTE_ERROR_ENUM liblte_s1ap_pack_imsi(
|
|||
if(ie != NULL &&
|
||||
ptr != NULL)
|
||||
{
|
||||
// max length of IE buffer is 32, so limit
|
||||
if (ie->n_octets > 31) {
|
||||
printf("Length in struct exceeds buffer (%d > 31).\n", ie->n_octets);
|
||||
// max length of IE buffer is 8, so limit
|
||||
if (ie->n_octets > 7) {
|
||||
printf("Length in struct exceeds buffer (%d > 7).\n", ie->n_octets);
|
||||
return LIBLTE_ERROR_ENCODE_FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -232,8 +232,8 @@ void phch_worker::work_imp()
|
|||
|
||||
/** Calculate RSSI on the input signal before generating the output */
|
||||
|
||||
// Average RSSI over all symbols
|
||||
float rssi_dbm = 10*log10(srslte_vec_avg_power_cf(signal_buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb))) + 30;
|
||||
// Average RSSI over all symbols (make sure SF length is non-zero)
|
||||
float rssi_dbm = SRSLTE_SF_LEN_PRB(cell.nof_prb) > 0 ? (10*log10(srslte_vec_avg_power_cf(signal_buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb))) + 30) : 0;
|
||||
if (isnormal(rssi_dbm)) {
|
||||
phy->avg_rssi_dbm = SRSLTE_VEC_EMA(rssi_dbm, phy->avg_rssi_dbm, phy->args->snr_ema_coeff);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue