diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2011-06-10 01:36:05 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-01-24 19:37:54 -0500 |
commit | 36885d7b1121c779e4060d45472fe53a5b21e09f (patch) | |
tree | 8f4717d0308045e9478fd6a1a11a3d8153647a72 /fs/proc/proc_sysctl.c | |
parent | dcd6c92267155e70a94b3927bce681ce74b80d1f (diff) |
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.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index a6b62173d4c3..d82f4a8b4b80 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -59,17 +59,11 @@ out: | |||
59 | 59 | ||
60 | static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name) | 60 | static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name) |
61 | { | 61 | { |
62 | int len; | ||
63 | for ( ; p->procname; p++) { | 62 | for ( ; p->procname; p++) { |
64 | 63 | if (strlen(p->procname) != name->len) | |
65 | if (!p->procname) | ||
66 | continue; | ||
67 | |||
68 | len = strlen(p->procname); | ||
69 | if (len != name->len) | ||
70 | continue; | 64 | continue; |
71 | 65 | ||
72 | if (memcmp(p->procname, name->name, len) != 0) | 66 | if (memcmp(p->procname, name->name, name->len) != 0) |
73 | continue; | 67 | continue; |
74 | 68 | ||
75 | /* I have a match */ | 69 | /* I have a match */ |
@@ -266,10 +260,6 @@ static int scan(struct ctl_table_header *head, ctl_table *table, | |||
266 | for (; table->procname; table++, (*pos)++) { | 260 | for (; table->procname; table++, (*pos)++) { |
267 | int res; | 261 | int res; |
268 | 262 | ||
269 | /* Can't do anything without a proc name */ | ||
270 | if (!table->procname) | ||
271 | continue; | ||
272 | |||
273 | if (*pos < file->f_pos) | 263 | if (*pos < file->f_pos) |
274 | continue; | 264 | continue; |
275 | 265 | ||