don't segfault when trying to baseline an odd cpu model

-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEw9DWbcNiT/aowBjO3s9rk8bwL68FAltQeFkSHGNvaHVja0By
 ZWRoYXQuY29tAAoJEN7Pa5PG8C+vAekP/ivXO2fiBv9nP1/xPTReSXC1mMFHS+e3
 TZY6xA5GWbZ/M+s6OMpi40IToCN6OQVYxQQm1W+MiZq5lrM1/M+F/qA0rUZciaQW
 qK4UxTC/wTfL5N5Q47g7c7IeHlAONGGGFxZfu8rmrU2Dxe7+5g1aDmCzZ+fknlPG
 4AZSmc/GMacTYqL0Dno0GtHeneygruPsbssozLh87IEYUF3DRlQBBHvgUlx0IJ3T
 xI5xnS425u+DeF/DNEVhzKGkAcN5WkGgWargCS1kICBKHFIIiQh4CBS7Gv1ae8+i
 1B8OLbJz5jcLcw0bz4PyKQ5VyCgTwn5kTDAvEPSMrMUk0eFGN2W+eoDQEqu2TyKK
 V2dYqUOG+S5WnzbmkkIlBhHyBocoBf+yg0wRFajZRG0sMDb/lEIa5e4cJrBbTP8h
 TbD/TUHEhXThHw3Pn7IiGkGxHuGebrPtzEJbcz3MoUnuTBqdngr23LFm3yhPQ5rU
 LHm16foWAoHBPaIinWrhY83W88wPVsWONJn3JMGI9bk2APBAVOyI4q0xhQFGnXas
 zfG7eI+ae8TWUGZh1VMOICE8Qk0zbtTcCPXKpPMVuFQYwElFwgDv6v6qY4rbymON
 4xuknuGJLsjmCdF3Fy3qsSZd5lrKSfXNYyciGS469qhINr3LRrZV6d8/zXfHn4JP
 1h3rQ9W3DNrE
 =ZpxU
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180719' into staging

don't segfault when trying to baseline an odd cpu model

# gpg: Signature made Thu 19 Jul 2018 12:39:05 BST
# gpg:                using RSA key DECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20180719:
  s390x/cpumodel: fix segmentation fault when baselining models

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-07-19 13:12:47 +01:00
commit 771eab9349
1 changed files with 8 additions and 0 deletions

View File

@ -716,6 +716,14 @@ CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *infoa,
model.def = s390_find_cpu_def(cpu_type, max_gen, max_gen_ga,
model.features);
/* models without early base features (esan3) are bad */
if (!model.def) {
error_setg(errp, "No compatible CPU model could be created as"
" important base features are disabled");
return NULL;
}
/* strip off features not part of the max model */
bitmap_and(model.features, model.features, model.def->full_feat,
S390_FEAT_MAX);