|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/2] hvmloader: correctly copy signature to info structures
The original code used sizeof(info->signature) as the size parameter for
memcpy, which was wrong.
Fix that by calculating the correct size.
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
tools/firmware/hvmloader/ovmf.c | 3 ++-
tools/firmware/hvmloader/seabios.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovmf.c
index b4bcc93..a4ed661 100644
--- a/tools/firmware/hvmloader/ovmf.c
+++ b/tools/firmware/hvmloader/ovmf.c
@@ -67,10 +67,11 @@ struct ovmf_info {
static void ovmf_setup_bios_info(void)
{
struct ovmf_info *info = (void *)OVMF_INFO_PHYSICAL_ADDRESS;
+ const char sig[] = "XenHVMOVMF";
memset(info, 0, sizeof(*info));
- memcpy(info->signature, "XenHVMOVMF", sizeof(info->signature));
+ memcpy(info->signature, sig, sizeof(sig));
info->length = sizeof(*info);
}
diff --git a/tools/firmware/hvmloader/seabios.c
b/tools/firmware/hvmloader/seabios.c
index 5c9a351..ca092cc 100644
--- a/tools/firmware/hvmloader/seabios.c
+++ b/tools/firmware/hvmloader/seabios.c
@@ -55,10 +55,11 @@ struct seabios_info {
static void seabios_setup_bios_info(void)
{
struct seabios_info *info = (void *)BIOS_INFO_PHYSICAL_ADDRESS;
+ const char sig[] = "XenHVMSeaBIOS";
memset(info, 0, sizeof(*info));
- memcpy(info->signature, "XenHVMSeaBIOS", sizeof(info->signature));
+ memcpy(info->signature, sig, sizeof(sig));
info->length = sizeof(*info);
info->tables = (uint32_t)scratch_alloc(MAX_TABLES*sizeof(uint32_t), 0);
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |