ia64/xen-unstable

changeset 13751:0803bdfdd9c5

ia64: Clean up and fix errors in strncpy -> strlcpy conversion
Signed-off-by: Aron Griffis <aron@hp.com>
author kaf24@localhost.localdomain
date Tue Jan 30 15:57:58 2007 +0000 (2007-01-30)
parents 2f3794098e22
children 300c47bec138
files xen/arch/ia64/xen/dom_fw.c xen/arch/ia64/xen/oprofile/perfmon.c
line diff
     1.1 --- a/xen/arch/ia64/xen/dom_fw.c	Tue Jan 30 15:27:10 2007 +0000
     1.2 +++ b/xen/arch/ia64/xen/dom_fw.c	Tue Jan 30 15:57:58 2007 +0000
     1.3 @@ -333,13 +333,13 @@ dom_fw_fake_acpi(struct domain *d, struc
     1.4  	memset(tables, 0, sizeof(struct fake_acpi_tables));
     1.5  
     1.6  	/* setup XSDT (64bit version of RSDT) */
     1.7 -	strlcpy(xsdt->signature, XSDT_SIG, sizeof(xsdt->signature));
     1.8 +	memcpy(xsdt->signature, XSDT_SIG, sizeof(xsdt->signature));
     1.9  	/* XSDT points to both the FADT and the MADT, so add one entry */
    1.10  	xsdt->length = sizeof(struct xsdt_descriptor_rev2) + sizeof(u64);
    1.11  	xsdt->revision = 1;
    1.12 -	strlcpy(xsdt->oem_id, "XEN", sizeof(xsdt->oem_id));
    1.13 -	strlcpy(xsdt->oem_table_id, "Xen/ia64", sizeof(xsdt->oem_table_id));
    1.14 -	strlcpy(xsdt->asl_compiler_id, "XEN", sizeof(xsdt->asl_compiler_id));
    1.15 +	safe_strcpy(xsdt->oem_id, "XEN");
    1.16 +	safe_strcpy(xsdt->oem_table_id, "Xen/ia64");
    1.17 +	safe_strcpy(xsdt->asl_compiler_id, "XEN");
    1.18  	xsdt->asl_compiler_revision = (xen_major_version() << 16) |
    1.19  		xen_minor_version();
    1.20  
    1.21 @@ -349,16 +349,16 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.22  	xsdt->checksum = generate_acpi_checksum(xsdt, xsdt->length);
    1.23  
    1.24  	/* setup FADT */
    1.25 -	strlcpy(fadt->signature, FADT_SIG, sizeof(fadt->signature));
    1.26 +	memcpy(fadt->signature, FADT_SIG, sizeof(fadt->signature));
    1.27  	fadt->length = sizeof(struct fadt_descriptor_rev2);
    1.28  	fadt->revision = FADT2_REVISION_ID;
    1.29 -	strlcpy(fadt->oem_id, "XEN", sizeof(fadt->oem_id));
    1.30 -	strlcpy(fadt->oem_table_id, "Xen/ia64", sizeof(fadt->oem_table_id));
    1.31 -	strlcpy(fadt->asl_compiler_id, "XEN", sizeof(fadt->asl_compiler_id));
    1.32 +	safe_strcpy(fadt->oem_id, "XEN");
    1.33 +	safe_strcpy(fadt->oem_table_id, "Xen/ia64");
    1.34 +	safe_strcpy(fadt->asl_compiler_id, "XEN");
    1.35  	fadt->asl_compiler_revision = (xen_major_version() << 16) |
    1.36  		xen_minor_version();
    1.37  
    1.38 -	strlcpy(facs->signature, FACS_SIG, sizeof(facs->signature));
    1.39 +	memcpy(facs->signature, FACS_SIG, sizeof(facs->signature));
    1.40  	facs->version = 1;
    1.41  	facs->length = sizeof(struct facs_descriptor_rev2);
    1.42  
    1.43 @@ -386,8 +386,8 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.44  	fadt->checksum = generate_acpi_checksum(fadt, fadt->length);
    1.45  
    1.46  	/* setup RSDP */
    1.47 -	strlcpy(rsdp->signature, RSDP_SIG, sizeof(rsdp->signature));
    1.48 -	strlcpy(rsdp->oem_id, "XEN", sizeof(rsdp->oem_id));
    1.49 +	safe_strcpy(rsdp->signature, RSDP_SIG);
    1.50 +	safe_strcpy(rsdp->oem_id, "XEN");
    1.51  	rsdp->revision = 2; /* ACPI 2.0 includes XSDT */
    1.52  	rsdp->length = sizeof(struct acpi20_table_rsdp);
    1.53  	rsdp->xsdt_address = ACPI_TABLE_MPA(xsdt);
    1.54 @@ -397,11 +397,11 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.55  	rsdp->ext_checksum = generate_acpi_checksum(rsdp, rsdp->length);
    1.56  
    1.57  	/* setup DSDT with trivial namespace. */ 
    1.58 -	strlcpy(dsdt->signature, DSDT_SIG, sizeof(dsdt->signature));
    1.59 +	safe_strcpy(dsdt->signature, DSDT_SIG);
    1.60  	dsdt->revision = 1;
    1.61 -	strlcpy(dsdt->oem_id, "XEN", sizeof(dsdt->oem_id));
    1.62 -	strlcpy(dsdt->oem_table_id, "Xen/ia64", sizeof(dsdt->oem_table_id));
    1.63 -	strlcpy(dsdt->asl_compiler_id, "XEN", sizeof(dsdt->asl_compiler_id));
    1.64 +	safe_strcpy(dsdt->oem_id, "XEN");
    1.65 +	safe_strcpy(dsdt->oem_table_id, "Xen/ia64");
    1.66 +	safe_strcpy(dsdt->asl_compiler_id, "XEN");
    1.67  	dsdt->asl_compiler_revision = (xen_major_version() << 16) |
    1.68  		xen_minor_version();
    1.69  
    1.70 @@ -409,7 +409,7 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.71  	tables->aml[0] = 0x10; /* Scope */
    1.72  	tables->aml[1] = 0x40; /* length/offset to next object (patched) */
    1.73  	tables->aml[2] = 0x00;
    1.74 -	strlcpy((char *)&tables->aml[3], "_SB_", 5);
    1.75 +	memcpy(&tables->aml[3], "_SB_", 4);
    1.76  
    1.77  	/* The processor object isn't absolutely necessary, revist for SMP */
    1.78  	aml_len = 7;
    1.79 @@ -437,14 +437,11 @@ dom_fw_fake_acpi(struct domain *d, struc
    1.80  	dsdt->checksum = generate_acpi_checksum(dsdt, dsdt->length);
    1.81  
    1.82  	/* setup MADT */
    1.83 -	strlcpy(madt->header.signature, APIC_SIG, sizeof(madt->header.signature));
    1.84 +	memcpy(madt->header.signature, APIC_SIG, sizeof(madt->header.signature));
    1.85  	madt->header.revision = 2;
    1.86 -	strlcpy(madt->header.oem_id, "XEN",
    1.87 -		sizeof(madt->header.oem_id));
    1.88 -	strlcpy(madt->header.oem_table_id, "Xen/ia64",
    1.89 -		sizeof(madt->header.oem_table_id));
    1.90 -	strlcpy(madt->header.asl_compiler_id, "XEN",
    1.91 -		sizeof(madt->header.asl_compiler_id));
    1.92 +	safe_strcpy(madt->header.oem_id, "XEN");
    1.93 +	safe_strcpy(madt->header.oem_table_id, "Xen/ia64");
    1.94 +	safe_strcpy(madt->header.asl_compiler_id, "XEN");
    1.95  	madt->header.asl_compiler_revision = (xen_major_version() << 16) |
    1.96  		xen_minor_version();
    1.97  
    1.98 @@ -763,10 +760,8 @@ dom_fw_init(struct domain *d,
    1.99  	tables->sal_systab.sal_rev_major = 0;
   1.100  	tables->sal_systab.entry_count = 2;
   1.101  
   1.102 -	strlcpy((char *)tables->sal_systab.oem_id, "Xen/ia64",
   1.103 -		sizeof(tables->sal_systab.oem_id));
   1.104 -	strlcpy((char *)tables->sal_systab.product_id, "Xen/ia64",
   1.105 -		sizeof(tables->sal_systab.product_id));
   1.106 +	safe_strcpy((char *)tables->sal_systab.oem_id, "Xen/ia64");
   1.107 +	safe_strcpy((char *)tables->sal_systab.product_id, "Xen/ia64");
   1.108  
   1.109  	/* PAL entry point: */
   1.110  	tables->sal_ed.type = SAL_DESC_ENTRY_POINT;
     2.1 --- a/xen/arch/ia64/xen/oprofile/perfmon.c	Tue Jan 30 15:27:10 2007 +0000
     2.2 +++ b/xen/arch/ia64/xen/oprofile/perfmon.c	Tue Jan 30 15:57:58 2007 +0000
     2.3 @@ -120,7 +120,6 @@ xenoprof_arch_init(int *num_events, int 
     2.4  {
     2.5      *num_events = 0;
     2.6      strlcpy(cpu_type, get_cpu_type(), XENOPROF_CPU_TYPE_SIZE);
     2.7 -    cpu_type[XENOPROF_CPU_TYPE_SIZE - 1] = '\0';
     2.8  
     2.9      *is_primary = 0;
    2.10      if (xenoprof_primary_profiler == NULL) {