WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] [HVMLOADER] fixup compiler warnings and constant usa

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] [HVMLOADER] fixup compiler warnings and constant usage
From: Ben Thomas <bthomas@xxxxxxxxxxxxxxx>
Date: Mon, 12 Mar 2007 16:02:27 -0400
Delivery-date: Mon, 12 Mar 2007 13:02:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070302)
This patch fixes up some compiler warnings from the hvmloader build.
And, while I was there, I removed the hard constants from the
strncpy functions.

Signed-off-by: Ben Thomas (bthomas@xxxxxxxxxxxxxxx)

--
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
bthomas@xxxxxxxxxxxxxxx                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                   Lowell, MA 01851
diff -r 0444f009ccbb tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c     Mon Mar 12 15:48:11 2007 -0400
+++ b/tools/firmware/hvmloader/acpi/build.c     Mon Mar 12 15:53:28 2007 -0400
@@ -57,8 +57,8 @@ int construct_madt(struct acpi_20_madt *
     memset(madt, 0, sizeof(*madt));
     madt->header.signature    = ACPI_2_0_MADT_SIGNATURE;
     madt->header.revision     = ACPI_2_0_MADT_REVISION;
-    strncpy(madt->header.oem_id, ACPI_OEM_ID, 6);
-    strncpy(madt->header.oem_table_id, ACPI_OEM_TABLE_ID, 8);
+    strncpy((char *)madt->header.oem_id, ACPI_OEM_ID, 
sizeof(madt->header.oem_id));
+    strncpy((char *)madt->header.oem_table_id, ACPI_OEM_TABLE_ID, 
sizeof(madt->header.oem_table_id));
     madt->header.oem_revision = ACPI_OEM_REVISION;
     madt->header.creator_id   = ACPI_CREATOR_ID;
     madt->header.creator_revision = ACPI_CREATOR_REVISION;
@@ -131,8 +131,8 @@ int construct_hpet(struct acpi_20_hpet *
     memset(hpet, 0, sizeof(*hpet));
     hpet->header.signature    = ACPI_2_0_HPET_SIGNATURE;
     hpet->header.revision     = ACPI_2_0_HPET_REVISION;
-    strncpy(hpet->header.oem_id, ACPI_OEM_ID, 6);
-    strncpy(hpet->header.oem_table_id, ACPI_OEM_TABLE_ID, 8);
+    strncpy((char *)hpet->header.oem_id, ACPI_OEM_ID, 
sizeof(hpet->header.oem_id));
+    strncpy((char *)hpet->header.oem_table_id, ACPI_OEM_TABLE_ID, 
sizeof(hpet->header.oem_table_id));
     hpet->header.oem_revision = ACPI_OEM_REVISION;
     hpet->header.creator_id   = ACPI_CREATOR_ID;
     hpet->header.creator_revision = ACPI_CREATOR_REVISION;
@@ -161,8 +161,8 @@ int construct_processor_objects(uint8_t 
     hdr = (struct acpi_header *)p;
     hdr->signature = ASCII32('S','S','D','T');
     hdr->revision  = 2;
-    strncpy(hdr->oem_id, ACPI_OEM_ID, 6);
-    strncpy(hdr->oem_table_id, ACPI_OEM_TABLE_ID, 8);
+    strncpy((char *)hdr->oem_id, ACPI_OEM_ID, sizeof(hdr->oem_id));
+    strncpy((char *)hdr->oem_table_id, ACPI_OEM_TABLE_ID, 
sizeof(hdr->oem_table_id));
     hdr->oem_revision = ACPI_OEM_REVISION;
     hdr->creator_id = ACPI_CREATOR_ID;
     hdr->creator_revision = ACPI_CREATOR_REVISION;
@@ -195,7 +195,7 @@ int construct_processor_objects(uint8_t 
     }
 
     /* NameString */
-    strncpy(p, "\\_PR_", 5);
+    strncpy((char *)p, "\\_PR_", strlen("\\_PR_"));
     p += 5;
 
     /*
@@ -263,8 +263,8 @@ int construct_secondary_tables(uint8_t *
         tcpa->header.signature = ACPI_2_0_TCPA_SIGNATURE;
         tcpa->header.length    = sizeof(*tcpa);
         tcpa->header.revision  = ACPI_2_0_TCPA_REVISION;
-        strncpy(tcpa->header.oem_id, ACPI_OEM_ID, 6);
-        strncpy(tcpa->header.oem_table_id, ACPI_OEM_TABLE_ID, 8);
+        strncpy((char *)tcpa->header.oem_id, ACPI_OEM_ID, 
sizeof(tcpa->header.oem_id));
+        strncpy((char *)tcpa->header.oem_table_id, ACPI_OEM_TABLE_ID, 
sizeof(tcpa->header.oem_table_id));
         tcpa->header.oem_revision = ACPI_OEM_REVISION;
         tcpa->header.creator_id   = ACPI_CREATOR_ID;
         tcpa->header.creator_revision = ACPI_CREATOR_REVISION;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] [HVMLOADER] fixup compiler warnings and constant usage, Ben Thomas <=