2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

dpif-netdev: Fix length calculation of netdet_flow_key.

The 'len' of a netdev_flow_key initialized by netdev_flow_key_init()
is always zero, which may cause errors when cloning a netdev_flow_key
by netdev_flow_key_clone().

Currently the 'len' member of a netdev_flow_key initialized by
netdev_flow_key_init() is not used, so this error will not cause any
bad behavior for now.

Fixes: c82f496c3b69 ("dpif-netdev: Use unmasked key when adding datapath flows.")
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Zhiqi Chen <chenzhiqi.123@bytedance.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Zhiqi Chen 2023-08-13 17:08:14 +08:00 committed by Ilya Maximets
parent 0e98b99240
commit 785e22f876

View File

@ -3380,14 +3380,13 @@ static inline void
netdev_flow_key_init(struct netdev_flow_key *key,
const struct flow *flow)
{
uint64_t *dst = miniflow_values(&key->mf);
uint32_t hash = 0;
uint64_t value;
miniflow_map_init(&key->mf, flow);
miniflow_init(&key->mf, flow);
size_t n = dst - miniflow_get_values(&key->mf);
size_t n = miniflow_n_values(&key->mf);
FLOW_FOR_EACH_IN_MAPS (value, flow, key->mf.map) {
hash = hash_add64(hash, value);