Skip to content

Commit

Permalink
stcp: Use memset_after() to zero sctp_stream_out_ext
Browse files Browse the repository at this point in the history
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]>
Xiu Jianfeng authored and kuba-moo committed May 21, 2022
1 parent f7b5a89 commit 29849a4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions net/sctp/stream_sched.c
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 29849a4

Please sign in to comment.