xen: take struct size into account for video information
The xenpf_dom0_console_t structure can grow as more data is added, and
hence we need to check that the fields we accesses have been filled by
Xen. The only extra field FreeBSD currently uses is the top 32 bits
for the frame buffer physical address.
Note that this field is present in all the versions that make the
information available from the platform hypercall interface, so the
check here is mostly cosmetic, and to remember us that newly added
fields require checking the size of the returned data.
Fixes: 6f80738b22
('xen: fetch dom0 video console information from Xen')
Sponsored by: Citrix Systems R&D
This commit is contained in:
parent
adeca21464
commit
a78e46a7db
@ -347,11 +347,11 @@ fixup_console(caddr_t kmdp)
|
|||||||
struct efi_fb efi;
|
struct efi_fb efi;
|
||||||
struct vbe_fb vbe;
|
struct vbe_fb vbe;
|
||||||
} *fb = NULL;
|
} *fb = NULL;
|
||||||
int ret;
|
int size;
|
||||||
|
|
||||||
ret = HYPERVISOR_platform_op(&op);
|
size = HYPERVISOR_platform_op(&op);
|
||||||
if (ret != 0) {
|
if (size < 0) {
|
||||||
xc_printf("Failed to get dom0 video console info\n");
|
xc_printf("Failed to get dom0 video console info: %d\n", size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,8 +381,11 @@ fixup_console(caddr_t kmdp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb->efi.fb_addr = console->u.vesa_lfb.lfb_base |
|
fb->efi.fb_addr = console->u.vesa_lfb.lfb_base;
|
||||||
((uint64_t)console->u.vesa_lfb.ext_lfb_base << 32);
|
if (size >
|
||||||
|
offsetof(xenpf_dom0_console_t, u.vesa_lfb.ext_lfb_base))
|
||||||
|
fb->efi.fb_addr |=
|
||||||
|
(uint64_t)console->u.vesa_lfb.ext_lfb_base << 32;
|
||||||
fb->efi.fb_size = console->u.vesa_lfb.lfb_size << 16;
|
fb->efi.fb_size = console->u.vesa_lfb.lfb_size << 16;
|
||||||
fb->efi.fb_height = console->u.vesa_lfb.height;
|
fb->efi.fb_height = console->u.vesa_lfb.height;
|
||||||
fb->efi.fb_width = console->u.vesa_lfb.width;
|
fb->efi.fb_width = console->u.vesa_lfb.width;
|
||||||
|
Loading…
Reference in New Issue
Block a user