diff options
| author | Hongfu Li <lihongfu@kylinos.cn> | 2026-05-09 11:03:28 +0300 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-05-11 04:53:44 +0300 |
| commit | e32e6f02168f2ad7991eb5d160d312d2001520c8 (patch) | |
| tree | a515f206b16eed84f20d37273b1a86b33e819736 /tools/lib/python | |
| parent | 796ad622040f7f955ccc3973085e953415920496 (diff) | |
| download | linux-e32e6f02168f2ad7991eb5d160d312d2001520c8.tar.xz | |
selftests/cgroup: Fix cg_read_strcmp() empty string comparison
cg_read_strcmp() allocated a buffer sized to strlen(expected) + 1,
then passed it to read_text() which calls read(fd, buf, size-1).
When comparing against an empty string (""), strlen("") = 0 gives a
1-byte buffer, and read() is asked to read 0 bytes. The file content
is never actually read, so strcmp("", buf) always returns 0 regardless
of the real content. This caused cg_test_proc_killed() to always
report the cgroup as empty immediately, making OOM tests pass without
verifying that processes were killed.
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
