Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp466746rwb; Thu, 12 Jan 2023 23:25:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXt1mBVDzRMVx6YH84pVqeJpgxLKNH2sgYnpdLfbI2Js4rclfOn228ZVcqc91qZjfphFL/me X-Received: by 2002:a17:903:2411:b0:192:d9dd:167d with SMTP id e17-20020a170903241100b00192d9dd167dmr38429098plo.43.1673594725080; Thu, 12 Jan 2023 23:25:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673594725; cv=none; d=google.com; s=arc-20160816; b=rzIb27rOsAWQ95dZsFoRAuT9VCMmE/ObhYE4+c0sYIio9oe0UbRxiZP6azQKzlYXzE BFRqPA/C7otag1DaLmE90HQYMapaxJYCN3ealf9+kDSxzfmbBLkcEEexrVMGUVJ3SF/C H24temoyT5Q8hbRTrIgFxAHyAZARF8ldqs4DKrwDC2aBpTHLZ3TrSYWKqi2drL+Qi222 kprjxbwoBOibORLzmoXF9/A5chxfGv6I+/MPO2K+QekqCmGUIOnt8RD84IIxEGCJW6Aq lChiMBz7fwV53utcD+hEvIM9W/qsTP1JjY8VBDqXf6BNmKs5ajMAWz331ONxKEVVTZFj UTHA== 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:references :in-reply-to:message-id:date; bh=XB51Z5aLWoIYGi7jUdySu5Xsbytybr/4iRM86HoABbA=; b=vsznot3gtf9z8syHA9qMHRWsQsqUlxyaDczIAy06FigCKRvJn0OL68R7+vm7Ox1cEX 5eiIVy8lUJCCZ7+zgKmjCZjiRNt3Y7iA0PJQ6NxVVlQX+eWomBN3ZkNMk6yhhOK/xKDG GeY4psArsqorPL5CrIzLS5y7nW2mLCU4w72QFgKKKGnsfB8L+onGUdFVVqE4SDNWfCqe NEgbKcbMlNW+zToP1EO6+JDSrvwobyVkNQm24O5QRr/JAcNIgnSIx46SRcgE6UI64FUU 3boUpw5sxtCWHRYQazMJWj77knfcTXsErVE1kh6V3uoPukkZeo7Zb63/w4KMw1k1aDhj y/sA== 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 k3-20020a170902c40300b00189812f489asi21861998plk.155.2023.01.12.23.25.14; Thu, 12 Jan 2023 23:25:25 -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 S240685AbjAMHXB (ORCPT + 50 others); Fri, 13 Jan 2023 02:23:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239960AbjAMHWV (ORCPT ); Fri, 13 Jan 2023 02:22:21 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A8545BA2B; Thu, 12 Jan 2023 23:13:31 -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 4NtXh75fQdz8RTZF; Fri, 13 Jan 2023 15:13:27 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl1.zte.com.cn with SMTP id 30D7DA6U049679; Fri, 13 Jan 2023 15:13:10 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp01[null]) by mapi (Zmail) with MAPI id mid14; Fri, 13 Jan 2023 15:13:12 +0800 (CST) Date: Fri, 13 Jan 2023 15:13:12 +0800 (CST) X-Zmail-TransId: 2b0363c10488ffffffff9d335c5f X-Mailer: Zmail v1.0 Message-ID: <202301131513124870047@zte.com.cn> In-Reply-To: <20230112211707.2abb31ad@kernel.org> References: 202301111425483027624@zte.com.cn,20230112211707.2abb31ad@kernel.org Mime-Version: 1.0 From: To: Cc: , , , , , , , , Subject: =?UTF-8?B?UmU6IFtQQVRDSCBuZXQtbmV4dCB2Ml0gbmV0L3JkczogdXNlIHN0cnNjcHkoKSB0byBpbnN0ZWFkIG9mIHN0cm5jcHkoKQ==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 30D7DA6U049679 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63C10497.000 by FangMail milter! X-FangMail-Envelope: 1673594007/4NtXh75fQdz8RTZF/63C10497.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63C10497.000/4NtXh75fQdz8RTZF 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 > What are the differences in behavior between strncpy() and strscpy()? Strscpy() makes the dest string NUL-terminated, and returns more useful value. While strncpy() can initialize the dest string. Here we use strscpy() to make dest string NUL-terminated, and use return value to check src string size and dest string size. This make the code simpler.