Commit 26b95137 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds
Browse files

proc: skip branch in /proc/*/* lookup

Code is structured like this:

	for ( ... p < last; p++) {
		if (memcmp == 0)
	if (p >= last)

gcc doesn't see that if if lookup succeeds than post loop branch will
never be taken and skip it.

[ proc_pident_instantiate() no longer takes an inode*]

Signed-off-by: default avatarAlexey Dobriyan <>
Reviewed-by: default avatarAndrew Morton <>
Cc: Al Viro <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 37a4094e
...@@ -2439,14 +2439,11 @@ static struct dentry *proc_pident_lookup(struct inode *dir, ...@@ -2439,14 +2439,11 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
for (p = ents; p < last; p++) { for (p = ents; p < last; p++) {
if (p->len != dentry->d_name.len) if (p->len != dentry->d_name.len)
continue; continue;
if (!memcmp(dentry->, p->name, p->len)) if (!memcmp(dentry->, p->name, p->len)) {
res = proc_pident_instantiate(dentry, task, p);
break; break;
} }
if (p >= last)
goto out;
res = proc_pident_instantiate(dentry, task, p);
put_task_struct(task); put_task_struct(task);
out_no_task: out_no_task:
return res; return res;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment