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] [day] [month] [year] [list]
Date:	Mon,  7 Dec 2015 15:29:58 +0530
From:	Saurabh Sengar <saurabh.truth@...il.com>
To:	dan.carpenter@...cle.com, devel@...verdev.osuosl.org,
	kirk@...sers.ca, gregkh@...uxfoundation.org,
	speakup@...ux-speakup.org, linux-kernel@...r.kernel.org,
	samuel.thibault@...-lyon.com, chris@...-brannons.com
Cc:	Saurabh Sengar <saurabh.truth@...il.com>
Subject: [PATCH v2] Staging: speakup: kobjects: Return the error type to caller

Inorder to notify the user that value is not successfuly set in sys
entry, error should be returned from store function instead of count

Signed-off-by: Saurabh Sengar <saurabh.truth@...il.com>
---
v2:
Hi Dan,
I will look more into this function in my free time.
For now just sending you this patch fixing ERANGE as commented
 drivers/staging/speakup/kobjects.c | 4 +++-
 drivers/staging/staging.c          | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index fdfeb42..509163c 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -640,7 +640,7 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr,
 			len = E_INC;
 		else
 			len = E_SET;
-		if (kstrtol(cp, 10, &value) == 0)
+		if (!kstrtol(cp, 10, &value))
 			ret = spk_set_num_var(value, param, len);
 		else
 			pr_warn("overflow or parsing error has occurred");
@@ -688,6 +688,8 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr,
 
 	if (ret == -ERESTART)
 		pr_info("%s reset to default value\n", param->name);
+	else if (ret < 0)
+		return ret;
 	return count;
 }
 EXPORT_SYMBOL_GPL(spk_var_store);
diff --git a/drivers/staging/staging.c b/drivers/staging/staging.c
index 233e589..36dd594 100644
--- a/drivers/staging/staging.c
+++ b/drivers/staging/staging.c
@@ -2,12 +2,12 @@
 #include <linux/init.h>
 #include <linux/module.h>
 
-static int __init staging_init(void)
+static int staging_init(void)
 {
 	return 0;
 }
 
-static void __exit staging_exit(void)
+static void staging_exit(void)
 {
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ