linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next v2] s390/zcrypt: use strscpy() to instead of strncpy()
@ 2023-01-03  2:02 yang.yang29
  2023-01-03  9:51 ` Heiko Carstens
  0 siblings, 1 reply; 4+ messages in thread
From: yang.yang29 @ 2023-01-03  2:02 UTC (permalink / raw)
  To: freude, hca
  Cc: gor, agordeev, borntraeger, svens, linux-s390, linux-kernel,
	xu.panda, yang.yang29

From: Yang Yang <yang.yang29@zte.com>

The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL-terminated strings.

Signed-off-by: Yang Yang <yang.yang29@zte.com>
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
---
chang for v2
 - match the FROM with the Email
---
 drivers/s390/crypto/zcrypt_api.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c
index 4bf36e53fe3e..6fe05bb82c77 100644
--- a/drivers/s390/crypto/zcrypt_api.c
+++ b/drivers/s390/crypto/zcrypt_api.c
@@ -347,8 +347,7 @@ static ssize_t zcdn_create_store(struct class *class,
 	int rc;
 	char name[ZCDN_MAX_NAME];

-	strncpy(name, skip_spaces(buf), sizeof(name));
-	name[sizeof(name) - 1] = '\0';
+	strscpy(name, skip_spaces(buf), sizeof(name));

 	rc = zcdn_create(strim(name));

@@ -365,8 +364,7 @@ static ssize_t zcdn_destroy_store(struct class *class,
 	int rc;
 	char name[ZCDN_MAX_NAME];

-	strncpy(name, skip_spaces(buf), sizeof(name));
-	name[sizeof(name) - 1] = '\0';
+	strscpy(name, skip_spaces(buf), sizeof(name));

 	rc = zcdn_destroy(strim(name));

-- 
2.15.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH linux-next v2] s390/zcrypt: use strscpy() to instead of strncpy()
  2023-01-03  2:02 [PATCH linux-next v2] s390/zcrypt: use strscpy() to instead of strncpy() yang.yang29
@ 2023-01-03  9:51 ` Heiko Carstens
  2023-01-05 14:01   ` Bagas Sanjaya
  0 siblings, 1 reply; 4+ messages in thread
From: Heiko Carstens @ 2023-01-03  9:51 UTC (permalink / raw)
  To: yang.yang29
  Cc: freude, gor, agordeev, borntraeger, svens, linux-s390,
	linux-kernel, xu.panda

On Tue, Jan 03, 2023 at 10:02:07AM +0800, yang.yang29@zte.com.cn wrote:
> From: Yang Yang <yang.yang29@zte.com>
> 
> The implementation of strscpy() is more robust and safer.
> That's now the recommended way to copy NUL-terminated strings.
> 
> Signed-off-by: Yang Yang <yang.yang29@zte.com>
> Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
> ---
> chang for v2
>  - match the FROM with the Email

You sent this from yang.yang29@zte.com.cn, but the sign-off is without the
".cn" suffix. Can you please make sure that your sign-off chain actually
follows the rules as outlined in Documentation/process/submitting-patches.rst?

If you read that then the sign-off line from Xu Panda shouldn't be there,
since the patch was not authored or routed via Xu Panda.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH linux-next v2] s390/zcrypt: use strscpy() to instead of strncpy()
  2023-01-03  9:51 ` Heiko Carstens
@ 2023-01-05 14:01   ` Bagas Sanjaya
  2023-01-10  3:16     ` yang.yang29
  0 siblings, 1 reply; 4+ messages in thread
From: Bagas Sanjaya @ 2023-01-05 14:01 UTC (permalink / raw)
  To: Heiko Carstens, yang.yang29
  Cc: freude, gor, agordeev, borntraeger, svens, linux-s390,
	linux-kernel, xu.panda

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

On Tue, Jan 03, 2023 at 10:51:21AM +0100, Heiko Carstens wrote:
> On Tue, Jan 03, 2023 at 10:02:07AM +0800, yang.yang29@zte.com.cn wrote:
> > From: Yang Yang <yang.yang29@zte.com>
> > 
> > The implementation of strscpy() is more robust and safer.
> > That's now the recommended way to copy NUL-terminated strings.
> > 
> > Signed-off-by: Yang Yang <yang.yang29@zte.com>
> > Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
> > ---
> > chang for v2
> >  - match the FROM with the Email
> 
> You sent this from yang.yang29@zte.com.cn, but the sign-off is without the
> ".cn" suffix. Can you please make sure that your sign-off chain actually
> follows the rules as outlined in Documentation/process/submitting-patches.rst?
> 
> If you read that then the sign-off line from Xu Panda shouldn't be there,
> since the patch was not authored or routed via Xu Panda.

Specifically, the second SoB from Xu should only be included if he was
in From: mail header (that is, he should have sent the patch instead of
Yang).

Ah! Thanks for reminding me of this trivial issue that I always missed
when reviewing ZTE patches.

Xu, are you really transporting Yang's patch?

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH linux-next v2] s390/zcrypt: use strscpy() to instead of strncpy()
  2023-01-05 14:01   ` Bagas Sanjaya
@ 2023-01-10  3:16     ` yang.yang29
  0 siblings, 0 replies; 4+ messages in thread
From: yang.yang29 @ 2023-01-10  3:16 UTC (permalink / raw)
  To: bagasdotme
  Cc: hca, freude, gor, agordeev, borntraeger, svens, linux-s390,
	linux-kernel, xu.panda

> Specifically, the second SoB from Xu should only be included if he was> 
> in From: mail header (that is, he should have sent the patch instead of> 
> Yang).

Thanks to your carefully reviewing! Actually this patch is made by Xu,
and Yang help to send it. I remember this is OK by patch rules. If I am
wrong, I will try to correct it.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-10  3:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03  2:02 [PATCH linux-next v2] s390/zcrypt: use strscpy() to instead of strncpy() yang.yang29
2023-01-03  9:51 ` Heiko Carstens
2023-01-05 14:01   ` Bagas Sanjaya
2023-01-10  3:16     ` yang.yang29

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).