diff options
| author | Tao Cui <cuitao@kylinos.cn> | 2026-04-22 10:17:09 +0800 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-04-23 07:00:36 -1000 |
| commit | 5bbb3453e8f35e1eacde30459e1fa7625c8d6d21 (patch) | |
| tree | 0cdf3c912d7a0526f150bc5e04f03c073561c7db /include/linux/timerqueue_types.h | |
| parent | 41d701ddc36d5301b44ea79529f3cf03c541c1e1 (diff) | |
cgroup/rdma: refactor resource parsing with match_table_t/match_token()
Replace the hand-rolled strsep/strcmp/match_string parsing in
rdmacg_resource_set_max() with a match_table_t and match_token()
pattern, following the convention used by user_proactive_reclaim()
and ioc_cost_model_write().
The old strncmp(value, RDMACG_MAX_STR, strlen(value)) also had two
bugs that are fixed by this refactor:
- It matched "ma" as "max" because strncmp only compared the
shorter strlen(value) bytes.
- It silently accepted "hca_handle=" (empty value) as "max"
because strncmp with n=0 always returns 0.
The match_token() approach also robustly handles extra whitespace in
the input by splitting on " \t\n" and skipping empty tokens.
Suggested-by: "Michal Koutný" <mkoutny@suse.com>
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/timerqueue_types.h')
0 files changed, 0 insertions, 0 deletions
