Skip to contentSkip to conversation

xfrm: fix XFRMA_MARK extraction in xfrm_mark_get

PATCH Applied Andreas Steffen 3 participants 3 messages Jun 30, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfrm: fix XFRMA_MARK extraction in xfrm_mark_get

Determine the size of the xfrm_mark struct, not of its pointer.

---
 include/net/xfrm.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/net/xfrm.h +1 -1
index 1913af6..fc8f36d 100644
@@ -1586,7 +1586,7 @@ static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb)
 static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
 {
 	if (attrs[XFRMA_MARK])
-		memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(m));
+		memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(struct xfrm_mark));
 	else
 		m->v = m->m = 0;
 
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Andreas Steffen

Determine the size of the xfrm_mark struct, not of its pointer.

Good catch (you are right this was tested on 64 bit ;->). The preferred style would be what Simon mentioned. No biggie if you keep it this way - but if you resubmit, add:

cheers,
jamal