Skip to contentSkip to conversation

patches: increase 0001-netlink-portid.cocci dependability

PATCH In review Luis R. Rodriguez 1 participant 2 messages Jun 19, 2015 – Jun 26, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 patches: increase 0001-netlink-portid.cocci dependability

Using expression is pretty flexible, in this case we don't want that flexibility as it can override any struct who also uses the same variable name. For a specific example of the issue refer to the netdev-ops demo git tree [0] which provide an example of the issue with two SmPL rules.

We keep the expression on the last rule on NETLINK_CB(skb) given that we know only an skb can possibly be used on it.

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.68              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.107             [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.75             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.40             [  OK  ]
14  3.13.11             [  OK  ]
15  3.14.39             [  OK  ]
16  3.15.10             [  OK  ]
17  3.16.7              [  OK  ]
18  3.17.8              [  OK  ]
19  3.18.12             [  OK  ]
20  3.19.5              [  OK  ]
21  4.0.0               [  OK  ]
22  4.1-rc8             [  OK  ]

[0] https://github.com/mcgrof/netdev-ops.git

Cc cocci at systeme.lip6.fr
---
 .../collateral-evolutions/network/0001-netlink-portid.cocci    | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
patches/collateral-evolutions/network/0001-netlink-portid.cocci +1 -9
index 409e926..5fc504e 100644
@@ -1,23 +1,15 @@
- at nl1@
-identifier notify;
 @@
 struct netlink_notify *notify;
 @@
-identifier nl1.notify;
-@@
 -notify->portid
 +netlink_notify_portid(notify)
 
-// This works because no other struct in the kernel
-// has an snd_portid member.
 @@
-expression info;
+struct genl_info *info;
 @@
 -info->snd_portid
 +genl_info_snd_portid(info)
 
-// skb is an expression since it could be something
-// other than just an identifier, e.g. cb->skb
 @@
 expression skb;
 @@
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#1 lore raw
Quoted 33 lines · Luis R. Rodriguez

Using expression is pretty flexible, in this case we don't want that flexibility as it can override any struct who also uses the same variable name. For a specific example of the issue refer to the netdev-ops demo git tree [0] which provide an example of the issue with two SmPL rules.

We keep the expression on the last rule on NETLINK_CB(skb) given that we know only an skb can possibly be used on it.

1   3.0.101             [  OK  ]
2   3.1.10              [  OK  ]
3   3.2.68              [  OK  ]
4   3.3.8               [  OK  ]
5   3.4.107             [  OK  ]
6   3.5.7               [  OK  ]
7   3.6.11              [  OK  ]
8   3.7.10              [  OK  ]
9   3.8.13              [  OK  ]
10  3.9.11              [  OK  ]
11  3.10.75             [  OK  ]
12  3.11.10             [  OK  ]
13  3.12.40             [  OK  ]
14  3.13.11             [  OK  ]
15  3.14.39             [  OK  ]
16  3.15.10             [  OK  ]
17  3.16.7              [  OK  ]
18  3.17.8              [  OK  ]
19  3.18.12             [  OK  ]
20  3.19.5              [  OK  ]
21  4.0.0               [  OK  ]
22  4.1-rc8             [  OK  ]
Quoted 4 lines

[0] https://github.com/mcgrof/netdev-ops.git

Cc cocci at systeme.lip6.fr

Applied and pushed.

Luis