Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753210Ab1BDVeh (ORCPT ); Fri, 4 Feb 2011 16:34:37 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:56648 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753146Ab1BDVef (ORCPT ); Fri, 4 Feb 2011 16:34:35 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=jjAU/bJUBsRa+I9/J1I7LXTVztJ/sUlgI9/tfw5jmBxaD6T8Tc5FiAkuIvVQS1xayq zimKKEDsNuUPCpWH8tMwsLseMKqu+WdPVuRXhf3t/Krry5t3yhoTBMcl2HOEErQtbFDB LqHEI04gHhxQJcjU/JFdGn/OlYEegGMHL6xlI= MIME-Version: 1.0 In-Reply-To: References: <1296851485-6730-1-git-send-email-lucian.grijincu@gmail.com> From: Lucian Adrian Grijincu Date: Fri, 4 Feb 2011 23:34:14 +0200 Message-ID: Subject: Re: [PATCH 1/6] sysctl: faster reimplementation of sysctl_check_table To: "Eric W. Biederman" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Eric Dumazet , "David S. Miller" , Octavian Purdila Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id p14LYm92030853 Content-Length: 1382 Lines: 36 On Fri, Feb 4, 2011 at 11:11 PM, Eric W. Biederman 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 ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?