mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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>
This commit is contained in:
committed by
David S. Miller
parent
61f73d1ea4
commit
b080db5853
@@ -2934,8 +2934,7 @@ static void dump_ah_combs(struct sk_buff *skb, const struct xfrm_tmpl *t)
|
||||
|
||||
if (aalg_tmpl_set(t, aalg) && aalg->available) {
|
||||
struct sadb_comb *c;
|
||||
c = (struct sadb_comb*)skb_put(skb, sizeof(struct sadb_comb));
|
||||
memset(c, 0, sizeof(*c));
|
||||
c = skb_put_zero(skb, sizeof(struct sadb_comb));
|
||||
p->sadb_prop_len += sizeof(struct sadb_comb)/8;
|
||||
c->sadb_comb_auth = aalg->desc.sadb_alg_id;
|
||||
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 *
|
||||
size_req = (sizeof(struct sadb_x_kmaddress) +
|
||||
pfkey_sockaddr_pair_size(family));
|
||||
|
||||
kma = (struct sadb_x_kmaddress *)skb_put(skb, size_req);
|
||||
memset(kma, 0, size_req);
|
||||
kma = skb_put_zero(skb, size_req);
|
||||
kma->sadb_x_kmaddress_len = size_req / 8;
|
||||
kma->sadb_x_kmaddress_exttype = SADB_X_EXT_KMADDRESS;
|
||||
kma->sadb_x_kmaddress_reserved = k->reserved;
|
||||
@@ -3488,8 +3486,7 @@ static int set_ipsecrequest(struct sk_buff *skb,
|
||||
size_req = sizeof(struct sadb_x_ipsecrequest) +
|
||||
pfkey_sockaddr_pair_size(family);
|
||||
|
||||
rq = (struct sadb_x_ipsecrequest *)skb_put(skb, size_req);
|
||||
memset(rq, 0, size_req);
|
||||
rq = skb_put_zero(skb, size_req);
|
||||
rq->sadb_x_ipsecrequest_len = size_req;
|
||||
rq->sadb_x_ipsecrequest_proto = proto;
|
||||
rq->sadb_x_ipsecrequest_mode = mode;
|
||||
|
Reference in New Issue
Block a user