Re: [PATCH 2/3] bpf: Remove dead variable

From: Richard Weinberger
Date: Mon Oct 16 2017 - 15:22:11 EST


Am Montag, 16. Oktober 2017, 21:11:47 CEST schrieb Daniel Borkmann:
> > I can squash it into 1/3, I kept it that way because
> > even without 1/3 this variable is unused.
>
> Hmm, the helper looks like the below. In patch 1/3 you removed
> the 'if (unlikely(!task))' test where the variable was used before,
> so 2/3 without the 1/3 would result in a compile error.

Why a compile error? It emits a warning.

> BPF_CALL_0(bpf_get_current_uid_gid)
> {
> struct task_struct *task = current;
> kuid_t uid;
> kgid_t gid;
>
> if (unlikely(!task))
> return -EINVAL;

Well, this is the only "user". Okay.

> current_uid_gid(&uid, &gid);

Here we use current. So, task was always in vain.

So, I can happily squash 2/3 into 1/3 and resent.
The series just represented the way I've worked on the code...

Thanks,
//richard