parse_cpu_list

Function parse_cpu_list 

Source
pub fn parse_cpu_list(s: &str) -> Option<Vec<u32>>
Expand description

Parse a cpulist string of the form "0-3,5,7-9" into a sorted deduped vec of CPU ids. None on empty input or any malformed token (partial results are rejected so the caller can distinguish “no data” from “data but garbled”).

§Range expansion cap

A single lo-hi token that would expand to more than 65 536 CPUs is rejected as malformed. Without this gate a hostile or corrupted Cpus_allowed_list: value like 0-4294967295 would allocate 16 GiB for the expansion vec and crash the capture (or OOM the process). The cap is far above any realistic CONFIG_NR_CPUS (current Linux defaults top out at a few thousand; even NR_CPUS=8192 builds stay inside this bound), so legitimate input is never rejected.