diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 5924a01e3c..32ebeff09f 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -967,7 +967,8 @@ enic_copy_item_raw_v2(struct copy_item_args *arg) if (!spec->relative || spec->offset != 0 || spec->search || spec->limit) return EINVAL; /* Need non-null pattern that fits within the NIC's filter pattern */ - if (spec->length == 0 || spec->length > FILTER_GENERIC_1_KEY_LEN || + if (spec->length == 0 || + spec->length + sizeof(struct udp_hdr) > FILTER_GENERIC_1_KEY_LEN || !spec->pattern || !mask->pattern) return EINVAL; /*