Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp516583rwb; Wed, 9 Nov 2022 05:38:42 -0800 (PST) X-Google-Smtp-Source: AMsMyM6lzlDcgqzzxuZzaH200tRiwMY1Y7GN28+AHdQWh6iemiVyx2b61IZzrorAbYs68ZrGASPl X-Received: by 2002:aa7:8750:0:b0:56c:318a:f811 with SMTP id g16-20020aa78750000000b0056c318af811mr60391892pfo.14.1668001122123; Wed, 09 Nov 2022 05:38:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668001122; cv=none; d=google.com; s=arc-20160816; b=qQaii/HM5hndyIFuH0ZkSdrfgZ4i4jNiCDBMvmAZwZI4DgE4oYH+b6adGWhzCQY2mU BZdi6jL4NcJMFo4L1oR/Ob+im0Fd+vJY9KFSOk1tzwnEdYZ0SnFaqY1N/JkX3Yn2/9KG lwEzLV+7/4QgO0p/cpp8vN0QxYyrTh+kTXEJaZwTj1FA2DSVIQdKZQT0Ye6LgdOjZpa7 xiKI52e/RSY1uq+1KyIztNy61BJUtyXR7wSSsxmXp6eibc1i9v5bw0R7H7NQcR7L7bS/ ohiWPWdBn9Kj2MAYqO4lxaW2XSusPrD0LfUMRnIqlkhZubGeKQQUdnQCGq3luE+U4ydI Gdog== 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=zYMpoPnBfIHpGwNO7qeOEKDAA44g7R5Z66jrC/KbZUQ=; b=y3CUZpJy6J6LI3c8UynIb8op4sN+kOUzzyy5J2p7RdUgIC7oIAOayGeohxKXQjaA56 bw8l9yhvLY5z2tK1Bj7TCB3xo6ChTz9h855/5TP5y5FxYLrDrSnoz3gcDmVDMxzYfjhx vO8v4oakYZf6l5jmgtlF/V+kSyXxPxCr1v7wJplRNsIPLrgs5QXY5Kylfe+GUH6KcqdB mePVIF5YrKQxrV0+hlVnz/wFRwe597obYk/OT9Jo2vJ4Cv2/ja1caBAUzZqBTDpHyQOL 74w57sBEE6gklBRuZf8xDgEzExnNj9RYL03k6E1ETl0eUrgx3G0DwfWIy3sYdQwmLiNs QNCQ== 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 y9-20020a170902b48900b00175430821b1si14863559plr.430.2022.11.09.05.38.29; Wed, 09 Nov 2022 05:38:42 -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 S229561AbiKINc7 (ORCPT + 93 others); Wed, 9 Nov 2022 08:32:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbiKINc6 (ORCPT ); Wed, 9 Nov 2022 08:32:58 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A644B2EF39 for ; Wed, 9 Nov 2022 05:32:56 -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 4N6m9z25qSz8QrkZ; Wed, 9 Nov 2022 21:32:55 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl2.zte.com.cn with SMTP id 2A9DWnZt099946; Wed, 9 Nov 2022 21:32:49 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp03[null]) by mapi (Zmail) with MAPI id mid14; Wed, 9 Nov 2022 21:32:53 +0800 (CST) Date: Wed, 9 Nov 2022 21:32:53 +0800 (CST) X-Zmail-TransId: 2b05636bac05ffffffff8eb2a033 X-Mailer: Zmail v1.0 Message-ID: <202211092132530746481@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIGJsb2NrOiB1c2Ugc3Ryc2NweSgpIGlzIG1vcmUgcm9idXN0IGFuZCBzYWZlcg==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2A9DWnZt099946 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 636BAC07.000 by FangMail milter! X-FangMail-Envelope: 1668000775/4N6m9z25qSz8QrkZ/636BAC07.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 636BAC07.000/4N6m9z25qSz8QrkZ 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. Reported-by: Zeal Robot Signed-off-by: Xu Panda Signed-off-by: Yang Yang --- block/elevator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/elevator.c b/block/elevator.c index a5bdc3b1e7e5..0885b66c3868 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -749,7 +749,7 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *buf, if (!elv_support_iosched(q)) return count; - strlcpy(elevator_name, buf, sizeof(elevator_name)); + strscpy(elevator_name, buf, sizeof(elevator_name)); ret = elevator_change(q, strstrip(elevator_name)); if (!ret) return count; -- 2.15.2