Re: [PATCH] parse_table() earlier check.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 20, 2007 at 12:37:45PM +0900, Tetsuo Handa wrote:
> --- linux-2.6.22-orig/kernel/sysctl.c
> +++ linux-2.6.22/kernel/sysctl.c
> @@ -1190,9 +1190,9 @@
>  		return -ENOTDIR;
>  	if (get_user(n, name))
>  		return -EFAULT;
> +	if (!n)
> +		return -ENOTDIR;
>  	for ( ; table->ctl_name || table->procname; table++) {
> -		if (!table->ctl_name)
> -			continue;
>  		if (n == table->ctl_name) {
>  			int error;
>  			if (table->child) {

I don't like this. For one, it destroy some symmetry in sysctl table
walking code, where sysctl(2) code checks for valid ->ctl_name, and proc
code checks for valid ->procname and both have same for loop. For two,
nobody uses sysctl(2), sysctl aren't big, so this optimization is
unneeded.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux