Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp984040rwj; Thu, 22 Dec 2022 18:38:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXsGBQDrvc2I+oCI2ZEcorq3yiRR3qeXiwAftgCsC4fRnEqQ6E3qFQJ90rzlxhR29GPveVnI X-Received: by 2002:a17:906:4547:b0:7ad:c3b5:8d55 with SMTP id s7-20020a170906454700b007adc3b58d55mr6226313ejq.67.1671763112988; Thu, 22 Dec 2022 18:38:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671763112; cv=none; d=google.com; s=arc-20160816; b=adbqxH7+EA8SdqFPf54wcfqFO0xt2jPPRpKw3BmxfD3/HmkJrwHyC+souqzMLFlXw/ +7V931oezCwwSTZ0++Q3SD6BZiUqEHj2q0g09rpG5/YJSJA1hDACQJvHhXZAozob6ACA XnBxTkuFpev36e9Jrz+iGiELY5yLZJL3wPJxyEI/VSmHGadxVelvXBvzCqFHOOBYelga cZgANgJxIvPm75kA4qkG1u+Hha0Ik3Fi7vxAXRP2MQvvdtQQz2XVjJMigNFNOzIYO4zt 26gMHLWvS+j76KHPgio6tkhhvA+8GEw1KImjDeBAiOKOSTI2U74BoIaDriDf8YbUDfif tOpg== 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=dHeSewi53E76O0FDs5MxaZPmVJK/AfHNG3rY7poXw/A=; b=wgpZ8OLBfxRrNmHRVIxYYXGADroiQox7CG7cMaYZPGItV1Totc1b0E53VUCPZr+9/a zrioh/IWpn3As4ttRsbSf9Yf1ctcIALzGlQgvaRsldtSWu4c69h57ngdCQmWNjW1wjPR qbxCzYVF493UlZjPrvkX7mE4UfbJ+D/ht5JEi9Cfk1COydeihFHuI4lg7jy7G5NGy1mn uFtX2s4MZjCPScW2RefsTecMQkRMwp/v02HjEosQlcBYYrovPFpe/cZCJM07+6UVPRO/ IDx0NGhuatnUGVHavlFQ0Iq+E+tIFckq0P6UKER/BbiR/DhJ8QQXATBu2e4UULJ1gMhk Q2lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 hb7-20020a170907160700b007c60482a110si1741375ejc.625.2022.12.22.18.38.13; Thu, 22 Dec 2022 18:38:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 S235443AbiLWCe6 (ORCPT + 66 others); Thu, 22 Dec 2022 21:34:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229613AbiLWCe4 (ORCPT ); Thu, 22 Dec 2022 21:34:56 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D40315A36; Thu, 22 Dec 2022 18:34:54 -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 4NdWVN5Xcjz5PkHg; Fri, 23 Dec 2022 10:34:52 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl1.zte.com.cn with SMTP id 2BN2YhvB065144; Fri, 23 Dec 2022 10:34:43 +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:34:45 +0800 (CST) Date: Fri, 23 Dec 2022 10:34:45 +0800 (CST) X-Zmail-TransId: 2b0463a513c5ffffffffdfe7df07 X-Mailer: Zmail v1.0 Message-ID: <202212231034450492161@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIG5ldC1uZXh0XSBhdGg1azogdXNlIHN0cnNjcHkoKSB0byBpbnN0ZWFkIG9mIHN0cm5jcHkoKQ==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2BN2YhvB065144 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63A513CC.00B by FangMail milter! X-FangMail-Envelope: 1671762892/4NdWVN5Xcjz5PkHg/63A513CC.00B/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A513CC.00B/4NdWVN5Xcjz5PkHg 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-wireless@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/ath/ath5k/led.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c index 33e9928af363..439052984796 100644 --- a/drivers/net/wireless/ath/ath5k/led.c +++ b/drivers/net/wireless/ath/ath5k/led.c @@ -131,8 +131,7 @@ ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led, int err; led->ah = ah; - strncpy(led->name, name, sizeof(led->name)); - led->name[sizeof(led->name)-1] = 0; + strscpy(led->name, name, sizeof(led->name)); led->led_dev.name = led->name; led->led_dev.default_trigger = trigger; led->led_dev.brightness_set = ath5k_led_brightness_set; -- 2.15.2