mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 08:44:33 +00:00
Fix style around allocations from M_IP6NDP.
- Don't cast the return value of malloc(9). - Use M_ZERO instead of explicitly calling bzero(9). MFC after: 1 week
This commit is contained in:
parent
97dca6a207
commit
fc31564185
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=295576
|
@ -243,7 +243,7 @@ nd6_ifattach(struct ifnet *ifp)
|
|||
{
|
||||
struct nd_ifinfo *nd;
|
||||
|
||||
nd = (struct nd_ifinfo *)malloc(sizeof(*nd), M_IP6NDP, M_WAITOK|M_ZERO);
|
||||
nd = malloc(sizeof(*nd), M_IP6NDP, M_WAITOK | M_ZERO);
|
||||
nd->initialized = 1;
|
||||
|
||||
nd->chlim = IPV6_DEFHLIM;
|
||||
|
|
|
@ -779,11 +779,10 @@ defrtrlist_update(struct nd_defrouter *new)
|
|||
if (new->rtlifetime == 0)
|
||||
return (NULL);
|
||||
|
||||
n = (struct nd_defrouter *)malloc(sizeof(*n), M_IP6NDP, M_NOWAIT);
|
||||
n = malloc(sizeof(*n), M_IP6NDP, M_NOWAIT | M_ZERO);
|
||||
if (n == NULL)
|
||||
return (NULL);
|
||||
bzero(n, sizeof(*n));
|
||||
*n = *new;
|
||||
memcpy(n, new, sizeof(*n));
|
||||
|
||||
insert:
|
||||
/*
|
||||
|
@ -826,10 +825,9 @@ pfxrtr_add(struct nd_prefix *pr, struct nd_defrouter *dr)
|
|||
{
|
||||
struct nd_pfxrouter *new;
|
||||
|
||||
new = (struct nd_pfxrouter *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT);
|
||||
new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT | M_ZERO);
|
||||
if (new == NULL)
|
||||
return;
|
||||
bzero(new, sizeof(*new));
|
||||
new->router = dr;
|
||||
|
||||
LIST_INSERT_HEAD(&pr->ndpr_advrtrs, new, pfr_entry);
|
||||
|
@ -869,10 +867,9 @@ nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr,
|
|||
int error = 0;
|
||||
char ip6buf[INET6_ADDRSTRLEN];
|
||||
|
||||
new = (struct nd_prefix *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT);
|
||||
new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT | M_ZERO);
|
||||
if (new == NULL)
|
||||
return(ENOMEM);
|
||||
bzero(new, sizeof(*new));
|
||||
return (ENOMEM);
|
||||
new->ndpr_ifp = pr->ndpr_ifp;
|
||||
new->ndpr_prefix = pr->ndpr_prefix;
|
||||
new->ndpr_plen = pr->ndpr_plen;
|
||||
|
|
Loading…
Reference in a new issue