]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/blobdiff - net/sctp/endpointola.c
treewide: Use struct_size() for kmalloc()-family
[mirror_ubuntu-disco-kernel.git] / net / sctp / endpointola.c
index e2f5a3ee41a7140c3865c406bf8e1d4f83044e5a..40c7eb941bc9d70fd3db995ae0a8c8176cd7cf7f 100644 (file)
@@ -73,8 +73,8 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
                 * variables.  There are arrays that we encode directly
                 * into parameters to make the rest of the operations easier.
                 */
-               auth_hmacs = kzalloc(sizeof(*auth_hmacs) +
-                                    sizeof(__u16) * SCTP_AUTH_NUM_HMACS, gfp);
+               auth_hmacs = kzalloc(struct_size(auth_hmacs, hmac_ids,
+                                                SCTP_AUTH_NUM_HMACS), gfp);
                if (!auth_hmacs)
                        goto nomem;