Message ID | 202301031002076571212@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4399832wrt; Mon, 2 Jan 2023 18:16:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXtQN4aBmQFcLstxDrGHteJub5LTasfi14x3LDS58n+1pvhYa0Icc97uCVV8Z86/7KTPfkmr X-Received: by 2002:a17:907:a08d:b0:7c1:6986:2b7c with SMTP id hu13-20020a170907a08d00b007c169862b7cmr32914763ejc.8.1672712198529; Mon, 02 Jan 2023 18:16:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672712198; cv=none; d=google.com; s=arc-20160816; b=c1KY0+VKC6ljBR55VjXL9nf1/br88SihcUNKa7ahoIpz4eLVHwxQgNUgvpMnZZ+Fa0 YPR+Jfl8+S0oEpIXk31xP6Lw+87S8t7yOjvRRgU8ocoYOvsYIfpXjyohkEIyLvqXF62L Jwnf/C40jfEQzPR3HisswCkVdwY0oEi5i3DCNtuwY4q2S3KfNmRfaTHJEVS4ns96U1mD zp9E41avlAtuQOpIsscXPoilT+b/0tm7Dufqcb9eG1FJfBShnniaF/bl//LDrvLNq6gQ eC6WtKgJVMhVGN302OGcUuu1k9vpmCveh8r8FihsehLEkeuARUpJDQCjmJlOxm3PGc7+ jqmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=z7GIFGx8coJwxZSySqUn5qa8lppwef73xQW52aSfCvk=; b=VKpZo662AmQ31aQHNt+aTr97une9DiiKOvWEhuxSPnUVtDukQH6VcMNrS3miYcFgxT 6vpjGB8imCG92/jHtVvRExVpziY0N+Jg4lB9lWu4bnb9KyhyfP9+w3HSVcosmf3HtJOn D9ZtqKuvroRaIsTfiPcego6m8ue0hlhpG7cBHcydAWuQQNVHVcmBjE9+qnTxnSE1NHBl 7gb52yQ+GyjmeXw0R2G5K/WrdHvFvx6uLtK9R+HLBJ80/JpRiKysS8568XnMJ8M5TLRe fo7IQn8HvQX7i8Y6Il8EDQlbdn5JTmLYrQthtoAZ+PJPVVu1IsVI7LLwxF5rKk9TOXg9 OQ0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh17-20020a1709076e9100b007c1031ebabasi26456758ejc.49.2023.01.02.18.16.12; Mon, 02 Jan 2023 18:16:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236674AbjACCCm (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Mon, 2 Jan 2023 21:02:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236336AbjACCCU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 2 Jan 2023 21:02:20 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 253291039; Mon, 2 Jan 2023 18:02:19 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NmGFj0ylcz501Sr; Tue, 3 Jan 2023 10:02:17 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl1.zte.com.cn with SMTP id 303226xk053280; Tue, 3 Jan 2023 10:02:06 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp01[null]) by mapi (Zmail) with MAPI id mid14; Tue, 3 Jan 2023 10:02:07 +0800 (CST) Date: Tue, 3 Jan 2023 10:02:07 +0800 (CST) X-Zmail-TransId: 2b0363b38c9f6a036ac0 X-Mailer: Zmail v1.0 Message-ID: <202301031002076571212@zte.com.cn> Mime-Version: 1.0 From: <yang.yang29@zte.com.cn> To: <freude@linux.ibm.com>, <hca@linux.ibm.com> Cc: <gor@linux.ibm.com>, <agordeev@linux.ibm.com>, <borntraeger@linux.ibm.com>, <svens@linux.ibm.com>, <linux-s390@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <xu.panda@zte.com.cn>, <yang.yang29@zte.com.cn> Subject: =?utf-8?q?=5BPATCH_linux-next_v2=5D_s390/zcrypt=3A_use_strscpy=28?= =?utf-8?q?=29_to_instead_of_strncpy=28=29?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 303226xk053280 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 63B38CA9.001 by FangMail milter! X-FangMail-Envelope: 1672711337/4NmGFj0ylcz501Sr/63B38CA9.001/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/<yang.yang29@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63B38CA9.001/4NmGFj0ylcz501Sr X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753965866269176160?= X-GMAIL-MSGID: =?utf-8?q?1753965866269176160?= |
Series |
[linux-next,v2] s390/zcrypt: use strscpy() to instead of strncpy()
|
|
Commit Message
Yang Yang
Jan. 3, 2023, 2:02 a.m. UTC
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(-)
Comments
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.
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.
> 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.
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));