From patchwork Fri Dec 23 02:52:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 36091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp105584wrn; Thu, 22 Dec 2022 18:56:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXvpOcbT/zwkJW80k+93vcUA1dB3eXuJoG8BZ3JBrXSrdLlqoa5ipRYeFvQKDLR0hvUBeGuQ X-Received: by 2002:a17:903:110d:b0:189:89e2:5406 with SMTP id n13-20020a170903110d00b0018989e25406mr28456764plh.24.1671764163717; Thu, 22 Dec 2022 18:56:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671764163; cv=none; d=google.com; s=arc-20160816; b=bJ4jvmT39VXCV2sMdUtgct8MjWf0SnITvQH4eYKjz22EptLzxcMlEunX+irIKjycrh ex6ydokhgMFbU6cAEEbHKjNrkObgbOfB2vL+JLSoz+BSotUgUKZdaMJKDmVd21a+j8jO n6r3Sqi9y3s81HJXFSEqBeY71RHkWP5RxIX1zNK3oRoLYd6m8Ro/zcypnwEmmatyX1+Y R/MakFpw5VqJs9snmRAvXEHHLJiDABoMnGN4hUin8IURwXmyIsZ6PDj/rC3fkcX5+sjm 8VkkusjxdQ5kcCUOdiwjNI9LAf76OFDDjwdoMaQLU3lbLSA21sXwK5A7YUAf4B5SSPIn Lmvw== 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=Sfe+ossvaFDHtSIQjPIbtiE0baSBN8K4HP8DanMsqU4=; b=BzTaHyrsC2jV6LAc3COTg4mtD+EuyogaQchTPnjKrC/T0RIxdmM76h0FvTzA5FG1mx D0spHXDkl5nNvhqGbuu2EyEgT9ZWP4sKFFad/JxojIv57YEyY33jRJxS5voKh5YtEeGt lGGUPm1JrXOv8fVFD8uhDDKQrmdXLypJ6JEJNFfWUwLjNLMaYaQ70lKtYoRit3XXwfZh +UqTyRuOH9zAeYPecoEzzNLTjeOtHXCLFOZIlX05G5AAcIf19Iuo8UWOwEx23c93LpVI WGpdPnAbQXm+bPnkAveWyGn+ZrPPVK2HtPEzNkExBNB93OhaZIVldehHZ7dSZVmRi7tT BguQ== 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 j64-20020a638043000000b00489e5acab41si2489932pgd.149.2022.12.22.18.55.50; Thu, 22 Dec 2022 18:56:03 -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 S235823AbiLWCwS (ORCPT + 99 others); Thu, 22 Dec 2022 21:52:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235913AbiLWCwO (ORCPT ); Thu, 22 Dec 2022 21:52:14 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1069B2180C; Thu, 22 Dec 2022 18:52:13 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (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 4NdWtM3l67z4y3Zt; Fri, 23 Dec 2022 10:52:11 +0800 (CST) Received: from szxlzmapp02.zte.com.cn ([10.5.231.79]) by mse-fl2.zte.com.cn with SMTP id 2BN2q3Jf060236; Fri, 23 Dec 2022 10:52:03 +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:52:04 +0800 (CST) Date: Fri, 23 Dec 2022 10:52:04 +0800 (CST) X-Zmail-TransId: 2b0463a517d4ffffffffadba9bb8 X-Mailer: Zmail v1.0 Message-ID: <202212231052044562664@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , , , , , , Subject: =?utf-8?q?=5BPATCH_net-next=5D_wifi=3A_airo=3A_use_strscpy=28=29_to?= =?utf-8?q?_instead_of_strncpy=28=29?= X-MAIL: mse-fl2.zte.com.cn 2BN2q3Jf060236 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 63A517DB.001 by FangMail milter! X-FangMail-Envelope: 1671763931/4NdWtM3l67z4y3Zt/63A517DB.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A517DB.001/4NdWtM3l67z4y3Zt 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752971780015399244?= X-GMAIL-MSGID: =?utf-8?q?1752971780015399244?= From: Xu Panda 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 Signed-off-by: Yang Yang --- drivers/net/wireless/cisco/airo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 7c4cc5f5e1eb..600a64f671ce 100644 --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -6067,8 +6067,7 @@ static int airo_get_nick(struct net_device *dev, struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); - strncpy(extra, local->config.nodeName, 16); - extra[16] = '\0'; + strscpy(extra, local->config.nodeName, 17); dwrq->length = strlen(extra); return 0;