Skip to content

Commit 29849a4

Browse files
Xiu Jianfengkuba-moo
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent f7b5a89 commit 29849a4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

net/sctp/stream_sched.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,11 @@ int sctp_sched_set_sched(struct sctp_association *asoc,
146146

147147
/* Give the next scheduler a clean slate. */
148148
for (i = 0; i < asoc->stream.outcnt; i++) {
149-
void *p = SCTP_SO(&asoc->stream, i)->ext;
149+
struct sctp_stream_out_ext *ext = SCTP_SO(&asoc->stream, i)->ext;
150150

151-
if (!p)
151+
if (!ext)
152152
continue;
153-
154-
p += offsetofend(struct sctp_stream_out_ext, outq);
155-
memset(p, 0, sizeof(struct sctp_stream_out_ext) -
156-
offsetofend(struct sctp_stream_out_ext, outq));
153+
memset_after(ext, 0, outq);
157154
}
158155
}
159156

0 commit comments

Comments
 (0)