diff options
| author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2019-04-27 16:40:25 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-05-17 15:19:32 +0200 |
| commit | 6fa5171f4fb483f9c6b417c4fda3ed21549c4113 (patch) | |
| tree | 630937fed04feb51c0735abc424ea00bdade9bcf | |
| parent | 81c48dd79655296f5bf94823e8ac95902a8ac3e4 (diff) | |
| download | focaccia-qemu-6fa5171f4fb483f9c6b417c4fda3ed21549c4113.tar.gz focaccia-qemu-6fa5171f4fb483f9c6b417c4fda3ed21549c4113.zip | |
hw/i386/acpi: Assert a pointer is not null BEFORE using it
Commit 72c194f7e75c added a non-null check on the 'obj' pointer. Later, commit 500b11ea5095 added code which uses the 'obj' pointer _before_ the assertion check. Move the assertion _before_ the pointer use. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20190427144025.22880-4-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| -rw-r--r-- | hw/i386/acpi-build.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 123ff2b816..b4ec14e349 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -186,6 +186,7 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) pm->pcihp_io_base = 0; pm->pcihp_io_len = 0; + assert(obj); init_common_fadt_data(obj, &pm->fadt); if (piix) { /* w2k requires FADT(rev1) or it won't boot, keep PC compatible */ @@ -204,7 +205,6 @@ static void acpi_get_pm_info(AcpiPmInfo *pm) pm->fadt.flags |= 1 << ACPI_FADT_F_RESET_REG_SUP; pm->cpu_hp_io_base = ICH9_CPU_HOTPLUG_IO_BASE; } - assert(obj); /* The above need not be conditional on machine type because the reset port * happens to be the same on PIIX (pc) and ICH9 (q35). */ |