Quoting Nina Schoetterl-Glausch (2023-10-11 10:56:30) > Rewrite recursion with separate functions for checking containers, > containers containing CPUs and CPUs. > This improves comprehension and allows for more tests. > We now also test for ordering of CPU TLEs and number of child entries. > > Signed-off-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx> [...] > diff --git a/s390x/topology.c b/s390x/topology.c > index c1f6520f..9838434c 100644 > --- a/s390x/topology.c > +++ b/s390x/topology.c [...] > +static union topology_container *check_child_cpus(struct sysinfo_15_1_x *info, > + union topology_container *cont, > + union topology_cpu *child, > + int *cpus_in_masks) > +{ > + void *last = ((void *)info) + info->length; > + union topology_cpu *prev_cpu = NULL; > + int cpus = 0; I know __builtin_popcountl returns int, but maybe it makes sense to make this and cpus_in_masks an unsigned type? > + for (; (void *)child < last && child->nl == 0; child++) { Personal preference, I prefer simply iterating over a counter, but its up to you.