Skip to content

Commit c7777f4

Browse files
committed
rt: Add sanity checks when we hit the max task/port id
1 parent 12fa908 commit c7777f4

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/rt/rust_kernel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ rust_kernel::register_task(rust_task *task) {
8989
task->user.id = max_task_id++;
9090
task_table.put(task->user.id, task);
9191
}
92+
K(srv, task->user.id != INTPTR_MAX, "Hit the maximum task id");
9293
KLOG_("Registered task %" PRIdPTR, task->user.id);
9394
int new_live_tasks = sync::increment(live_tasks);
9495
KLOG_("Total outstanding tasks: %d", new_live_tasks);

src/rt/rust_task.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ rust_port_id rust_task::register_port(rust_port *port) {
628628
scoped_lock with(lock);
629629

630630
rust_port_id id = next_port_id++;
631+
A(thread, id != INTPTR_MAX, "Hit the maximum port id");
631632
port_table.put(id, port);
632633
return id;
633634
}

0 commit comments

Comments
 (0)