mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
memory-device: Fix memory pre-plug error API violations
memory_device_get_free_addr() dereferences @errp when
memory_device_check_addable() fails. That's wrong; see the big
comment in error.h. Introduced in commit 1b6d6af21b
"pc-dimm: factor
out capacity and slot checks into MemoryDevice".
No caller actually passes null.
Fix anyway: splice in a local Error *err, and error_propagate().
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20191204093625.14836-11-armbru@redhat.com>
This commit is contained in:
parent
292743d976
commit
8574c9f1ad
1 changed files with 4 additions and 2 deletions
|
@ -99,6 +99,7 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
|
|||
uint64_t align, uint64_t size,
|
||||
Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GSList *list = NULL, *item;
|
||||
Range as, new = range_empty;
|
||||
|
||||
|
@ -123,8 +124,9 @@ static uint64_t memory_device_get_free_addr(MachineState *ms,
|
|||
return 0;
|
||||
}
|
||||
|
||||
memory_device_check_addable(ms, size, errp);
|
||||
if (*errp) {
|
||||
memory_device_check_addable(ms, size, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue