summaryrefslogtreecommitdiff
path: root/fs/proc/proc_sysctl.c
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2011-06-10 05:36:05 (GMT)
committerEric W. Biederman <ebiederm@xmission.com>2012-01-25 00:37:54 (GMT)
commit36885d7b1121c779e4060d45472fe53a5b21e09f (patch)
tree8f4717d0308045e9478fd6a1a11a3d8153647a72 /fs/proc/proc_sysctl.c
parentdcd6c92267155e70a94b3927bce681ce74b80d1f (diff)
downloadlinux-fsl-qoriq-36885d7b1121c779e4060d45472fe53a5b21e09f.tar.xz
sysctl: remove impossible condition check
Remove checks for conditions that will never happen. If procname is NULL the loop would already had bailed out, so there's no need to check it again. At the same time this also compacts the function find_in_table() by refactoring it to be easier to read. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi> Reviewed-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
-rw-r--r--fs/proc/proc_sysctl.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index a6b6217..d82f4a8 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -59,17 +59,11 @@ out:
static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name)
{
- int len;
for ( ; p->procname; p++) {
-
- if (!p->procname)
- continue;
-
- len = strlen(p->procname);
- if (len != name->len)
+ if (strlen(p->procname) != name->len)
continue;
- if (memcmp(p->procname, name->name, len) != 0)
+ if (memcmp(p->procname, name->name, name->len) != 0)
continue;
/* I have a match */
@@ -266,10 +260,6 @@ static int scan(struct ctl_table_header *head, ctl_table *table,
for (; table->procname; table++, (*pos)++) {
int res;
- /* Can't do anything without a proc name */
- if (!table->procname)
- continue;
-
if (*pos < file->f_pos)
continue;