]> git.baikalelectronics.ru Git - kernel.git/commitdiff
stcp: Use memset_after() to zero sctp_stream_out_ext
authorXiu Jianfeng <xiujianfeng@huawei.com>
Thu, 19 May 2022 06:29:32 +0000 (14:29 +0800)
committerJakub Kicinski <kuba@kernel.org>
Sat, 21 May 2022 00:42:53 +0000 (17:42 -0700)
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>
net/sctp/stream_sched.c

index 99e5f69fbb7424e0f72f82f140880a9c7b84b2da..518b1b9bf89d68ed37d2e67f4e370636a824cd25 100644 (file)
@@ -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);
                }
        }