Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3902904rwl; Tue, 27 Dec 2022 17:49:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXuHu/XOP98hRfbIJQ/75uNUSVUHBz+ztNj6qFkJ0Q1Bs8gCliydqSfH7wVPC0a0wR4kYOFX X-Received: by 2002:a05:6a20:3d17:b0:a4:efdd:a9b9 with SMTP id y23-20020a056a203d1700b000a4efdda9b9mr34566864pzi.44.1672192199191; Tue, 27 Dec 2022 17:49:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672192199; cv=none; d=google.com; s=arc-20160816; b=ME8B7yl4JmiR50QaDu7FQSYmZq1mpH+FyFKRDF1rPISjRB88HeZSBR+iTo3aJL7ZFR Xi4GuVEdCtLTqsDCRbkC5MAt/RC9sN92hP74Ghdu+beZwQhufQn6YVhAy0v5histyPhQ B2NVxbikT+sg6r2c+ohjeAI7zXstjx+i6gawxFRxYmyemUdaDjUn2yEp/5jrMQskBPu9 N3vYTVQ27ldqCMpkvLzuSrB60u9k9qbaxZar9hKhJEe8Ex3Lo/UNWqnQkAuupaM+brUJ uFrZlWeFT5GgXQvLeNtu46sbsPrrOQ05iiYG1HIpO2r16VWnIoEHEpxCsY4YECDHdVQC 9smw== 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=TF0pLd4Bn3ZGVlEINdvAxbuYCZ7F8IGQL8jiSR4M1tg=; b=dqvt06+GzxxjInXlT84k8Eav1iSHL9xvOaFqE/yQNWSdy1AedDDqZvAVY6xvOSUB2U O92OMEAIXMjClG4h3HMepCCfQIIdGnFC9PdpUbUf2rEiDaqhQy/0w6K/zrE5pd2IbSjv cRvG4iOHn9p1Z7L9yedeGgJfmNgnWzw48WL/BUdclqWaGEvKcJ3hkNmvfkvS2a6SEccG pvTEnNy65EhcFAmKbO0+MYTZ0nCMbquEVHH8QnG4985xn2AHBVsmjHfq/+Kj0K4OsPHj iWu/kGSfD099XhJLo+ELrIlAJnHrKaewULJACJjjfttEQLEujLfjMc0sEsAQQDU/C6S9 vFZg== 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 r200-20020a632bd1000000b00477e5baa6fcsi16053796pgr.747.2022.12.27.17.49.50; Tue, 27 Dec 2022 17:49: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 S232394AbiL1BqF (ORCPT + 65 others); Tue, 27 Dec 2022 20:46:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbiL1BqA (ORCPT ); Tue, 27 Dec 2022 20:46:00 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A17DF21; Tue, 27 Dec 2022 17:45:59 -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 4NhZ9d6Rw2z8R039; Wed, 28 Dec 2022 09:45:57 +0800 (CST) Received: from szxlzmapp07.zte.com.cn ([10.5.230.251]) by mse-fl2.zte.com.cn with SMTP id 2BS1jmRr028047; Wed, 28 Dec 2022 09:45:48 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp01[null]) by mapi (Zmail) with MAPI id mid14; Wed, 28 Dec 2022 09:45:49 +0800 (CST) Date: Wed, 28 Dec 2022 09:45:49 +0800 (CST) X-Zmail-TransId: 2b0363ab9fcd23463af5 X-Mailer: Zmail v1.0 Message-ID: <202212280945491860150@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIHRoZXJtYWw6IGFybWFkYTogdXNlIHN0cnNjcHkoKSB0byBpbnN0ZWFkIG9mIHN0cm5jcHkoKQ==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2BS1jmRr028047 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63AB9FD5.000 by FangMail milter! X-FangMail-Envelope: 1672191957/4NhZ9d6Rw2z8R039/63AB9FD5.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63AB9FD5.000/4NhZ9d6Rw2z8R039 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/thermal/armada_thermal.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index 52d63b3997fe..e06a0468d95d 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -761,8 +761,7 @@ static void armada_set_sane_name(struct platform_device *pdev, } /* Save the name locally */ - strncpy(priv->zone_name, name, THERMAL_NAME_LENGTH - 1); - priv->zone_name[THERMAL_NAME_LENGTH - 1] = '\0'; + strscpy(priv->zone_name, name, THERMAL_NAME_LENGTH); /* Then check there are no '-' or hwmon core will complain */ do { -- 2.15.2