lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202211170950093878676@zte.com.cn>
Date:   Thu, 17 Nov 2022 09:50:09 +0800 (CST)
From:   <guo.ziliang@....com.cn>
To:     <target-devel@...r.kernel.org>
Cc:     <martin.petersen@...cle.com>, <linux-scsi@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <guo.ziliang@....com.cn>
Subject: [PATCH linux-next] scsi: target: Use sysfs_streq instead of strncmp

From: guo ziliang <guo.ziliang@....com.cn>
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: guo ziliang <guo.ziliang@....com.cn>
---
 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 f4a220a..3b89d83 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:
--
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ