Re: [PATCH 06/11] cgroup: fix -Wzero-length-bounds warnings

From: Michal Koutný
Date: Tue Mar 30 2021 - 10:45:46 EST


On Tue, Mar 30, 2021 at 11:00:36AM +0200, Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> Would it be possible to enclose most or all of kernel/cgroup/cgroup.c
> in an #ifdef CGROUP_SUBSYS_COUNT block?
Even without any controllers, there can still be named hierarchies (v1)
or the default hierarchy (v2) (for instance) for process tracking
purposes. So only parts of kernel/cgroup/cgroup.c could be ifdef'd.

Beware that CGROUP_SUBSYS_COUNT is not known at preprocessing stage (you
could have a macro alternative though).

> I didn't try that myself, but this might be a way to guarantee that
> there cannot be any callers (it would cause a link error).
Such a guarantee would be nicer, I agree. I tried a bit but anandoned it
when I saw macros proliferate (which I found less readable than your
current variant). But YMMV.

Michal

Attachment: signature.asc
Description: Digital signature