Re: [PATCH] cgroup: Fix potential overflow issue when checking max_depth

From: Michal Koutný
Date: Mon Oct 14 2024 - 09:37:32 EST


Hello.

On Sat, Oct 12, 2024 at 07:22:46AM GMT, Xiu Jianfeng <xiujianfeng@xxxxxxxxxxxxxxx> wrote:
> It's worth mentioning that this issue is unlikely to occur in reality,
> as it's impossible to have a depth of INT_MAX hierarchy, but should be
> be avoided logically.

Strictly speaking the overflow would be undefined behavior (Out of curiousity --
have you figured this out with a checker tool or code reading?)
Logically (neglecting UB), max_depth=INT_MAX would behave like intended
(no limit).

> Fixes: 1a926e0bbab8 ("cgroup: implement hierarchy limits")
> Signed-off-by: Xiu Jianfeng <xiujianfeng@xxxxxxxxxx>
> ---
> kernel/cgroup/cgroup.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>

Attachment: signature.asc
Description: PGP signature