s390x/cpumodel: Fix realize() error API violations
commitd687ae1ae280569f3072c28985cc2eba658b9b3f
authorMarkus Armbruster <armbru@redhat.com>
Wed, 4 Dec 2019 09:36:20 +0000 (4 10:36 +0100)
committerCornelia Huck <cohuck@redhat.com>
Sat, 14 Dec 2019 09:25:50 +0000 (14 10:25 +0100)
tree48c8bcf171ef177c83ffdba3f6f0652b923599ed
parent0325e5a37b52dd62d64701e1a247760bb6258c35
s390x/cpumodel: Fix realize() error API violations

get_max_cpu_model() dereferences @errp when
kvm_s390_get_host_cpu_model() fails, apply_cpu_model() dereferences it
when kvm_s390_apply_cpu_model() fails, and s390_realize_cpu_model()
dereferences it when get_max_cpu_model() or check_compatibility()
fail.  That's wrong; see the big comment in error.h.  All three
introduced in commit 80560137cf "s390x/cpumodel: check and apply the
CPU model".

No caller actually passes null.

Fix anyway: splice in a local Error *err, and error_propagate().

Cc: David Hildenbrand <david@redhat.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20191204093625.14836-14-armbru@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
target/s390x/cpu_models.c