From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Shtylyov Subject: Re: [PATCH net 1/5] openvswitch: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed Date: Mon, 03 Feb 2014 20:43:58 +0400 Message-ID: <52EFC74E.8040906@cogentembedded.com> References: <1391389686-34303-1-git-send-email-jesse@nicira.com> <1391389686-34303-2-git-send-email-jesse@nicira.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dev-yBygre7rU0SM8Zsap4Y0gw@public.gmane.org To: Jesse Gross , David Miller Return-path: In-Reply-To: <1391389686-34303-2-git-send-email-jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dev-bounces-yBygre7rU0TnMu66kgdUjQ@public.gmane.org Errors-To: dev-bounces-yBygre7rU0TnMu66kgdUjQ@public.gmane.org List-Id: netdev.vger.kernel.org Hello. On 03-02-2014 5:08, Jesse Gross wrote: > From: Thomas Graf > While the zerocopy method is correctly omitted if user space > does not support unaligned Netlink messages. The attribute is > still not padded correctly as skb_zerocopy() will not ensure > padding and the attribute size is no longer pre calculated > though nla_reserve() which ensured padding previously. > This patch applies appropriate padding if a linear data copy > was performed in skb_zerocopy(). > Signed-off-by: Thomas Graf > Acked-by: Zoltan Kiss > Signed-off-by: Jesse Gross > --- > net/openvswitch/datapath.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c > index df46928..3ca9121 100644 > --- a/net/openvswitch/datapath.c > +++ b/net/openvswitch/datapath.c [...] > @@ -466,6 +466,11 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb, > > skb_zerocopy(user_skb, skb, skb->len, hlen); > > + /* Pad OVS_PACKET_ATTR_PACKET if linear copy was performed */ > + if (!(dp->user_features & OVS_DP_F_UNALIGNED) && > + (plen = (ALIGN(user_skb->len, NLA_ALIGNTO) - user_skb->len)) > 0) This shouldn't pass checkpatch.pl which complains about assignments inside *if* statements. WBR, Sergei