Message ID | 202212231037210142246@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp101177wrn; Thu, 22 Dec 2022 18:39:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXtfZdBzWHeNdIGQkcSjvtumg0a7hne5FAbunDd1HnEY9uTR/yix+HPwMge9/k5iQRkbN8qd X-Received: by 2002:a17:906:a1d7:b0:815:8942:dde with SMTP id bx23-20020a170906a1d700b0081589420ddemr8234590ejb.23.1671763146719; Thu, 22 Dec 2022 18:39:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671763146; cv=none; d=google.com; s=arc-20160816; b=B7a9wEjj61Hx1Z5PCPmxzHVeolybdmVp0qLv2kFzphtCDyMWa6m6QK+MXJMKn1Ni4N Ivvw/JFl0FjzPUQyPfRWCz+uZd4eM0xlQYMXjVfdJyDw3NsUO/mC1EEzseYiBfKrTpkr 8+F7/AdxRF3xJ9kl7Or2SHZmDPq7K90GJZsLSFzhw9Vi2K+Qx2jkxxEATc5XWRC4YlcO J9qUcbi8cQug7xQ3iXYo3a9+4kdnYINaU+zyjqxoOF3MHdNJ5W3tUo0f0kiGxy3D31Rl HRQH/LigjsrvURjCO6rBnviij3fYdLd3UbFV0TqWuFkMNkogjCXEjrcXMjEPKfevgcID Fadw== 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=yuMUiNp0LGjQ5e68J3RY4034x3S2AU59yHPoRc8A1MU=; b=Q62PTu8kO0LNp0eCgjaEPHGGG7VAQWMO8wY21l1qjrmtU1zV/i/wCn0qYVAQdA3cp1 200ODpn0ONnlFLw9H5c7rFtG2bfYW9God1r6tHoE2dPjAPGIU8OmHCmfhamAUF5E/+Pa T6FovrGhwv/nC1UkTvWtl0AmNlp5QfF+JMNuvAehI3pgndQWYW1mqfpjnTGq2JIMyF3G gm+HiYhFBzbbaJolgcLHFgYJi0qWkLFkO/cl367YflqUD4LFcARl673kZs12PX3FO5/r 3T1dEqqQ5rz6XmSL3DHN9Y/QWTnFI4KGY9GHZrIKDMgerXA8f2vgwKU1CBUrCBLSGHVn FcTg== 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 dm22-20020a170907949600b0078d48e06641si1649901ejc.393.2022.12.22.18.38.43; Thu, 22 Dec 2022 18:39:06 -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 S235518AbiLWCha (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Thu, 22 Dec 2022 21:37:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbiLWCh1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 22 Dec 2022 21:37:27 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD8801F62A; Thu, 22 Dec 2022 18:37:26 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NdWYK3cgSz5PkHg; Fri, 23 Dec 2022 10:37:25 +0800 (CST) Received: from szxlzmapp02.zte.com.cn ([10.5.231.79]) by mse-fl1.zte.com.cn with SMTP id 2BN2bJbl067460; Fri, 23 Dec 2022 10:37:19 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Fri, 23 Dec 2022 10:37:21 +0800 (CST) Date: Fri, 23 Dec 2022 10:37:21 +0800 (CST) X-Zmail-TransId: 2b0463a51461ffffffffe8784f89 X-Mailer: Zmail v1.0 Message-ID: <202212231037210142246@zte.com.cn> Mime-Version: 1.0 From: <yang.yang29@zte.com.cn> To: <aspriel@gmail.com> Cc: <franky.lin@broadcom.com>, <hante.meuleman@broadcom.com>, <kvalo@kernel.org>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <linux-wireless@vger.kernel.org>, <brcm80211-dev-list.pdl@broadcom.com>, <sha-cyfmac-dev-list@infineon.com>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <xu.panda@zte.com.cn>, <yang.yang29@zte.com.cn> Subject: =?utf-8?q?=5BPATCH_net-next=5D_brcm80211=3A_use_strscpy=28=29_to_in?= =?utf-8?q?stead_of_strncpy=28=29?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2BN2bJbl067460 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63A51465.000 by FangMail milter! X-FangMail-Envelope: 1671763045/4NdWYK3cgSz5PkHg/63A51465.000/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: 63A51465.000/4NdWYK3cgSz5PkHg 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?1752970712880909653?= X-GMAIL-MSGID: =?utf-8?q?1752970712880909653?= |
Series |
[net-next] brcm80211: use strscpy() to instead of strncpy()
|
|
Commit Message
Yang Yang
Dec. 23, 2022, 2:37 a.m. UTC
From: Xu Panda <xu.panda@zte.com.cn> The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL-terminated strings. Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> --- drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Comments
<yang.yang29@zte.com.cn> wrote: > From: Xu Panda <xu.panda@zte.com.cn> > > The implementation of strscpy() is more robust and safer. > That's now the recommended way to copy NUL-terminated strings. > > Signed-off-by: Xu Panda <xu.panda@zte.com.cn> > Signed-off-by: Yang Yang <yang.yang29@zte.com> Mismatch email in From and Signed-off-by lines: From: <yang.yang29@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> Patch set to Changes Requested.
On Mon, Jan 16, 2023 at 01:08:36PM +0000, Kalle Valo wrote: > <yang.yang29@zte.com.cn> wrote: > > > From: Xu Panda <xu.panda@zte.com.cn> > > > > The implementation of strscpy() is more robust and safer. > > That's now the recommended way to copy NUL-terminated strings. > > > > Signed-off-by: Xu Panda <xu.panda@zte.com.cn> > > Signed-off-by: Yang Yang <yang.yang29@zte.com> > > Mismatch email in From and Signed-off-by lines: > > From: <yang.yang29@zte.com.cn> > Signed-off-by: Yang Yang <yang.yang29@zte.com> > > Patch set to Changes Requested. Kalle, please be aware of this response https://lore.kernel.org/netdev/20230113112817.623f58fa@kernel.org/ "I don't trust that you know what you're doing. So please don't send any more strncpy() -> strscpy() conversions for networking." Thanks > > -- > https://patchwork.kernel.org/project/linux-wireless/patch/202212231037210142246@zte.com.cn/ > > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches >
Leon Romanovsky <leon@kernel.org> writes: > On Mon, Jan 16, 2023 at 01:08:36PM +0000, Kalle Valo wrote: >> <yang.yang29@zte.com.cn> wrote: >> >> > From: Xu Panda <xu.panda@zte.com.cn> >> > >> > The implementation of strscpy() is more robust and safer. >> > That's now the recommended way to copy NUL-terminated strings. >> > >> > Signed-off-by: Xu Panda <xu.panda@zte.com.cn> >> > Signed-off-by: Yang Yang <yang.yang29@zte.com> >> >> Mismatch email in From and Signed-off-by lines: >> >> From: <yang.yang29@zte.com.cn> >> Signed-off-by: Yang Yang <yang.yang29@zte.com> >> >> Patch set to Changes Requested. > > Kalle, please be aware of this response > https://lore.kernel.org/netdev/20230113112817.623f58fa@kernel.org/ > > "I don't trust that you know what you're doing. So please don't send > any more strncpy() -> strscpy() conversions for networking." Good to know, thanks.
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c index b7df576bb84d..66336c87b0d9 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/dma.c @@ -584,8 +584,7 @@ struct dma_pub *dma_attach(char *name, struct brcms_c_info *wlc, rxextheadroom, nrxpost, rxoffset, txregbase, rxregbase); /* make a private copy of our callers name */ - strncpy(di->name, name, MAXNAMEL); - di->name[MAXNAMEL - 1] = '\0'; + strscpy(di->name, name, MAXNAMEL); di->dmadev = core->dma_dev;