
+#define CHECK_NULL(ptr) do { if (!(ptr)) return -EINVAL; } while (0)

static int xdp_do_generic_redirect_map(struct net_device *dev,
				       struct sk_buff *skb,
				       struct xdp_buff *xdp,
				       struct bpf_prog *xdp_prog,
				       void *fwd,
				       enum bpf_map_type map_type, u32 map_id)
{
+	CHECK_NULL(xdp_prog);

	struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info);
	// ... rest of the function
