Bugfix wrong use of qsort

- The qsort() function is defined as:
  void qsort(void *base, size_t nmemb, size_t size,
    int (*compar)(const void *, const void *));
  and sorts an array with nmemb elements of size size.
- in the gNB scheduling functions, nmemb and size were swapped
- this was causing a stack overflow ending with a SEGFAULT under certain circumstances
This commit is contained in:
Guido
2022-12-19 15:15:05 +01:00
committed by Guido Casati
parent b375a804bf
commit c99539a806
2 changed files with 2 additions and 2 deletions
@@ -628,7 +628,7 @@ void pf_dl(module_id_t module_id,
}
}
qsort(UE_sched, sizeof(*UE_sched), sizeofArray(UE_sched), comparator);
qsort(UE_sched, sizeofArray(UE_sched), sizeof(UEsched_t), comparator);
UEsched_t *iterator = UE_sched;
const int min_rbSize = 5;
@@ -1705,7 +1705,7 @@ void pf_ul(module_id_t module_id,
curUE++;
}
qsort(UE_sched, sizeof(*UE_sched), sizeofArray(UE_sched), comparator);
qsort(UE_sched, sizeofArray(UE_sched), sizeof(UEsched_t), comparator);
UEsched_t *iterator=UE_sched;
/* Loop UE_sched to find max coeff and allocate transmission */