Skip to content

Commit

Permalink
s390/sthyi: Fix machine name validity indication
Browse files Browse the repository at this point in the history
[ Upstream commit b5130dc2224d1881f24224c0590c6d97f2168d6a ]

When running as a level 3 guest with no host provided sthyi support
sclp_ocf_cpc_name_copy() will only return zeroes. Zeroes are not a
valid group name, so let's not indicate that the group name field is
valid.

Also the group name is not dependent on stsi, let's not return based
on stsi before setting it.

Fixes: 95ca2cb ("KVM: s390: Add sthyi emulation")
Signed-off-by: Janosch Frank <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
frankjaa authored and gregkh committed Nov 13, 2018
1 parent 45d66e3 commit bb1d808
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/s390/kernel/sthyi.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,19 @@ static void fill_hdr(struct sthyi_sctns *sctns)
static void fill_stsi_mac(struct sthyi_sctns *sctns,
struct sysinfo_1_1_1 *sysinfo)
{
sclp_ocf_cpc_name_copy(sctns->mac.infmname);
if (*(u64 *)sctns->mac.infmname != 0)
sctns->mac.infmval1 |= MAC_NAME_VLD;

if (stsi(sysinfo, 1, 1, 1))
return;

sclp_ocf_cpc_name_copy(sctns->mac.infmname);

memcpy(sctns->mac.infmtype, sysinfo->type, sizeof(sctns->mac.infmtype));
memcpy(sctns->mac.infmmanu, sysinfo->manufacturer, sizeof(sctns->mac.infmmanu));
memcpy(sctns->mac.infmpman, sysinfo->plant, sizeof(sctns->mac.infmpman));
memcpy(sctns->mac.infmseq, sysinfo->sequence, sizeof(sctns->mac.infmseq));

sctns->mac.infmval1 |= MAC_ID_VLD | MAC_NAME_VLD;
sctns->mac.infmval1 |= MAC_ID_VLD;
}

static void fill_stsi_par(struct sthyi_sctns *sctns,
Expand Down

0 comments on commit bb1d808

Please sign in to comment.