From 7d740ab409689eefe9c88e7d1e7d94b8189ddf19 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 20 Nov 2016 20:41:20 +0100 Subject: boot: fix crash when S_processor_set_tasks is called early * boot/boot.c (S_processor_set_tasks): Return empty array when task_ihash.nr_items is still 0. --- boot/boot.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'boot/boot.c') diff --git a/boot/boot.c b/boot/boot.c index d0e02075..491c1a96 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -1994,6 +1994,10 @@ S_processor_set_tasks(mach_port_t processor_set, error_t err; size_t i; + if (!task_ihash.nr_items) + *task_listCnt = 0; + return 0; + err = vm_allocate (mach_task_self (), (vm_address_t *) task_list, task_ihash.nr_items * sizeof **task_list, 1); if (err) -- cgit v1.2.3