linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: sysctl: register only tables of sysctl files
@ 2012-01-30 13:39 Dan Carpenter
  2012-01-30 13:49 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-01-30 13:39 UTC (permalink / raw)
  To: ebiederm; +Cc: linux-kernel

Hi Eric,

The patch f728019bb72e: "sysctl: register only tables of sysctl 
files" from Jan 22, 2012, has a weird thing going on and I don't know
how to fix it:

+       if (nr_dirs && nr_files) {
+               struct ctl_table *new;
+               files = kzalloc(sizeof(struct ctl_table) * (nr_files + 1),
+                               GFP_KERNEL);
+               if (!files)
+                       goto out;
+
+               ctl_table_arg = files;
+               for (new = files, entry = table; entry->procname; entry++) {
+                       if (entry->child)
+                               continue;
+                       *new = *entry;
+                       new++;
+               }
+       }
+
+       /* Register everything except a directory full of subdirectories */
+       if (nr_files || !nr_dirs) {
+               struct ctl_table_header *header;
+               header = __register_sysctl_table(root, namespaces, path, files);
+               if (!header) {
+                       kfree(ctl_table_arg);
                              ^^^^^^^^^^^^^
+                       goto out;
+               }
+
+               /* Remember if we need to free the file table */
+               header->ctl_table_arg = ctl_table_arg;
                                        ^^^^^^^^^^^^^
These are NULL unless "nr_dirs" is non-zero (so it's always NULL here).

+               **subheader = header;
+               (*subheader)++;
+       }

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sysctl: register only tables of sysctl files
  2012-01-30 13:39 sysctl: register only tables of sysctl files Dan Carpenter
@ 2012-01-30 13:49 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2012-01-30 13:49 UTC (permalink / raw)
  To: ebiederm; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

On Mon, Jan 30, 2012 at 04:39:33PM +0300, Dan Carpenter wrote:
> +       /* Register everything except a directory full of subdirectories */
> +       if (nr_files || !nr_dirs) {

Crap... Forget about this.  For some reason I missed that his was an
OR, not an AND.  Sorry for the noise.

regards,
dan carpenter


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-30 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-30 13:39 sysctl: register only tables of sysctl files Dan Carpenter
2012-01-30 13:49 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).