[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMAnk5Kl3qp17fko@corigine.com>
Date: Tue, 25 Jul 2023 21:50:43 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Ratheesh Kannoth <rkannoth@...vell.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, jhs@...atatu.com,
xiyou.wangcong@...il.com, jiri@...nulli.us, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com
Subject: Re: [PATCH net-next] flow_dissector: Add IPSEC dissectors
On Tue, Jul 25, 2023 at 08:54:51AM +0530, Ratheesh Kannoth wrote:
...
> diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
> index 8664ed4fbbdf..ffec739f049a 100644
> --- a/include/net/flow_dissector.h
> +++ b/include/net/flow_dissector.h
> @@ -301,6 +301,14 @@ struct flow_dissector_key_l2tpv3 {
> __be32 session_id;
> };
>
> +/**
> + * struct flow_dissector_key_ipsec:
> + * @spi: identifier for a ipsec connection
> + */
> +struct flow_dissector_key_ipsec {
> + __be32 spi;
> +};
> +
> /**
> * struct flow_dissector_key_cfm
> * @mdl_ver: maintenance domain level (mdl) and cfm protocol version
> @@ -353,6 +361,7 @@ enum flow_dissector_key_id {
> FLOW_DISSECTOR_KEY_NUM_OF_VLANS, /* struct flow_dissector_key_num_of_vlans */
> FLOW_DISSECTOR_KEY_PPPOE, /* struct flow_dissector_key_pppoe */
> FLOW_DISSECTOR_KEY_L2TPV3, /* struct flow_dissector_key_l2tpv3 */
> + FLOW_DISSECTOR_KEY_IPSEC, /* struct flow_dissector_key_ipsec */
> FLOW_DISSECTOR_KEY_CFM, /* struct flow_dissector_key_cfm */
>
> FLOW_DISSECTOR_KEY_MAX,
...
Hi Ratheesh,
With this change, this enum now has 33 values, excluding
FLOW_DISSECTOR_KEY_MAX. I.e the range of values is from 0 to 32.
But dissector_uses_key() looks like this:
static inline bool dissector_uses_key(const struct flow_dissector *flow_dissector,
enum flow_dissector_key_id key_id)
{
return flow_dissector->used_keys & (1 << key_id);
}
And the type of the used_keys field of struct flow_dissector
is unsigned int, a 32bit entity.
So an overflow will now occur if key_id is FLOW_DISSECTOR_KEY_CFM.
This is flagged by Sparse.
--
pw-bot: changes-requested
Powered by blists - more mailing lists