diff options
author | Johannes Berg <johannes.berg@intel.com> | 2017-06-16 14:29:19 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-16 17:48:35 +0200 |
commit | b080db585384b9f037e015c0c28d1ad33be41dfc (patch) | |
tree | ea9cc5c3161d776b948283a3d4f483cbf578e043 /net/sctp | |
parent | Merge branch 'r8152-adjust-runtime-suspend-resume' (diff) | |
download | linux-b080db585384b9f037e015c0c28d1ad33be41dfc.tar.xz linux-b080db585384b9f037e015c0c28d1ad33be41dfc.zip |
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/sctp')
-rw-r--r-- | net/sctp/output.c | 2 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/net/sctp/output.c b/net/sctp/output.c index e2edf2ebbade..c339c682675a 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c @@ -463,7 +463,7 @@ merge: padding = SCTP_PAD4(chunk->skb->len) - chunk->skb->len; if (padding) - memset(skb_put(chunk->skb, padding), 0, padding); + skb_put_zero(chunk->skb, padding); if (chunk == packet->auth) auth = (struct sctp_auth_chunk *) diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index ea2601501654..aaac2660aaf7 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -1478,10 +1478,9 @@ void *sctp_addto_chunk(struct sctp_chunk *chunk, int len, const void *data) int chunklen = ntohs(chunk->chunk_hdr->length); int padlen = SCTP_PAD4(chunklen) - chunklen; - padding = skb_put(chunk->skb, padlen); + padding = skb_put_zero(chunk->skb, padlen); target = skb_put(chunk->skb, len); - memset(padding, 0, padlen); memcpy(target, data, len); /* Adjust the chunk length field. */ |