Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp23121rwj; Thu, 22 Dec 2022 19:57:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXvMqyo0ojmPNxqthe0i9LiAJu7QjgIzcQiZGum6g3Ffugo+ncFdl79399ghICWHsfxCO1N6 X-Received: by 2002:a05:6a00:400e:b0:577:9807:543b with SMTP id by14-20020a056a00400e00b005779807543bmr8880604pfb.16.1671767879446; Thu, 22 Dec 2022 19:57:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671767879; cv=none; d=google.com; s=arc-20160816; b=G2LKFkxkolSa30aqwP4bqUNjG+3rlBoOEExKDeO4z6WkqGr+S++XPWpV9CfhTVZG+f FAa9O0DxInqfUDQEzOYH1GHq46XsAd/x4aXM1rVNYQSD+jNhyJK3rd/xsJ/OfEzBIPl9 J7oshbLh8yjUlHwANz4yjau5sZmQ22eYcnc2TXNo+4sj0zdny84RYZ1s4la2hfMBsjS/ 9xnka7MhZypDaP4gEJCTsRQkplWBDrHn87LUXEguVH90ecQRgzV23V03j4bpUXPthW1G P9OVIgRQtKd60tmSs1hLgpLdxwgBmQGt1/H8naz59Gd3fcKmnq5QYlmx6kcQ5kRLWJsV mBcw== 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=3pUK9EYWrZ+oyjD3sI0SRlTntvhoEYemz9AOtupA+74=; b=0GpMrjAKlX96BIdLWpf/K2eML0yKVG8zjNK6MMjycDwC9elZxOsCMcbPWtPQsgc8ci S0Qce+qbNCv+wAaKQB8EYDmYjAM4SBiCAe+RD7pNB4ZuaCBTdJFGI5pukrcypjd0mDIN pnmjjoyPj29ec9zei+PZ9BZZda5vzvBIp9i8f2b05GOpgS/XV4thbOxNdkv5tC7ObSV4 nEk1BPfjQMLvrVYHs2PuGyzi8kxo8RuMDlwT7fL9oZwzBAUFVFAhNM4TZ/FLjaqhZDQm fBZObn92RsBtm/3ZQOmlNF58hbtqXG1lyTRCmwwUZVsk+GVSf2Oo7vnh5lFgEbcC7vlF ggbw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v128-20020a626186000000b00574d1f9bdf2si2355011pfb.213.2022.12.22.19.57.50; Thu, 22 Dec 2022 19:57:59 -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 S230384AbiLWC6B (ORCPT + 67 others); Thu, 22 Dec 2022 21:58:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235866AbiLWC5w (ORCPT ); Thu, 22 Dec 2022 21:57:52 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C86F29360; Thu, 22 Dec 2022 18:57:51 -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 4NdX0s5DY6z6FK2P; Fri, 23 Dec 2022 10:57:49 +0800 (CST) Received: from szxlzmapp03.zte.com.cn ([10.5.231.207]) by mse-fl1.zte.com.cn with SMTP id 2BN2vdKr082489; Fri, 23 Dec 2022 10:57:39 +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:57:40 +0800 (CST) Date: Fri, 23 Dec 2022 10:57:40 +0800 (CST) X-Zmail-TransId: 2b0463a519242f9b73c8 X-Mailer: Zmail v1.0 Message-ID: <202212231057406402834@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , Subject: =?UTF-8?B?W1BBVENIIG5ldC1uZXh0XSB3bDE4eHg6IHVzZSBzdHJzY3B5KCkgdG8gaW5zdGVhZCBvZiBzdHJuY3B5KCk=?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2BN2vdKr082489 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63A5192D.001 by FangMail milter! X-FangMail-Envelope: 1671764269/4NdX0s5DY6z6FK2P/63A5192D.001/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A5192D.001/4NdX0s5DY6z6FK2P 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 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/ti/wl18xx/main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index 0b3cf8477c6c..1e4a430d1543 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c @@ -1516,12 +1516,9 @@ static int wl18xx_handle_static_data(struct wl1271 *wl, struct wl18xx_static_data_priv *static_data_priv = (struct wl18xx_static_data_priv *) static_data->priv; - strncpy(wl->chip.phy_fw_ver_str, static_data_priv->phy_version, + strscpy(wl->chip.phy_fw_ver_str, static_data_priv->phy_version, sizeof(wl->chip.phy_fw_ver_str)); - /* make sure the string is NULL-terminated */ - wl->chip.phy_fw_ver_str[sizeof(wl->chip.phy_fw_ver_str) - 1] = '\0'; - wl1271_info("PHY firmware version: %s", static_data_priv->phy_version); return 0; -- 2.15.2