[LTP] [PATCH v2] memcg/memcontrol04: Fix judgment for recursive_protection
Li Wang
liwang@redhat.com
Wed Dec 25 12:56:34 CET 2024
Hi All,
There is another problem in that tst_cgroup lib that
the definition can lead to -1 during the | operation.
Because If the field is uninitialized (contains garbage),
it could hold 0b1, which is interpreted as -1 in signed arithmetic.
At least we need separate fix:
--- a/lib/tst_cgroup.c
+++ b/lib/tst_cgroup.c
@@ -44,7 +44,7 @@ struct cgroup_dir {
*/
int dir_fd;
- int we_created_it:1;
+ unsigned int we_created_it:1;
};
/* The root of a CGroup hierarchy/tree */
@@ -71,12 +71,12 @@ struct cgroup_root {
/* CGroup for current test. Which may have children. */
struct cgroup_dir test_dir;
- int nsdelegate:1;
- int memory_recursiveprot:1;
+ unsigned int nsdelegate:1;
+ unsigned int memory_recursiveprot:1;
- int we_mounted_it:1;
+ unsigned int we_mounted_it:1;
/* cpuset is in compatability mode */
- int no_cpuset_prefix:1;
+ unsigned int no_cpuset_prefix:1;
};
--
Regards,
Li Wang
More information about the ltp
mailing list