From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Chen Gang <gang.chen@asianux.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
linuxppc-dev@lists.ozlabs.org, wfp5p@virginia.edu,
tklauser@distanz.ch, Jiri Slaby <jslaby@suse.cz>,
alan@linux.intel.com
Subject: Re: [PATCH] drivers/tty/hvc: fixup original commit: 9276dfd27897a0b29d8b5814f39a1f82f56b6b6b
Date: Fri, 08 Mar 2013 14:46:04 +1100 [thread overview]
Message-ID: <1362714364.6977.4.camel@pasglop> (raw)
In-Reply-To: <51395D2C.6040007@asianux.com>
On Fri, 2013-03-08 at 11:38 +0800, Chen Gang wrote:
> originally I did not notice src buf len and dest buf len are the same.
> so origianlly, it is not a bug issue, it is only for beautify code.
> and now, using strcpy is better.
Being the same len doesn't mean it's safe to use strcpy ... the source
might be missing the 0 terminator. In this specific case though, I
believe the source string comes was itself populated with strlcpy
(at least since your patch 6b6680c4ea3952af8ae76915cbca41245147741b) so
strcpy is indeed safe but using strlcpy doesn't hurt does it ?
Ben.
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
> drivers/tty/hvc/hvcs.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
> index 81e939e..9330a4b 100644
> --- a/drivers/tty/hvc/hvcs.c
> +++ b/drivers/tty/hvc/hvcs.c
> @@ -885,8 +885,7 @@ static void hvcs_set_pi(struct hvcs_partner_info
> *pi, struct hvcs_struct *hvcsd)
> hvcsd->p_partition_ID = pi->partition_ID;
>
> /* copy the null-term char too */
> - strlcpy(&hvcsd->p_location_code[0],
> - &pi->location_code[0], sizeof(hvcsd->p_location_code));
> + strcpy(&hvcsd->p_location_code[0], &pi->location_code[0]);
> }
>
> /*
next prev parent reply other threads:[~2013-03-08 3:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-26 3:43 [PATCH] drivers/tty/hvc: using strlcpy instead of strncpy Chen Gang
2013-02-28 10:41 ` Jiri Slaby
2013-02-28 11:13 ` Chen Gang
2013-02-28 11:15 ` Chen Gang
2013-02-28 13:47 ` Jiri Slaby
2013-03-05 1:58 ` Chen Gang
2013-03-05 9:36 ` Jiri Slaby
2013-03-07 4:10 ` Chen Gang
2013-03-07 4:34 ` Chen Gang
2013-03-07 6:05 ` Benjamin Herrenschmidt
2013-03-07 7:10 ` Chen Gang
2013-03-08 3:38 ` [PATCH] drivers/tty/hvc: fixup original commit: 9276dfd27897a0b29d8b5814f39a1f82f56b6b6b Chen Gang
2013-03-08 3:46 ` Benjamin Herrenschmidt [this message]
2013-03-08 4:23 ` Chen Gang
2013-03-08 4:33 ` Benjamin Herrenschmidt
2013-03-08 4:40 ` Chen Gang
2013-03-08 5:08 ` Benjamin Herrenschmidt
2013-03-08 6:12 ` Chen Gang
2013-03-08 11:11 ` David Laight
2013-03-10 1:18 ` Chen Gang
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=1362714364.6977.4.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=alan@linux.intel.com \
--cc=gang.chen@asianux.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=tklauser@distanz.ch \
--cc=wfp5p@virginia.edu \
/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.