diff options
-rw-r--r-- | kexec/crashdump-xen.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kexec/crashdump-xen.c b/kexec/crashdump-xen.c index 30506e2..fcef9db 100644 --- a/kexec/crashdump-xen.c +++ b/kexec/crashdump-xen.c @@ -93,13 +93,12 @@ int xen_get_nr_phys_cpus(void) if ((cpus = kexec_iomem_for_each_line(match, NULL, NULL))) { n = sizeof(struct crash_note_info) * cpus; xen_phys_notes = malloc(n); - if (xen_phys_notes) { - memset(xen_phys_notes, 0, n); - kexec_iomem_for_each_line(match, - xen_crash_note_callback, - NULL); + if (!xen_phys_notes) { + fprintf(stderr, "failed to allocate xen_phys_notes.\n"); + return -1; } - + memset(xen_phys_notes, 0, n); + kexec_iomem_for_each_line(match, xen_crash_note_callback, NULL); xen_phys_cpus = cpus; } |