[LTP] [PATCH] lib: switch cgroup bit-fields from signed to unsigned int

Petr Vorel pvorel@suse.cz
Thu Jan 23 21:50:04 CET 2025


Hi Li,

> There is a problem in cgroup lib that the declearation int
> can lead to -1 during the | operation.

> Becasue if the field contains uninitialized garbage data,
> a bit-field declared as int could interpret 0b1 as -1 due
> to signed arithmetic.

> By changing the type to unsigned int, the issue is avoided
> since unsigned fields cannot represent negative values.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

> Signed-off-by: Li Wang <liwang@redhat.com>
> Cc: Jin Guojie <guojie.jin@gmail.com>
> ---

> Notes:
>     @Cyril, Petr, I vote to merge this patch before the release.
>     @Guojie, Could you plz repost your memcontrol04 patch based on this change?

+1

Kind regards,
Petr


More information about the ltp mailing list