Commit c99539a8 authored by Guido's avatar Guido Committed by Guido Casati

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
parent b375a804
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment