All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christoph Egger" <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Cc: Aron Griffis <aron@hp.com>, xen-ia64-devel@lists.xensource.com
Subject: Re: [PATCH] Clean up and fix errors in strncpy -> strlcpy conversion
Date: Tue, 30 Jan 2007 09:23:07 +0100	[thread overview]
Message-ID: <200701300923.08382.Christoph.Egger@amd.com> (raw)
In-Reply-To: <20070130011053.GE27235@fc.hp.com>

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@hp.com>
> # Date 1170118368 18000
> # Node ID 23560e2248fd267bad6490113ed52d0a27d7e219
> # Parent  5e3b47bcc311e7698959f1fa79c4654190593499
> Clean up and fix errors in strncpy -> strlcpy conversion
>
> Signed-off-by: Aron Griffis <aron@hp.com>
>
> 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().

The ACPI header fields simply need one more byte for the NUL.

Christoph

  reply	other threads:[~2007-01-30  8:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-30  1:10 [PATCH] Clean up and fix errors in strncpy -> strlcpy conversion Aron Griffis
2007-01-30  8:23 ` Christoph Egger [this message]
2007-01-30  9:32   ` Keir Fraser
2007-01-30 13:47   ` Aron Griffis
2007-01-30 14:01     ` Christoph Egger
2007-01-30 15:26     ` Christoph Egger
2007-01-30 15:46       ` Keir Fraser
2007-01-30 17:29         ` Alex Williamson
2007-01-30 17:37           ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200701300923.08382.Christoph.Egger@amd.com \
    --to=christoph.egger@amd.com \
    --cc=aron@hp.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=xen-ia64-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.