Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp21427rwj; Thu, 22 Dec 2022 19:55:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXt3QbDYs1zx/w1J8mBx8haBbjZXe0DF8dFPKempZtGO2O/9HbAvIOmFa5Jv2Ln/GZIajL8e X-Received: by 2002:aa7:8215:0:b0:580:9151:afe5 with SMTP id k21-20020aa78215000000b005809151afe5mr1260554pfi.22.1671767735252; Thu, 22 Dec 2022 19:55:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671767735; cv=none; d=google.com; s=arc-20160816; b=ArZVSE4bhQtGaopJ9AzGOofWS62ZjUgr6CggWz+h5kjNNj9boca6jtYUT5aia5tayX at2UDbB5qU1CxN9v9KOt1mxX6cnBcSr4CTjAwJc6KaJUqgJnnVvpdT9G/0qc1MgXN7cG RLsCQyzAqryFn2tYkETqe/WeDTzgMfmfskAZNcQnvxwiN6pdNp7b4X9J2236ZQKJgVJs uOz5Q+ax3gFI6OxemY0NRwQoopB54w31r+cBdbM2xNrzjhrBWm3sxKdtiqgggS04ZahW i/97JH9OT+y/WRBhp1AbClkpd+DdqaC9JH550186VUzaC1KwhnNFVzFqRKnmIHvsrOT3 iRmQ== 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=G5md6imsyXgBVxsLde4HjGeNImaK5hKJGm9EByV9MzA=; b=WK94n31TsYo+CSxrQEGmOwMJUp03h0lOw3q64oRpbXcD465zi0wN80zZQsbPBplEmt ubJtXe7KPRV/zCGiSTL+XyghpIismsgcsRd20PsF/q1iOivk7fSe7jdD56K6GL2ShJRL do/Imtp+7+wFOzUJfAdjTSwawKMOaAKRhNEV7rFwGqx5GFn24bgw7KIHfGj+bHE0dQYS j33TNQXGBCUqm6NxSb4mZyq5yU4K571bYcmGtKLYaEAIqcjJKUb1aAtviybzOf+DNnoD EB5ofAlD6Kf/SbOPloQOp7VvGifcQFhc00tsMk67F/i/rNG/IVQGtYwiKiJ+KUID7hbG 8Vww== 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.55.26; Thu, 22 Dec 2022 19:55:35 -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 S235976AbiLWC7F (ORCPT + 67 others); Thu, 22 Dec 2022 21:59:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235854AbiLWC7D (ORCPT ); Thu, 22 Dec 2022 21:59:03 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E6E817413; Thu, 22 Dec 2022 18:59:02 -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 4NdX2D6Mxrz8R040; Fri, 23 Dec 2022 10:59:00 +0800 (CST) Received: from szxlzmapp03.zte.com.cn ([10.5.231.207]) by mse-fl2.zte.com.cn with SMTP id 2BN2wlg0065747; Fri, 23 Dec 2022 10:58:54 +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:58:55 +0800 (CST) Date: Fri, 23 Dec 2022 10:58:55 +0800 (CST) X-Zmail-TransId: 2b0463a5196fffffffff833ba8ff X-Mailer: Zmail v1.0 Message-ID: <202212231058555242869@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , Subject: =?UTF-8?B?W1BBVENIIG5ldC1uZXh0XSB3bDEyNTE6IHVzZSBzdHJzY3B5KCkgdG8gaW5zdGVhZCBvZiBzdHJuY3B5KCk=?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2BN2wlg0065747 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63A51974.001 by FangMail milter! X-FangMail-Envelope: 1671764340/4NdX2D6Mxrz8R040/63A51974.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A51974.001/4NdX2D6Mxrz8R040 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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/wl1251/acx.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c index f78fc3880423..613ddab068c3 100644 --- a/drivers/net/wireless/ti/wl1251/acx.c +++ b/drivers/net/wireless/ti/wl1251/acx.c @@ -150,14 +150,7 @@ int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len) } /* be careful with the buffer sizes */ - strncpy(buf, rev->fw_version, min(len, sizeof(rev->fw_version))); - - /* - * if the firmware version string is exactly - * sizeof(rev->fw_version) long or fw_len is less than - * sizeof(rev->fw_version) it won't be null terminated - */ - buf[min(len, sizeof(rev->fw_version)) - 1] = '\0'; + strscpy(buf, rev->fw_version, len); out: kfree(rev); -- 2.15.2