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  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]
Date:   Sat, 13 Jan 2018 11:15:39 +0530
From:   Sumit Pundir <pundirsumit11@...il.com>
To:     oleg.drokin@...el.com
Cc:     andreas.dilger@...el.com, jsimmons@...radead.org,
        gregkh@...uxfoundation.org, lustre-devel@...ts.lustre.org,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: lustre: lmv: prefer kstrto<type> to single variable sscanf

A kstrto<type> should be preferred for a single variable instead
of sscanf to convert string to the the required datatype.
Issue reported by checkpatch.pl

Signed-off-by: Sumit Pundir <pundirsumit11@...il.com>
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index c2c57f6..09ed154 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -1319,14 +1319,16 @@ static int lmv_process_config(struct obd_device *obd, u32 len, void *buf)
 
 		obd_str2uuid(&obd_uuid,  lustre_cfg_buf(lcfg, 1));
 
-		if (sscanf(lustre_cfg_buf(lcfg, 2), "%u", &index) != 1) {
-			rc = -EINVAL;
+		rc = kstrtou32(lustre_cfg_buf(lcfg, 2), 0, &index);
+
+		if (rc)
 			goto out;
-		}
-		if (sscanf(lustre_cfg_buf(lcfg, 3), "%d", &gen) != 1) {
-			rc = -EINVAL;
+
+		rc = kstrtoint(lustre_cfg_buf(lcfg, 3), 0, &gen);
+
+		if (rc)
 			goto out;
-		}
+
 		rc = lmv_add_target(obd, &obd_uuid, index, gen);
 		goto out;
 	default:
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux - Powered by OpenVZ