summaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-06-16 08:29:19 -0400
committerDavid S. Miller <davem@davemloft.net>2017-06-16 11:48:35 -0400
commitb080db585384b9f037e015c0c28d1ad33be41dfc (patch)
treeea9cc5c3161d776b948283a3d4f483cbf578e043 /net/key
parent61f73d1ea4c68544b959228ead7ef5c021791b14 (diff)
networking: convert many more places to skb_put_zero()
There were many places that my previous spatch didn't find, as pointed out by yuan linyu in various patches. The following spatch found many more and also removes the now unnecessary casts: @@ identifier p, p2; expression len; expression skb; type t, t2; @@ ( -p = skb_put(skb, len); +p = skb_put_zero(skb, len); | -p = (t)skb_put(skb, len); +p = skb_put_zero(skb, len); ) ... when != p ( p2 = (t2)p; -memset(p2, 0, len); | -memset(p, 0, len); ) @@ type t, t2; identifier p, p2; expression skb; @@ t *p; ... ( -p = skb_put(skb, sizeof(t)); +p = skb_put_zero(skb, sizeof(t)); | -p = (t *)skb_put(skb, sizeof(t)); +p = skb_put_zero(skb, sizeof(t)); ) ... when != p ( p2 = (t2)p; -memset(p2, 0, sizeof(*p)); | -memset(p, 0, sizeof(*p)); ) @@ expression skb, len; @@ -memset(skb_put(skb, len), 0, len); +skb_put_zero(skb, len); Apply it to the tree (with one manual fixup to keep the comment in vxlan.c, which spatch removed.) Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/key')
-rw-r--r--net/key/af_key.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 512dc43d0ce6..8ad430edb5b8 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2934,8 +2934,7 @@ static void dump_ah_combs(struct sk_buff *skb, const struct xfrm_tmpl *t)
2934 2934
2935 if (aalg_tmpl_set(t, aalg) && aalg->available) { 2935 if (aalg_tmpl_set(t, aalg) && aalg->available) {
2936 struct sadb_comb *c; 2936 struct sadb_comb *c;
2937 c = (struct sadb_comb*)skb_put(skb, sizeof(struct sadb_comb)); 2937 c = skb_put_zero(skb, sizeof(struct sadb_comb));
2938 memset(c, 0, sizeof(*c));
2939 p->sadb_prop_len += sizeof(struct sadb_comb)/8; 2938 p->sadb_prop_len += sizeof(struct sadb_comb)/8;
2940 c->sadb_comb_auth = aalg->desc.sadb_alg_id; 2939 c->sadb_comb_auth = aalg->desc.sadb_alg_id;
2941 c->sadb_comb_auth_minbits = aalg->desc.sadb_alg_minbits; 2940 c->sadb_comb_auth_minbits = aalg->desc.sadb_alg_minbits;
@@ -3461,8 +3460,7 @@ static int set_sadb_kmaddress(struct sk_buff *skb, const struct xfrm_kmaddress *
3461 size_req = (sizeof(struct sadb_x_kmaddress) + 3460 size_req = (sizeof(struct sadb_x_kmaddress) +
3462 pfkey_sockaddr_pair_size(family)); 3461 pfkey_sockaddr_pair_size(family));
3463 3462
3464 kma = (struct sadb_x_kmaddress *)skb_put(skb, size_req); 3463 kma = skb_put_zero(skb, size_req);
3465 memset(kma, 0, size_req);
3466 kma->sadb_x_kmaddress_len = size_req / 8; 3464 kma->sadb_x_kmaddress_len = size_req / 8;
3467 kma->sadb_x_kmaddress_exttype = SADB_X_EXT_KMADDRESS; 3465 kma->sadb_x_kmaddress_exttype = SADB_X_EXT_KMADDRESS;
3468 kma->sadb_x_kmaddress_reserved = k->reserved; 3466 kma->sadb_x_kmaddress_reserved = k->reserved;
@@ -3488,8 +3486,7 @@ static int set_ipsecrequest(struct sk_buff *skb,
3488 size_req = sizeof(struct sadb_x_ipsecrequest) + 3486 size_req = sizeof(struct sadb_x_ipsecrequest) +
3489 pfkey_sockaddr_pair_size(family); 3487 pfkey_sockaddr_pair_size(family);
3490 3488
3491 rq = (struct sadb_x_ipsecrequest *)skb_put(skb, size_req); 3489 rq = skb_put_zero(skb, size_req);
3492 memset(rq, 0, size_req);
3493 rq->sadb_x_ipsecrequest_len = size_req; 3490 rq->sadb_x_ipsecrequest_len = size_req;
3494 rq->sadb_x_ipsecrequest_proto = proto; 3491 rq->sadb_x_ipsecrequest_proto = proto;
3495 rq->sadb_x_ipsecrequest_mode = mode; 3492 rq->sadb_x_ipsecrequest_mode = mode;