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: <4EDB5E70.5000209@googlemail.com>
Date:	Sun, 04 Dec 2011 11:50:08 +0000
From:	Alan Jenkins <alan.christopher.jenkins@...glemail.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Daniel Drake <dsd@...top.org>
CC:	x86@...nel.org, mingo@...hat.com, hpa@...or.com,
	tglx@...utronix.de, dilinger@...ued.net,
	linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org
Subject: Re: Re: [PATCH resend 2] x86, olpc-xo15-sci: Enable lid close wakeup
 control through sysfs

On 01/-10/37 20:59, Andrew Morton wrote:
> Let me fix that for you.
>
> --- a/arch/x86/platform/olpc/olpc-xo15-sci.c~x86-olpc-xo15-sci-enable-lid-close-wakeup-control-through-sysfs-fix
> +++ a/arch/x86/platform/olpc/olpc-xo15-sci.c
> @@ -58,7 +58,8 @@ static ssize_t lid_wake_on_close_store(s
>   				       const char *buf, size_t n)
>   {
>   	unsigned int val;
> -	if (!sscanf(buf, "%u",&val) == 1)
> +
> +	if (sscanf(buf, "%u",&val) != 1)
>   		return -EINVAL;
>
>   	set_lid_wake_behavior(!!val);
>
> It's kinda irritating that this will cheerfully accept bogus input of
> the form "42foo".  This happens about eleven billion times in sysfs
> write() handlers but afaik we've never implemented a nice
> sysfs_int_from_buffer() thingy which handles all the possible errors.

I thought there was.

strict_strtoul() ?

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