crash can simply determinate length of xen schedulers struct. static const struct scheduler *schedulers[] = { ... }; Signed-off-by: Nikola Pajkovsky <npajkovsky@xxxxxxx> --- xen_hyper.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xen_hyper.c b/xen_hyper.c index 27e44c6e733d..479aa1acfd43 100644 --- a/xen_hyper.c +++ b/xen_hyper.c @@ -435,7 +435,6 @@ xen_hyper_misc_init(void) /* * Do initialization for scheduler of Xen Hyper system here. */ -#define XEN_HYPER_SCHEDULERS_ARRAY_CNT 10 #define XEN_HYPER_SCHEDULER_NAME 1024 static void @@ -443,7 +442,8 @@ xen_hyper_schedule_init(void) { ulong addr, opt_sched, schedulers, opt_name; long scheduler_opt_name; - long schedulers_buf[XEN_HYPER_SCHEDULERS_ARRAY_CNT]; + long *schedulers_buf; + int nr_schedulers; struct xen_hyper_sched_context *schc; char *buf; char opt_name_buf[XEN_HYPER_OPT_SCHED_SIZE]; @@ -469,15 +469,17 @@ xen_hyper_schedule_init(void) XEN_HYPER_OPT_SCHED_SIZE, "opt_sched,", RETURN_ON_ERROR)) { error(FATAL, "cannot read opt_sched,.\n"); } + nr_schedulers = get_array_length("schedulers", 0, 0); + schedulers_buf = (long *)GETBUF(nr_schedulers * sizeof(long)); schedulers = symbol_value("schedulers"); addr = schedulers; while (xhscht->name == NULL) { if (!readmem(addr, KVADDR, schedulers_buf, - sizeof(long) * XEN_HYPER_SCHEDULERS_ARRAY_CNT, - "schedulers", RETURN_ON_ERROR)) { + sizeof(long) * nr_schedulers, + "schedulers", RETURN_ON_ERROR)) { error(FATAL, "cannot read schedulers.\n"); } - for (i = 0; i < XEN_HYPER_SCHEDULERS_ARRAY_CNT; i++) { + for (i = 0; i < nr_schedulers; i++) { if (schedulers_buf[i] == 0) { error(FATAL, "schedule data not found.\n"); } @@ -514,9 +516,10 @@ xen_hyper_schedule_init(void) strncpy(xhscht->name, buf, strlen(buf)); break; } - addr += sizeof(long) * XEN_HYPER_SCHEDULERS_ARRAY_CNT; + addr += sizeof(long) * nr_schedulers; } FREEBUF(buf); + FREEBUF(schedulers_buf); /* get schedule_data information */ if((xhscht->sched_context_array = -- 2.13.6 -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility