diff options
author | John Hubbard <jhubbard@nvidia.com> | 2024-05-03 06:51:03 +0300 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2024-05-03 22:06:09 +0300 |
commit | 0515089418d064000b7f375257c10107d3ad0c7f (patch) | |
tree | 15f7df2afdd0227b7baa68be0f2042fe3d655e03 /tools/testing/selftests/cgroup | |
parent | 1da2363228d68da266443e7a85fa91edc2be3dac (diff) | |
download | linux-0515089418d064000b7f375257c10107d3ad0c7f.tar.xz |
selftests/cgroup: fix clang warnings: uninitialized fd variable
First of all, in order to build with clang at all, one must first apply
Valentin Obst's build fix for LLVM [1]. Once that is done, then when
building with clang, via:
make LLVM=1 -C tools/testing/selftests
...clang warns about fd being used uninitialized, in
test_memcg_reclaim()'s error handling path.
Fix this by initializing fd to -1.
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/testing/selftests/cgroup')
-rw-r--r-- | tools/testing/selftests/cgroup/test_memcontrol.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index b462416b3806..41ae8047b889 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -716,7 +716,9 @@ static bool reclaim_until(const char *memcg, long goal) */ static int test_memcg_reclaim(const char *root) { - int ret = KSFT_FAIL, fd, retries; + int ret = KSFT_FAIL; + int fd = -1; + int retries; char *memcg; long current, expected_usage; |