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: <20070730171306.49b49818.akpm@linux-foundation.org>
Date:	Mon, 30 Jul 2007 17:13:06 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Satyam Sharma <satyam@...radead.org>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Keiichi Kii <k-keiichi@...jp.nec.com>,
	Netdev <netdev@...r.kernel.org>,
	Joel Becker <joel.becker@...cle.com>,
	Matt Mackall <mpm@...enic.com>,
	David Miller <davem@...emloft.net>
Subject: Re: [PATCH v3 -mm 9/9] netconsole: Support dynamic reconfiguration
 using configfs

On Mon, 30 Jul 2007 08:19:10 +0530
Satyam Sharma <satyam@...radead.org> wrote:

> +/*
> + * Wrapper over simple_strtol (base 10) with sanity and range checking.
> + * We return (signed) long only because we may want to return errors.
> + * Do not use this to convert numbers that are allowed to be negative.
> + */
> +static long strtol10_check_range(const char *cp, long min, long max)
> +{
> +	long ret;
> +	char *p = (char *) cp;
> +
> +	WARN_ON(min < 0);
> +	WARN_ON(max < min);
> +
> +	ret = simple_strtol(p, &p, 10);
> +
> +	if (*p && (*p != '\n')) {
> +		printk(KERN_ERR "netconsole: invalid input\n");
> +		return -EINVAL;
> +	}
> +	if ((ret < min) || (ret > max)) {
> +		printk(KERN_ERR "netconsole: input %ld must be between "
> +				"%ld and %ld\n", ret, min, max);
> +		return -EINVAL;
> +	}
> +
> +	return ret;
> +}

There's probably other code around the place which does this.  It might
be worth making this function a general-purpose thing.
-
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