Re: [PATCH bpf-next v6 05/17] bpf: Introduce device-bound XDP programs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/4/23 1:59 PM, Stanislav Fomichev wrote:
@@ -199,12 +197,12 @@ int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr)
  	    attr->prog_type != BPF_PROG_TYPE_XDP)
  		return -EINVAL;
- if (attr->prog_flags)
+	if (attr->prog_flags & ~BPF_F_XDP_DEV_BOUND_ONLY)
  		return -EINVAL;
- offload = kzalloc(sizeof(*offload), GFP_USER);

The kzalloc is still needed. Although a latter patch added it bad, it is better not to miss it in the first place.

-	if (!offload)
-		return -ENOMEM;
+	if (attr->prog_type == BPF_PROG_TYPE_SCHED_CLS &&
+	    attr->prog_flags & BPF_F_XDP_DEV_BOUND_ONLY)
+		return -EINVAL;
offload->prog = prog;




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux