From: Thomas Graf Date: Tue, 2 Apr 2013 22:30:43 +0000 (+0200) Subject: openvswitch: Don't insert empty OVS_VPORT_ATTR_OPTIONS attribute X-Git-Tag: MMI-PSA29.97-13-9~14469^2~111^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5d9633523f27dfcaac2d6052c7b3278311f77949;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git openvswitch: Don't insert empty OVS_VPORT_ATTR_OPTIONS attribute The port specific options are currently unused resulting in an empty OVS_VPORT_ATTR_OPTIONS nested attribute being inserted into every OVS_VPORT_CMD_GET message. Don't insert OVS_VPORT_ATTR_OPTIONS if no options are present. Signed-off-by: Thomas Graf Signed-off-by: Jesse Gross --- diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index f6b8132ce4cb..71a2de8726cb 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c @@ -301,17 +301,19 @@ void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats) int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb) { struct nlattr *nla; + int err; + + if (!vport->ops->get_options) + return 0; nla = nla_nest_start(skb, OVS_VPORT_ATTR_OPTIONS); if (!nla) return -EMSGSIZE; - if (vport->ops->get_options) { - int err = vport->ops->get_options(vport, skb); - if (err) { - nla_nest_cancel(skb, nla); - return err; - } + err = vport->ops->get_options(vport, skb); + if (err) { + nla_nest_cancel(skb, nla); + return err; } nla_nest_end(skb, nla);