From patchwork Thu Nov 24 11:24:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 25464 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3337429wrr; Thu, 24 Nov 2022 03:29:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf59GOqSqChV4vNw9X3RwS+eJK2aZjwp6On+UtqOD0FhwXU2Tmr3mKvfJ44wmbeUjgUhSDDZ X-Received: by 2002:a50:fd0d:0:b0:469:c73c:e29a with SMTP id i13-20020a50fd0d000000b00469c73ce29amr14841919eds.423.1669289347170; Thu, 24 Nov 2022 03:29:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669289347; cv=none; d=google.com; s=arc-20160816; b=OwKSYx9QhjL3yQ5RavIYOP2UTfx6MZXo2mYnECuwu2Iic8/aMzMsVNV/SF590wNi0E 77oqMVmdt1bJq3Qge3+Shs1mKLk6Lp8uCkYzIcs5XSzIajoMH33uh+4NIkVCtwtGmZ/0 c/PUURzTKMApd95vI4ydsRES1pe8yvShr4Dvk2pddwC8VSiGm3GwMWJPqSuIYXjm7e+J W75qDi5oAxlJGhMJpfc5GsJfLNh8AXe40QB2jvnVdnJUGxZon9rkVpXHngTBvJFcLIkH XaPpX+yWujYx0kVCIB7p7EeQ4TZgp7VFOJFI6TP0KjrSsowMGchnVHCa1+Nq3stxnkWv CT7g== 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=hyuNQeunpjATZ2GLFSRYseZ7vxrfxYGkAu3zWQAoW2E=; b=bSCa9bxafIzJgiIxC8xWxXcKqV09/NOQ2lDBujR+3zhAUQOXFKgsR0Y8eFTdpxHYnF utT3ak1D4SRP5WNZcmMgxjPeV3bUO7Ogxo5wCzIlBZUJytVfYNzaNo/Jj3ENKrSu/wGh qBWiC95+s9/SiWyGYB+BBo9pwHG50f7dod0HBOiU17pZ84M5adfcgRgWrYhL6GPF10TO xwnParj2W83uTf2qc6grl42ggTFDaiM+j3fb414O3WM8zfKm/w267tv7LzkPOZ3uCJAe ko1PmdA6ArEhcWhk13Cwjq1oRx+8bVw/fLFXn+/UYXKoOUcF0BU9vEPQExBftBvnaDgD 4HqQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xa3-20020a170906fd8300b007add6c835a9si516544ejb.867.2022.11.24.03.28.40; Thu, 24 Nov 2022 03:29:07 -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 S229569AbiKXLYv (ORCPT + 99 others); Thu, 24 Nov 2022 06:24:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbiKXLYt (ORCPT ); Thu, 24 Nov 2022 06:24:49 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3517C2529C for ; Thu, 24 Nov 2022 03:24:47 -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 mxct.zte.com.cn (FangMail) with ESMTPS id 4NHwd92r6Fz501Qj; Thu, 24 Nov 2022 19:24:45 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl1.zte.com.cn with SMTP id 2AOBOXsN025208; Thu, 24 Nov 2022 19:24:33 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Thu, 24 Nov 2022 19:24:36 +0800 (CST) Date: Thu, 24 Nov 2022 19:24:36 +0800 (CST) X-Zmail-TransId: 2b04637f5474503e4e51 X-Mailer: Zmail v1.0 Message-ID: <202211241924364726330@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH_linux-next=5D_clocksource=3A_use_strscpy=28=29_t?= =?utf-8?q?o_instead_of_strlcpy=28=29?= X-MAIL: mse-fl1.zte.com.cn 2AOBOXsN025208 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 637F547D.001 by FangMail milter! X-FangMail-Envelope: 1669289085/4NHwd92r6Fz501Qj/637F547D.001/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 637F547D.001/4NHwd92r6Fz501Qj 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750376746716236692?= X-GMAIL-MSGID: =?utf-8?q?1750376746716236692?= 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 --- kernel/time/clocksource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index 4a2c3bb92e2e..d59b05409a22 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -1450,7 +1450,7 @@ static int __init boot_override_clocksource(char* str) { mutex_lock(&clocksource_mutex); if (str) - strlcpy(override_name, str, sizeof(override_name)); + strscpy(override_name, str, sizeof(override_name)); mutex_unlock(&clocksource_mutex); return 1; }