Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1709069rwl; Mon, 26 Dec 2022 03:40:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXvgjsfVJyDDmromF8MmwEjlEv+l02gilpVj+8mBWxqZhY4uA0fGKH3eb5S52b6y6Bk7IL9q X-Received: by 2002:a17:906:8601:b0:7b2:91e8:1553 with SMTP id o1-20020a170906860100b007b291e81553mr14351991ejx.20.1672054819413; Mon, 26 Dec 2022 03:40:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672054819; cv=none; d=google.com; s=arc-20160816; b=zaYO2oSvzAvGN+YTsqXq/RLKSUP/YTFJ/XO3CxWoB+9y6hkaiWgRdw9c+Fj8DEa9uq KdtLcKl46ntIXIL7HC/WNwTndEHI6C7hKzlu3eGX4HqF3TGdB5nHLTaBDbyVQ3lPMO2o GnyGDwR6TVEIZP0mtwkxq++/C0b77ywJ2cX1UBejGtCKWL/UgP+nofh5wWvJCeQBcsyT Ld+IhASA0nX2tfUkP1+M9N3l2UqVo6CD+cpwX1V+xukMFhJw6u9Cq9cbGYvARCXF5Oos C0OEPt6YtPgdiWiBed/2dkXk+kD20XkSbAhsSqEnBQPkppG5Ihzmtw/ceaU4RA3eyzVO tHZw== 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=s4RWseODXaQ94oB1t0k4+Gop2LzPB8iP87UtvgWvp7o=; b=RRK/Vsh9Q2pgvo03w/V6uPKNZZ4yw0xT7qjusiPeiZnEsbAI70gzsUe52C8LAGV3UC JHwtPdqL5A2RKGxYzAmAx5SMP9UjROyQyB16/Cv5wyPBUP2otpFJIOw5xj6NEA+wldMu qsdLHadwZwTdmV9x1udzvsBv0H9kdB3mMkepsa2YgfHIcMwJpSN1NIOxMYUQ0V3MxojH CuFrKpcSd893BuztEISzMiMbD02xpYw+AVok3k315dxv/2SZVpOhcBpqXtFjUMLPUVeS Wc5CmYOoNNNjVBb8xLxgV+seBztLgpnKKbokgNTAUePv36eZkY3A5oQgEBDdbT5K+0ee r5MA== 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 ga33-20020a1709070c2100b0084c4942ea8esi3091120ejc.268.2022.12.26.03.40.04; Mon, 26 Dec 2022 03:40:19 -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 S231716AbiLZLDd (ORCPT + 66 others); Mon, 26 Dec 2022 06:03:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbiLZLDc (ORCPT ); Mon, 26 Dec 2022 06:03:32 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46EBD111A for ; Mon, 26 Dec 2022 03:03:31 -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 4NgZdt03fKz8QrkZ; Mon, 26 Dec 2022 19:03:30 +0800 (CST) Received: from szxlzmapp02.zte.com.cn ([10.5.231.79]) by mse-fl2.zte.com.cn with SMTP id 2BQB3Ldg067680; Mon, 26 Dec 2022 19:03:21 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp01[null]) by mapi (Zmail) with MAPI id mid14; Mon, 26 Dec 2022 19:03:24 +0800 (CST) Date: Mon, 26 Dec 2022 19:03:24 +0800 (CST) X-Zmail-TransId: 2b0363a97f7cffffffffc5a1085d X-Mailer: Zmail v1.0 Message-ID: <202212261903245548969@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIHN0YWdpbmc6IGtzNzAxMDogdXNlIHN0cnNjcHkoKSB0byBpbnN0ZWFkIG9mIHN0cm5jcHkoKQ==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2BQB3Ldg067680 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63A97F82.000 by FangMail milter! X-FangMail-Envelope: 1672052610/4NgZdt03fKz8QrkZ/63A97F82.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A97F82.000/4NgZdt03fKz8QrkZ 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/staging/ks7010/ks_wlan_net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c index 044c807ca022..e03c87f0bfe7 100644 --- a/drivers/staging/ks7010/ks_wlan_net.c +++ b/drivers/staging/ks7010/ks_wlan_net.c @@ -382,8 +382,7 @@ static int ks_wlan_get_nick(struct net_device *dev, return -EPERM; /* for SLEEP MODE */ - strncpy(extra, priv->nick, 16); - extra[16] = '\0'; + strscpy(extra, priv->nick, 17); dwrq->data.length = strlen(extra) + 1; return 0; -- 2.15.2