[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B796B70.2050102@trash.net>
Date: Mon, 15 Feb 2010 16:42:40 +0100
From: Patrick McHardy <kaber@...sh.net>
To: jamal <hadi@...erus.ca>
CC: timo.teras@....fi, herbert@...dor.apana.org.au,
davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [net-next-2.6 PATCH 1/7] xfrm: introduce basic mark infrastructure
jamal wrote:
> +static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_kmark *m)
> +{
> + if (attrs[XFRMA_MARK])
> + memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m));
> + else
> + m->v = m->m = 0;
> +
> + return m->v & m->m;
> +}
> +
> +static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_kmark *m)
> +{
> + if (m->m & m->v)
> + NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_kmark), m);
This doesn't look right. A mark value of 0 with a mask of ~0 won't
be properly dumped. I think this should check for (m->m | m->v).
> + return 0;
> +
> +nla_put_failure:
> + return -1;
> +}
> +
> #endif /* _NET_XFRM_H */
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists