Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5074373rwb; Sun, 13 Nov 2022 21:13:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf6nJqViz79biRTXVORTvy1zsizTa92jJBywTw187daY++R2NnjRCfoPqJM+rOXiWe8vKf6D X-Received: by 2002:a17:902:eb91:b0:188:5340:4a38 with SMTP id q17-20020a170902eb9100b0018853404a38mr12040690plg.34.1668402799279; Sun, 13 Nov 2022 21:13:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668402799; cv=none; d=google.com; s=arc-20160816; b=Er0QIBX0Q9RL6dYmhWls8+5A7eaH3K16eOhq99rxzPyyRr4DbzqKaR2Nd8LCfLiVqp e+DT1PLyYFy2GoSv/lkNALe/a+1oIz79DHYj6NvZu5T/sm5Jf+4MXHAAgrRTWcIfJ3SF G8h+Hxgm483750Czv/0cMC0J6zKpa9R+OaKGzNZ0I2GvQMGj918LeQYPO97wji6ArIqG /WAjM78IFJHzqs6hGERQEgBBuQK6xwfhSZ0G9zR9QcqTC74SC73dJ57xZZBli7g1Eigb LRglmK1KeTy7aCEzeBwm1BXYGae2xh4Zd0sAGhLOhjFNmQ6ZPW+iqgIWMZU8v5R3HD4C G1dQ== 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=eetXJve/ZSxeUB44zvikCJJaCeeIraiQYF/eY5KYYPM=; b=p6T1HLhluOmHtlEv2Ht2ujCdqN9vR4gfAjHYt0tBjrACzFqyre3s4v911CsF+zxLrI ybMLEhYVeGGBWjewleLPju8tmpKEFhaCSO3sNI4P+bDzr1E85S6kYCe6eWJmKbgu4ppy BB8zC9u4Jod9gsl/qLuRKf/eQ1VSZY/0B6yHJYpfGdBNf0pHFF72jDbeDvGGil1Q/8Kj sIsK01KhsjbvBVklvCV6VxURsQsCz/5Ogrrl5JjS2Z/c8v5jRBJhPEf9bbGad/UP3016 CI2TEDIgaBsSCGZqzY/xO7YHEjpNxY2zVdbHChTTgBFq43EG6BQa1lqdu5HcCo4qyowV aAvQ== 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 l17-20020a170903121100b001871fb0906esi341plh.585.2022.11.13.21.12.55; Sun, 13 Nov 2022 21:13:19 -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 S235729AbiKNDkm (ORCPT + 88 others); Sun, 13 Nov 2022 22:40:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235249AbiKNDkl (ORCPT ); Sun, 13 Nov 2022 22:40:41 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [58.251.27.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47BC36559; Sun, 13 Nov 2022 19:40:40 -0800 (PST) Received: from mxde.zte.com.cn (unknown [10.35.20.165]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4N9ZpG44z7zjn8; Mon, 14 Nov 2022 11:40:38 +0800 (CST) Received: from mxus.zte.com.cn (unknown [10.207.168.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxde.zte.com.cn (FangMail) with ESMTPS id 4N9ZpB72rKz4xD31; Mon, 14 Nov 2022 11:40:34 +0800 (CST) Received: from mxhk.zte.com.cn (unknown [192.168.250.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxus.zte.com.cn (FangMail) with ESMTPS id 4N9Zp74zSvz9tyD6; Mon, 14 Nov 2022 11:40:31 +0800 (CST) Received: from mxct.zte.com.cn (unknown [192.168.251.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4N9Zp42p3gz4xVnD; Mon, 14 Nov 2022 11:40:28 +0800 (CST) 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 4N9Zp20fR1z4y0tt; Mon, 14 Nov 2022 11:40:26 +0800 (CST) Received: from szxlzmapp06.zte.com.cn ([10.5.230.252]) by mse-fl1.zte.com.cn with SMTP id 2AE3eC1t022476; Mon, 14 Nov 2022 11:40:12 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp04[null]) by mapi (Zmail) with MAPI id mid14; Mon, 14 Nov 2022 11:40:13 +0800 (CST) Date: Mon, 14 Nov 2022 11:40:13 +0800 (CST) X-Zmail-TransId: 2b066371b89d59d038a6 X-Mailer: Zmail v1.0 Message-ID: <202211141140133437292@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIHNjc2k6IHRhcmdldDogVXNlIHN5c2ZzX3N0cmVxKCkgaW5zdGVhZCBvZiBzdHJuY21wKCk=?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2AE3eC1t022476 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.14.novalocal with ID 6371B8B5.000 by FangMail milter! X-FangMail-Envelope: 1668397238/4N9ZpG44z7zjn8/6371B8B5.000/10.35.20.165/[10.35.20.165]/mxde.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6371B8B5.000/4N9ZpG44z7zjn8 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 From: Xu Panda There is a ready-to-use method to compare a retrieved from a sysfs node string with another string. It treats both NUL and newline-then-NUL as equivalent string terminations. So use it instead of manually truncating the line length in the strncmp() method. Signed-off-by: Xu Panda Signed-off-by: Yang Yang --- drivers/target/target_core_configfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index b8a5c8d6cfde..119711c2bc08 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -208,7 +208,7 @@ static struct config_group *target_core_register_fabric( * mkdir(2) system calls with known TCM fabric modules. */ - if (!strncmp(name, "iscsi", 5)) { + if (!sysfs_streq(name, "iscsi")) { /* * Automatically load the LIO Target fabric module when the * following is called: @@ -221,7 +221,7 @@ static struct config_group *target_core_register_fabric( " iscsi_target_mod.ko: %d\n", ret); return ERR_PTR(-EINVAL); } - } else if (!strncmp(name, "loopback", 8)) { + } else if (!sysfs_streq(name, "loopback")) { /* * Automatically load the tcm_loop fabric module when the * following is called: -- 2.15.2