Skip to content

Commit dded45f

Browse files
tgrafjessegross
authored andcommitted
openvswitch: Specify the minimal length of OVS_PACKET_ATTR_PACKET in the policy
Specifying the minimal length in the policy makes it reuseable and documents the interface. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Jesse Gross <jesse@nicira.com>
1 parent f498354 commit dded45f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎net/openvswitch/datapath.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
662662

663663
err = -EINVAL;
664664
if (!a[OVS_PACKET_ATTR_PACKET] || !a[OVS_PACKET_ATTR_KEY] ||
665-
!a[OVS_PACKET_ATTR_ACTIONS] ||
666-
nla_len(a[OVS_PACKET_ATTR_PACKET]) < ETH_HLEN)
665+
!a[OVS_PACKET_ATTR_ACTIONS])
667666
goto err;
668667

669668
len = nla_len(a[OVS_PACKET_ATTR_PACKET]);
@@ -744,7 +743,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info)
744743
}
745744

746745
static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
747-
[OVS_PACKET_ATTR_PACKET] = { .type = NLA_UNSPEC },
746+
[OVS_PACKET_ATTR_PACKET] = { .len = ETH_HLEN },
748747
[OVS_PACKET_ATTR_KEY] = { .type = NLA_NESTED },
749748
[OVS_PACKET_ATTR_ACTIONS] = { .type = NLA_NESTED },
750749
};

0 commit comments

Comments
 (0)