Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp8786rwj; Thu, 22 Dec 2022 19:39:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXtI1WwDjMpzEqCcZqet7JVWH/CMo7r+OWL29Z0NJAq7uy3nZllbQMPV7lt2ovEDMgESOWv6 X-Received: by 2002:aa7:9802:0:b0:572:5a7f:a02d with SMTP id e2-20020aa79802000000b005725a7fa02dmr9262127pfl.6.1671766741925; Thu, 22 Dec 2022 19:39:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671766741; cv=none; d=google.com; s=arc-20160816; b=FqkGtUbrXfHZ/lsGoVY45VMYu0C2fQG+ER1zKCPI1U+F1BaO1o1pbMwFqdtBh9ayTs sKGk22hsh+xB40RU8d7l//IdQytB58PXGJgPfdmURV8Xth35geIQsprkaVuE2oqeX8rQ DA7St3cS67/NYFEWboNt0Os/nPHF2sGycaDRA7qCU/HBQ2tM7UySG7lm7PIY9S61Ycq1 ZfuFDVuUnw/K0QinCmV6D7U0LdoFh5o7a3O/7dtkusy6kvaZPlIVYuJ4uIN9BfrESsb2 NyMYJFs1NxR8v0ciW1kUgvj3db7nTEZLjbbaEIgeK11baDsULijXSCbU459vR7ys3mGV pquQ== 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=kGlUIrcG/hJ3oNI8hbiODyCDjnzFwL3vvn6fW6LY6Xc=; b=vwUMqPilcavIAfxISokuYOs8Uxxp331pZBfU5kAMnivJV7iQhQW0rpxVo5Mt9iHl3v LYfHyH16GsTnTo03wu4tlMVZfPKKQ6Qk9ApebRh8sU45PhjMSrXGsNyLTi7B8RIdxwbT kipbL5Rs5/FcqTeSGbrTuMzsmwIwWMtRgR6NJTiZorPGJN/Ju7j1NC8000Lxl71zJXhy xsh7z3KptgqjfsMZ+viymOKTiK5BZXOHYTS1F5I1xagENLRZZL2JdgwLpsIHRnla4a8u oT4Zrt1AZcQCwiUnYcEM6W4GNQGOFpIQt6hpwVX19UTcvrxwLXgPpXnjYI4jIQ+CJyha 0uZw== 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.38.52; Thu, 22 Dec 2022 19:39:01 -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 S235911AbiLWDA2 (ORCPT + 67 others); Thu, 22 Dec 2022 22:00:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbiLWDA1 (ORCPT ); Thu, 22 Dec 2022 22:00:27 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0F66275EC; Thu, 22 Dec 2022 19:00:26 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NdX3s3sfHz5PkHg; Fri, 23 Dec 2022 11:00:25 +0800 (CST) Received: from szxlzmapp03.zte.com.cn ([10.5.231.207]) by mse-fl2.zte.com.cn with SMTP id 2BN30HKW067276; Fri, 23 Dec 2022 11:00:17 +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 11:00:18 +0800 (CST) Date: Fri, 23 Dec 2022 11:00:18 +0800 (CST) X-Zmail-TransId: 2b0463a519c2ffffffffd73bde3c X-Mailer: Zmail v1.0 Message-ID: <202212231100187262916@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , Subject: =?UTF-8?B?W1BBVENIIG5ldC1uZXh0XSB3bGNvcmU6IHVzZSBzdHJzY3B5KCkgdG8gaW5zdGVhZCBvZiBzdHJuY3B5KCk=?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2BN30HKW067276 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63A519C9.001 by FangMail milter! X-FangMail-Envelope: 1671764425/4NdX3s3sfHz5PkHg/63A519C9.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A519C9.001/4NdX3s3sfHz5PkHg 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/wlcore/boot.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/wireless/ti/wlcore/boot.c b/drivers/net/wireless/ti/wlcore/boot.c index 85abd0a2d1c9..f481c2e3dbc8 100644 --- a/drivers/net/wireless/ti/wlcore/boot.c +++ b/drivers/net/wireless/ti/wlcore/boot.c @@ -41,12 +41,9 @@ static int wlcore_boot_parse_fw_ver(struct wl1271 *wl, { int ret; - strncpy(wl->chip.fw_ver_str, static_data->fw_version, + strscpy(wl->chip.fw_ver_str, static_data->fw_version, sizeof(wl->chip.fw_ver_str)); - /* make sure the string is NULL-terminated */ - wl->chip.fw_ver_str[sizeof(wl->chip.fw_ver_str) - 1] = '\0'; - ret = sscanf(wl->chip.fw_ver_str + 4, "%u.%u.%u.%u.%u", &wl->chip.fw_ver[0], &wl->chip.fw_ver[1], &wl->chip.fw_ver[2], &wl->chip.fw_ver[3], -- 2.15.2