Skip to contentSkip to conversation

: Sub-policies beautification

PATCH Applied jamal 3 participants 5 messages Nov 17, 2006 – Nov 21, 2006

Subsystems (3)
lore
Share & tools
lore

jamal

author
#0 lore raw

PATCH 1/2 : Sub-policies beautification

First one

cheers,
jamal

[XFRM]: Make copy_to_user_policy_type take a type Make copy_to_user_policy_type take a type instead a policy and fix its users to pass the type

---
commit 5e6a47d1e7baabd38cca9d01f3d78ae1319db535
tree cb4b19b38076cdf545a591ae9d5d6ecd8849c0bc
parent c3d793454ab2a36c2d618d226d7de975ab9b7570
author Jamal Hadi Salim <[email protected]> Fri, 17 Nov 2006 08:52:26 -0500 committer Jamal Hadi Salim <hadi@jzny2.(none)> Fri, 17 Nov 2006 08:52:26 -0500

 net/xfrm/xfrm_user.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
net/xfrm/xfrm_user.c +7 -7
index c4cde57..3c34385 100644
@@ -1082,12 +1082,12 @@ static inline int copy_to_user_sec_ctx(s
 }
 
 #ifdef CONFIG_XFRM_SUB_POLICY
-static int copy_to_user_policy_type(struct xfrm_policy *xp, struct sk_buff *skb)
+static int copy_to_user_policy_type(__u8 type, struct sk_buff *skb)
 {
 	struct xfrm_userpolicy_type upt;
 
 	memset(&upt, 0, sizeof(upt));
-	upt.type = xp->type;
+	upt.type = type;
 
 	RTA_PUT(skb, XFRMA_POLICY_TYPE, sizeof(upt), &upt);
 
@@ -1098,7 +1098,7 @@ rtattr_failure:
 }
 
 #else
-static inline int copy_to_user_policy_type(struct xfrm_policy *xp, struct sk_buff *skb)
+static inline int copy_to_user_policy_type(__u8 type, struct sk_buff *skb)
 {
 	return 0;
 }
@@ -1127,7 +1127,7 @@ static int dump_one_policy(struct xfrm_p
 		goto nlmsg_failure;
 	if (copy_to_user_sec_ctx(xp, skb))
 		goto nlmsg_failure;
-	if (copy_to_user_policy_type(xp, skb) < 0)
+	if (copy_to_user_policy_type(xp->type, skb) < 0)
 		goto nlmsg_failure;
 
 	nlh->nlmsg_len = skb->tail - b;
@@ -1907,7 +1907,7 @@ static int build_acquire(struct sk_buff 
 		goto nlmsg_failure;
 	if (copy_to_user_state_sec_ctx(x, skb))
 		goto nlmsg_failure;
-	if (copy_to_user_policy_type(xp, skb) < 0)
+	if (copy_to_user_policy_type(xp->type, skb) < 0)
 		goto nlmsg_failure;
 
 	nlh->nlmsg_len = skb->tail - b;
@@ -2017,7 +2017,7 @@ static int build_polexpire(struct sk_buf
 		goto nlmsg_failure;
 	if (copy_to_user_sec_ctx(xp, skb))
 		goto nlmsg_failure;
-	if (copy_to_user_policy_type(xp, skb) < 0)
+	if (copy_to_user_policy_type(xp->type, skb) < 0)
 		goto nlmsg_failure;
 	upe->hard = !!hard;
 
@@ -2096,7 +2096,7 @@ #endif
 	copy_to_user_policy(xp, p, dir);
 	if (copy_to_user_tmpl(xp, skb) < 0)
 		goto nlmsg_failure;
-	if (copy_to_user_policy_type(xp, skb) < 0)
+	if (copy_to_user_policy_type(xp->type, skb) < 0)
 		goto nlmsg_failure;
 
 	nlh->nlmsg_len = skb->tail - b;
#1 lore raw

* jamal <[email protected]> 2006-11-17 09:10

Quoted 26 lines

First one

cheers,
jamal

[XFRM]: Make copy_to_user_policy_type take a type Make copy_to_user_policy_type take a type instead a policy and fix its users to pass the type

---
commit 5e6a47d1e7baabd38cca9d01f3d78ae1319db535
tree cb4b19b38076cdf545a591ae9d5d6ecd8849c0bc
parent c3d793454ab2a36c2d618d226d7de975ab9b7570
author Jamal Hadi Salim <[email protected]> Fri, 17 Nov 2006 08:52:26 -0500 committer Jamal Hadi Salim <hadi@jzny2.(none)> Fri, 17 Nov 2006 08:52:26 -0500

 net/xfrm/xfrm_user.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
net/xfrm/xfrm_user.c +0 -0
index c4cde57..3c34385 100644

net/xfrm/xfrm_user.c static inline int copy_to_user_sec_ctx(s · line 1085

Quoted 5 lines
net/xfrm/xfrm_user.c +1 -1
@@ -1082,12 +1082,12 @@ static inline int copy_to_user_sec_ctx(s
 }
 
 #ifdef CONFIG_XFRM_SUB_POLICY
-static int copy_to_user_policy_type(struct xfrm_policy *xp, struct sk_buff *skb)
+static int copy_to_user_policy_type(__u8 type, struct sk_buff *skb)

Could you maybe use u8 instead of the userspace alternative __u8?

The other patches look good.

author
#2 lore raw
Quoted 3 lines · Thomas Graf

Could you maybe use u8 instead of the userspace alternative __u8?

Good catch. I think i know how i missed that one - TheLinuxWay;-> theres a few __u8s in there unrelated. So i will send an additional patch that fixes that and the rest of em. Sounds good?

cheers,
jamal

#3 lore raw

* jamal <[email protected]> 2006-11-17 11:49

Quoted 3 lines

Good catch. I think i know how i missed that one - TheLinuxWay;-> theres a few __u8s in there unrelated. So i will send an additional patch that fixes that and the rest of em. Sounds good?

Sure