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: <20151207064847.GA18797@mwanda>
Date:	Mon, 7 Dec 2015 09:48:47 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Saurabh Sengar <saurabh.truth@...il.com>
Cc:	w.d.hubbs@...il.com, chris@...-brannons.com, kirk@...sers.ca,
	samuel.thibault@...-lyon.org, gregkh@...uxfoundation.org,
	speakup@...ux-speakup.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: speakup: kobjects: Return the error type to
 caller

On Fri, Dec 04, 2015 at 08:12:33PM +0530, Saurabh Sengar wrote:
> 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>
> ---
>  drivers/staging/speakup/kobjects.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
> index fdfeb42..b3a83fb 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -640,7 +640,8 @@ 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)
> +		ret = kstrtol(cp, 10, &value);
> +		if (!ret)
>  			ret = spk_set_num_var(value, param, len);

Both kstrtol() and spk_set_num_var() return -ERANGE.  The next lines
expect that if we got -ERANGE, then it came from spk_set_num_var() so
they print a wrong message.

>  		else
>  			pr_warn("overflow or parsing error has occurred");
> @@ -688,6 +689,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);

Is this really true?

This function is so weird and broken.  Please look at it some more and
fix it harder with a mallet.

regards,
dan carpenter

--
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