Quoting Janosch Frank (2023-10-11 13:22:03) > On 10/11/23 13:19, Nina Schoetterl-Glausch wrote: > > On Wed, 2023-10-11 at 13:16 +0200, Janosch Frank wrote: > >> On 10/11/23 10:56, Nina Schoetterl-Glausch wrote: > >>> Add checks for length field. > >>> Also minor refactor. > >>> > >>> Signed-off-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx> > >>> --- > >>> s390x/topology.c | 15 +++++++++------ > >>> 1 file changed, 9 insertions(+), 6 deletions(-) > >>> > >>> diff --git a/s390x/topology.c b/s390x/topology.c > >>> index 5374582f..0ba57986 100644 > >>> --- a/s390x/topology.c > >>> +++ b/s390x/topology.c > >>> @@ -187,18 +187,22 @@ static void stsi_check_maxcpus(struct sysinfo_15_1_x *info) > >>> } > >>> > >>> /* > >>> - * stsi_check_mag > >>> + * stsi_check_header > >>> * @info: Pointer to the stsi information > >>> + * @sel2: stsi selector 2 value > >>> * > >>> * MAG field should match the architecture defined containers > >>> * when MNEST as returned by SCLP matches MNEST of the SYSIB. > >>> */ > >>> -static void stsi_check_mag(struct sysinfo_15_1_x *info) > >>> +static void stsi_check_header(struct sysinfo_15_1_x *info, int sel2) > >>> { > >>> int i; > >>> > >>> - report_prefix_push("MAG"); > >>> + report_prefix_push("Header"); > >>> > >>> + report(IS_ALIGNED(info->length, 8), "Length %d multiple of 8", info->length); > >> > >> STSI 15 works on Words, not DWords, no? > >> So we need to check length against 4, not 8. > > > > The header is 16 bytes. > > Topology list entries are 8 or 16, so it must be a multiple of 8 at least. > > Fair enough Since I had the same question, can we have a comment here? This isn't perfect but good enough IMO: /* PoP mandates 4-byte alignment, but header is 16 bytes, TLEs are 8 or 16 bytes, so check for 8 byte align */ Otherwise: Reviewed-by: Nico Boehr <nrb@xxxxxxxxxxxxx>