Commit 0000501
committed
Fix divide-by-zero in MCTS fixed_log overflow
In fixed_log, the divisor (v + (1U << FIXED_SCALE_BITS)) is computed in
32-bit arithmetic. When v = 0xFFFF0000 (n_total=65535, so n_total<<16),
the addition overflows to zero, triggering a kernel Oops (divide error)
inside the kxod workqueue via ai_one_work_func -> play_agent_move ->
mcts.
This crashes the kworker, leaves the module refcount elevated, and makes
rmmod hang forever, which is CI timeout seen in integration-tests job.
Cast v to u64 before the addition so denominator is computed in 64-bit
and cannot wrap to zero.1 parent 00008d6 commit 0000501
2 files changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
| 66 | + | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
0 commit comments