Commit bc239eb2 authored by Dan Carpenter's avatar Dan Carpenter Committed by Daniel Borkmann

bpf: Remove unnecessary loop in task_file_seq_get_next()

After commit 0ede61d8 ("file: convert to SLAB_TYPESAFE_BY_RCU") this
loop always iterates exactly one time.  Delete the for statement and pull
the code in a tab.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Acked-by: default avatarYonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/ZoWJF51D4zWb6f5t@stanley.mountain
parent a5912c37
......@@ -261,6 +261,7 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info)
u32 saved_tid = info->tid;
struct task_struct *curr_task;
unsigned int curr_fd = info->fd;
struct file *f;
/* If this function returns a non-NULL file object,
* it held a reference to the task/file.
......@@ -286,12 +287,8 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info)
}
rcu_read_lock();
for (;; curr_fd++) {
struct file *f;
f = task_lookup_next_fdget_rcu(curr_task, &curr_fd);
if (!f)
break;
if (f) {
/* set info->fd */
info->fd = curr_fd;
rcu_read_unlock();
......
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