diff options
author | 2017-04-09 17:57:58 +0000 | |
---|---|---|
committer | 2017-04-09 17:57:58 +0000 | |
commit | 02bfc1718cea16a438927b7c32f251cf3f6912b6 (patch) | |
tree | 13ff0b7acc53ae7de429654a3c60713e597825e1 /sys/net | |
parent | Correct wakeup() dance in sensor_task_work() (diff) | |
download | wireguard-openbsd-02bfc1718cea16a438927b7c32f251cf3f6912b6.tar.xz wireguard-openbsd-02bfc1718cea16a438927b7c32f251cf3f6912b6.zip |
Use mallocarray to allocate multicast group memberships.
ok deraadt@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_pfsync.c | 6 | ||||
-rw-r--r-- | sys/net/if_vxlan.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c index 80f3787e4a4..f8029836177 100644 --- a/sys/net/if_pfsync.c +++ b/sys/net/if_pfsync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.c,v 1.247 2017/04/05 13:35:18 deraadt Exp $ */ +/* $OpenBSD: if_pfsync.c,v 1.248 2017/04/09 17:57:58 dhill Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff @@ -316,8 +316,8 @@ pfsync_clone_create(struct if_clone *ifc, int unit) sc->sc_len = PFSYNC_MINPKT; sc->sc_maxupdates = 128; - sc->sc_imo.imo_membership = (struct in_multi **)malloc( - (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS, + sc->sc_imo.imo_membership = (struct in_multi **)mallocarray( + IP_MIN_MEMBERSHIPS, sizeof(struct in_multi *), M_IPMOPTS, M_WAITOK | M_ZERO); sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS; diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index 4d8620af63b..a159df99d59 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vxlan.c,v 1.57 2017/01/22 10:17:39 dlg Exp $ */ +/* $OpenBSD: if_vxlan.c,v 1.58 2017/04/09 17:57:58 dhill Exp $ */ /* * Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org> @@ -129,8 +129,8 @@ vxlan_clone_create(struct if_clone *ifc, int unit) M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL) return (ENOMEM); - sc->sc_imo.imo_membership = malloc( - (sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_IPMOPTS, + sc->sc_imo.imo_membership = mallocarray( + IP_MIN_MEMBERSHIPS, sizeof(struct in_multi *), M_IPMOPTS, M_WAITOK|M_ZERO); sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS; sc->sc_dstport = htons(VXLAN_PORT); |