On 08/06/2023 10:42, Zachary Leaf wrote:
[...]
@@ -4241,20 +4251,20 @@ static int bpf_prog_get_info_by_fd(struct file *file, ulen = info.nr_prog_tags; info.nr_prog_tags = prog->aux->func_cnt ? : 1; if (ulen) {
__u8 __user (*user_prog_tags)[BPF_TAG_SIZE];
u32 i;__u8 __user *user_prog_tags;
user_prog_tags = u64_to_user_ptr(info.prog_tags);
ulen = min_t(u32, info.nr_prog_tags, ulen); if (prog->aux->func_cnt) { for (i = 0; i < ulen; i++) {user_prog_tags = (__u8 __user *)info.prog_tags;
if (copy_to_user(user_prog_tags[i],
if (copy_to_user(user_prog_tags+i,
Nit: &user_prog_tags[i] would be slightly more idiomatic (and closer to the original code). Similarly &user_prog_tags[0] could be used below.
Kevin
prog->aux->func[i]->tag, BPF_TAG_SIZE)) return -EFAULT; } } else {
if (copy_to_user(user_prog_tags[0],
}if (copy_to_user(user_prog_tags, prog->tag, BPF_TAG_SIZE)) return -EFAULT;