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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230303125408.26971-2-quic_kamasrin@quicinc.com>
Date:   Fri, 3 Mar 2023 18:24:07 +0530
From:   Kamati Srinivas <quic_kamasrin@...cinc.com>
To:     <james.morse@....com>, <rric@...nel.org>, <mchehab@...nel.org>,
        <tony.luck@...el.com>, <bp@...en8.de>
CC:     <linux-edac@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <quic_stummala@...cinc.com>,
        Kamati Srinivas <quic_kamasrin@...cinc.com>
Subject: [PATCH 1/2] edac: Modify sysfs enabled values log_ue, log_ce to bool

Use kstrtobool() since simple_strtoul() is deprecated.
Also change edac_device_get_log_ue/ce return type from int to bool.

Signed-off-by: Kamati Srinivas <quic_kamasrin@...cinc.com>
---
 drivers/edac/edac_device.c       |  4 ++--
 drivers/edac/edac_device.h       |  4 ++--
 drivers/edac/edac_device_sysfs.c | 12 ++++++------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index 8c4d947fb848..ddfa094d0f3a 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -539,12 +539,12 @@ struct edac_device_ctl_info *edac_device_del_device(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(edac_device_del_device);
 
-static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev)
+static inline bool edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev)
 {
 	return edac_dev->log_ce;
 }
 
-static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev)
+static inline bool edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev)
 {
 	return edac_dev->log_ue;
 }
diff --git a/drivers/edac/edac_device.h b/drivers/edac/edac_device.h
index c4c0e0bdce14..e1645332eaa2 100644
--- a/drivers/edac/edac_device.h
+++ b/drivers/edac/edac_device.h
@@ -157,8 +157,8 @@ struct edac_device_ctl_info {
 	int dev_idx;
 
 	/* Per instance controls for this edac_device */
-	int log_ue;		/* boolean for logging UEs */
-	int log_ce;		/* boolean for logging CEs */
+	bool log_ue;		/* boolean for logging UEs */
+	bool log_ce;		/* boolean for logging CEs */
 	int panic_on_ue;	/* boolean for panic'ing on an UE */
 	unsigned poll_msec;	/* number of milliseconds to poll interval */
 	unsigned long delay;	/* number of jiffies for poll_msec */
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 5e7593753799..51a3a90d7404 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -39,10 +39,10 @@ static ssize_t edac_device_ctl_log_ue_store(struct edac_device_ctl_info
 					*ctl_info, const char *data,
 					size_t count)
 {
-	/* if parameter is zero, turn off flag, if non-zero turn on flag */
-	ctl_info->log_ue = (simple_strtoul(data, NULL, 0) != 0);
+	int ret;
 
-	return count;
+	ret = kstrtobool(data, &ctl_info->log_ue);
+	return ret ? ret : count;
 }
 
 /* 'log_ce' */
@@ -56,10 +56,10 @@ static ssize_t edac_device_ctl_log_ce_store(struct edac_device_ctl_info
 					*ctl_info, const char *data,
 					size_t count)
 {
-	/* if parameter is zero, turn off flag, if non-zero turn on flag */
-	ctl_info->log_ce = (simple_strtoul(data, NULL, 0) != 0);
+	int ret;
 
-	return count;
+	ret = kstrtobool(data, &ctl_info->log_ce);
+	return ret ? ret : count;
 }
 
 /* 'panic_on_ue' */
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ