Although today only classifier offloads call block callbacks, we shouldn't really assume that @type_data starts with struct tc_cls_common_offload until we validated the type.
Signed-off-by: Jakub Kicinski <jakub.kicin...@netronome.com> --- drivers/net/ethernet/netronome/nfp/bpf/main.c | 5 +---- drivers/net/netdevsim/bpf.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/bpf/main.c b/drivers/net/ethernet/netronome/nfp/bpf/main.c index 552e2657b536..165276b50b4c 100644 --- a/drivers/net/ethernet/netronome/nfp/bpf/main.c +++ b/drivers/net/ethernet/netronome/nfp/bpf/main.c @@ -125,11 +125,8 @@ static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type, struct nfp_bpf_vnic *bv; int err; - if (type != TC_SETUP_CLSBPF) { - NL_SET_ERR_MSG_MOD(cls_bpf->common.extack, - "only offload of BPF classifiers supported"); + if (type != TC_SETUP_CLSBPF) return -EOPNOTSUPP; - } if (!tc_can_offload_cls(nn->dp.netdev, &cls_bpf->common)) return -EOPNOTSUPP; if (!nfp_net_ebpf_capable(nn)) { diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c index bbcb8ec42208..5b2c5260624d 100644 --- a/drivers/net/netdevsim/bpf.c +++ b/drivers/net/netdevsim/bpf.c @@ -129,11 +129,8 @@ int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type, struct netdevsim *ns = cb_priv; struct bpf_prog *oldprog; - if (type != TC_SETUP_CLSBPF) { - NSIM_EA(cls_bpf->common.extack, - "only offload of BPF classifiers supported"); + if (type != TC_SETUP_CLSBPF) return -EOPNOTSUPP; - } if (!tc_can_offload_cls(ns->netdev, &cls_bpf->common)) return -EOPNOTSUPP; -- 2.15.1