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

Re: [Xen-devel] [PATCH] Clean up and fix errors in strncpy -> strlcpy co

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] Clean up and fix errors in strncpy -> strlcpy conversion
From: "Christoph Egger" <Christoph.Egger@xxxxxxx>
Date: Tue, 30 Jan 2007 16:26:38 +0100
Cc: Aron Griffis <aron@xxxxxx>, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 30 Jan 2007 07:26:41 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070130134745.GA10365@xxxxxxxxx>
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>
Organization: AMD / OSRC
References: <20070130011053.GE27235@xxxxxxxxx> <200701300923.08382.Christoph.Egger@xxxxxxx> <20070130134745.GA10365@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.4
On Tuesday 30 January 2007 14:47, Aron Griffis wrote:
> Christoph Egger wrote:  [Tue Jan 30 2007, 03:23:07AM EST]
>
> > On Tuesday 30 January 2007 02:10, Aron Griffis wrote:
> > > This patch is for the staging tree.  Please apply.
> > >
> > > # HG changeset patch
> > > # User Aron Griffis <aron@xxxxxx>
> > > # Date 1170118368 18000
> > > # Node ID 23560e2248fd267bad6490113ed52d0a27d7e219
> > > # Parent  5e3b47bcc311e7698959f1fa79c4654190593499
> > > Clean up and fix errors in strncpy -> strlcpy conversion
> > >
> > > Signed-off-by: Aron Griffis <aron@xxxxxx>
> > >
> > > diff -r 5e3b47bcc311 -r 23560e2248fd xen/arch/ia64/xen/dom_fw.c
> > > --- a/xen/arch/ia64/xen/dom_fw.c  Mon Jan 29 22:43:51 2007 +0000
> > > +++ b/xen/arch/ia64/xen/dom_fw.c  Mon Jan 29 19:52:48 2007 -0500
> > > @@ -333,13 +333,13 @@ dom_fw_fake_acpi(struct domain *d, struc
> > >   memset(tables, 0, sizeof(struct fake_acpi_tables));
> > >
> > >   /* setup XSDT (64bit version of RSDT) */
> > > - strlcpy(xsdt->signature, XSDT_SIG, sizeof(xsdt->signature));
> > > + memcpy(xsdt->signature, XSDT_SIG, sizeof(xsdt->signature));
> > >   /* XSDT points to both the FADT and the MADT, so add one entry */
> > >   xsdt->length = sizeof(struct xsdt_descriptor_rev2) + sizeof(u64);
> > >   xsdt->revision = 1;
> > > - strlcpy(xsdt->oem_id, "XEN", sizeof(xsdt->oem_id));
> > > - strlcpy(xsdt->oem_table_id, "Xen/ia64", sizeof(xsdt->oem_table_id));
> > > - strlcpy(xsdt->asl_compiler_id, "XEN", sizeof(xsdt->asl_compiler_id));
> > > + safe_strcpy(xsdt->oem_id, "XEN");
> > > + safe_strcpy(xsdt->oem_table_id, "Xen/ia64");
> > > + safe_strcpy(xsdt->asl_compiler_id, "XEN");
> > >   xsdt->asl_compiler_revision = (xen_major_version() << 16) |
> > >           xen_minor_version();
> >
> > In my patch, safe_strcpy() is gone. And anyway, if safe_strcpy works as
> > expected, then apart from the return value there's no difference to
> > strlcpy().
>
> You're confusing the cleanups with the bugfixes.  Any use of
> safe_strcpy() in my patch was just cleanup.
>
> The bugfixes are on the signature fields (the first change quoted
> above), which I changed to use memcpy since strlcpy adds an unwanted
> NUL.

Aron: If the above patch is still correct (against CS 13703), please resend it 
for Keir to apply.

Christoph



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel