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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080327232252.20764ac4.akpm@linux-foundation.org>
Date:	Thu, 27 Mar 2008 23:22:52 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	NeilBrown <neilb@...e.de>
Cc:	linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
	Dan Williams <dan.j.williams@...el.com>
Subject: Re: [PATCH] md: Subject: introduce get_priority_stripe() to improve
 raid456 write performance

On Fri, 28 Mar 2008 16:45:28 +1100 NeilBrown <neilb@...e.de> wrote:

> +static ssize_t
> +raid5_store_preread_threshold(mddev_t *mddev, const char *page, size_t len)
> +{
> +	raid5_conf_t *conf = mddev_to_conf(mddev);
> +	char *end;
> +	int new;
> +	if (len >= PAGE_SIZE)
> +		return -EINVAL;
> +	if (!conf)
> +		return -ENODEV;
> +
> +	new = simple_strtoul(page, &end, 10);
> +	if (!*page || (*end && *end != '\n'))
> +		return -EINVAL;
> +	if (new > conf->max_nr_stripes || new < 0)
> +		return -EINVAL;
> +	conf->bypass_threshold = new;
> +	return len;
> +}

checkpatch 0.16 (which I misfiled and have thus far failed to merge up)
sayeth:

WARNING: consider using strict_strtoul in preference to simple_strtoul
#258: FILE: drivers/md/raid5.c:4090:
+       new = simple_strtoul(page, &end, 10);

the reason being that code which uses simple_strtoul() can treat
"42-what-a-todo" as "42", which seems a bit sloppy.

Your code won't have that failing, because it explicitly checks that the
input ended in \0 or \n.  But strict_strtoul() internally does that, so this
open-coded test could be removed.

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