]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
sysctl: A more obvious version of grab_header.
authorEric W. Biederman <ebiederm@xmission.com>
Sat, 7 Jan 2012 14:57:47 +0000 (06:57 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 25 Jan 2012 00:40:28 +0000 (16:40 -0800)
Instead of relying on sysct_head_next(NULL) to magically
return the right header for the root directory instead
explicitly transform NULL into the root directories header.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
fs/proc/proc_sysctl.c

index e573f9b4f22e56bea0231e269148848372faddc4..15444850b3e8e839ff77334e0c36d55e40a9b877 100644 (file)
@@ -267,10 +267,10 @@ static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name)
 
 static struct ctl_table_header *grab_header(struct inode *inode)
 {
-       if (PROC_I(inode)->sysctl)
-               return sysctl_head_grab(PROC_I(inode)->sysctl);
-       else
-               return sysctl_head_next(NULL);
+       struct ctl_table_header *head = PROC_I(inode)->sysctl;
+       if (!head)
+               head = &root_table_header;
+       return sysctl_head_grab(head);
 }
 
 static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,