* [PATCH] s390: char: sclp_async.c: Cleaning up missing null-terminate in conjunction with strncpy
@ 2014-07-26 14:30 Rickard Strandqvist
2014-07-28 19:00 ` Heiko Carstens
0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-07-26 14:30 UTC (permalink / raw)
To: Martin Schwidefsky, Heiko Carstens
Cc: Rickard Strandqvist, linux390, linux-s390, linux-kernel
Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
drivers/s390/char/sclp_async.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
index 5f9f929..585de0a 100644
--- a/drivers/s390/char/sclp_async.c
+++ b/drivers/s390/char/sclp_async.c
@@ -132,12 +132,12 @@ static int sclp_async_send_wait(char *message)
request->command = SCLP_CMDW_WRITE_EVENT_DATA;
request->sccb = sccb;
request->status = SCLP_REQ_FILLED;
- strncpy(sccb->evbuf.data, message, sizeof(sccb->evbuf.data));
+ strlcpy(sccb->evbuf.data, message, sizeof(sccb->evbuf.data));
/*
* Retain Queue
* e.g. 5639CC140 500 Red Hat RHEL5 Linux for zSeries (RHEL AS)
*/
- strncpy(sccb->evbuf.comp_id, "000000000", sizeof(sccb->evbuf.comp_id));
+ strlcpy(sccb->evbuf.comp_id, "000000000", sizeof(sccb->evbuf.comp_id));
sccb->evbuf.header.length = sizeof(sccb->evbuf);
sccb->header.length = sizeof(sccb->evbuf) + sizeof(sccb->header);
sccb->header.function_code = SCLP_NORMAL_WRITE;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] s390: char: sclp_async.c: Cleaning up missing null-terminate in conjunction with strncpy
2014-07-26 14:30 [PATCH] s390: char: sclp_async.c: Cleaning up missing null-terminate in conjunction with strncpy Rickard Strandqvist
@ 2014-07-28 19:00 ` Heiko Carstens
0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2014-07-28 19:00 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Martin Schwidefsky, linux390, linux-s390, linux-kernel
On Sat, Jul 26, 2014 at 04:30:47PM +0200, Rickard Strandqvist wrote:
> Replacing strncpy with strlcpy to avoid strings that lacks null terminate.
>
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/s390/char/sclp_async.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
> index 5f9f929..585de0a 100644
> --- a/drivers/s390/char/sclp_async.c
> +++ b/drivers/s390/char/sclp_async.c
> @@ -132,12 +132,12 @@ static int sclp_async_send_wait(char *message)
> request->command = SCLP_CMDW_WRITE_EVENT_DATA;
> request->sccb = sccb;
> request->status = SCLP_REQ_FILLED;
> - strncpy(sccb->evbuf.data, message, sizeof(sccb->evbuf.data));
> + strlcpy(sccb->evbuf.data, message, sizeof(sccb->evbuf.data));
Do your patches actually fix any bugs? E.g. this line fills a hardware data
structure, which must not necessarily be null terminated. Actually you even
could have introduced a bug here.
So, please state which of your patches actually do fix bugs.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-28 19:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-26 14:30 [PATCH] s390: char: sclp_async.c: Cleaning up missing null-terminate in conjunction with strncpy Rickard Strandqvist
2014-07-28 19:00 ` Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox