summary refs log tree commit diff
path: root/net/sctp
diff options
context:
space:
mode:
authorXiu Jianfeng <xiujianfeng@huawei.com>2022-05-19 14:29:32 +0800
committerJakub Kicinski <kuba@kernel.org>2022-05-20 17:42:53 -0700
commit29849a486a85f7ab1f3b389db5e3d4948119bef2 (patch)
tree78d63352697093be6c873e68200d64c298bab38d /net/sctp
parentf7b5a89c66defe87d11240cfdaa8b6cbee5784eb (diff)
downloadlinux-29849a486a85f7ab1f3b389db5e3d4948119bef2.tar.gz
stcp: Use memset_after() to zero sctp_stream_out_ext
Use memset_after() helper to simplify the code, there is no functional
change in this patch.

Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Link: https://lore.kernel.org/r/20220519062932.249926-1-xiujianfeng@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/stream_sched.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/net/sctp/stream_sched.c b/net/sctp/stream_sched.c
index 99e5f69fbb74..518b1b9bf89d 100644
--- a/net/sctp/stream_sched.c
+++ b/net/sctp/stream_sched.c
@@ -146,14 +146,11 @@ int sctp_sched_set_sched(struct sctp_association *asoc,
 
 		/* Give the next scheduler a clean slate. */
 		for (i = 0; i < asoc->stream.outcnt; i++) {
-			void *p = SCTP_SO(&asoc->stream, i)->ext;
+			struct sctp_stream_out_ext *ext = SCTP_SO(&asoc->stream, i)->ext;
 
-			if (!p)
+			if (!ext)
 				continue;
-
-			p += offsetofend(struct sctp_stream_out_ext, outq);
-			memset(p, 0, sizeof(struct sctp_stream_out_ext) -
-				     offsetofend(struct sctp_stream_out_ext, outq));
+			memset_after(ext, 0, outq);
 		}
 	}