Re: [PATCH bpf-next v3 2/7] bpf: Enable cpumasks to be queried and used as kptrs

From: Alexei Starovoitov
Date: Wed Jan 25 2023 - 11:02:10 EST


On Wed, Jan 25, 2023 at 6:38 AM David Vernet <void@xxxxxxxxxxxxx> wrote:
> +
> +void bpf_cpumask_set_cpu(u32 cpu, struct bpf_cpumask *cpumask)
> +{
> + if (!cpu_valid(cpu))
> + return;
> +
> + cpumask_set_cpu(cpu, (struct cpumask *)cpumask);

I was considering suggesting to use &cpumask->cpumask here and
in other cases, but figured it's better to leave it as-is,
since bpf prog will be doing this cast, so it matches.
Maybe some build assertion is necessary to make sure it's the first member.
Probably overkill as well.

Applied.