[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTinALtUX=uBGtCiVjyEMQJZ0O_Fc39nu3d1zSKkB@mail.gmail.com>
Date: Fri, 4 Feb 2011 23:34:14 +0200
From: Lucian Adrian Grijincu <lucian.grijincu@...il.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Eric Dumazet <eric.dumazet@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Octavian Purdila <opurdila@...acom.com>
Subject: Re: [PATCH 1/6] sysctl: faster reimplementation of sysctl_check_table
On Fri, Feb 4, 2011 at 11:11 PM, Eric W. Biederman
<ebiederm@...ssion.com> wrote:
>> +static int __sysctl_check_table(struct nsproxy *namespaces,
>> + struct ctl_table *table, struct ctl_table **parents, int depth)
>> {
>> + const char *fail = NULL;
>> int error = 0;
>> +
>> + if (depth >= CTL_MAXNAME) {
>
> This should be depth > CTL_MAXNAME. Because there are only CTL_MAXNAME
> entries in the array.
A bit lower in the array we access 'parents[depth]'.
So the correct check should be (depth >= CTL_MAXNAME) => error.
>> - sysctl_check_leaf(namespaces, table, &fail);
>> + parents[depth] = table;
>> + sysctl_check_leaf(namespaces, table, &fail,
>> + parents, depth);
>> }
>> + if (table->child) {
>> + parents[depth] = table;
>> + error |= __sysctl_check_table(namespaces, table->child,
>> + parents, depth + 1);
>> + }
--
.
..: Lucian
Powered by blists - more mailing lists