summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-10-01 16:39:31 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-10-01 16:39:31 +0000
commit5a93b7b14326715c9e05692f21723cbd2531f8ee (patch)
tree2679daadf708c6a77ae4f6ff29b583db5965079f
parent1d3a2c7615ad6b5663e200fe3e8a475ef3203245 (diff)
Last of the really easy bzero() -> M_ZERO. Use 'p = malloc(sizeof(*p) ...'
where obvious.
-rw-r--r--sys/netatalk/at_control.c5
-rw-r--r--sys/netbt/hci_event.c7
-rw-r--r--sys/netbt/l2cap_upper.c6
-rw-r--r--sys/netbt/rfcomm_upper.c5
-rw-r--r--sys/netbt/sco_upper.c5
-rw-r--r--sys/netinet/in.c6
-rw-r--r--sys/netinet6/nd6.c5
-rw-r--r--sys/netinet6/nd6_rtr.c11
-rw-r--r--sys/ufs/ufs/ufs_quota.c5
9 files changed, 21 insertions, 34 deletions
diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c
index e8fc6fc3803..04c4a1f1d3d 100644
--- a/sys/netatalk/at_control.c
+++ b/sys/netatalk/at_control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at_control.c,v 1.10 2007/04/10 17:47:55 miod Exp $ */
+/* $OpenBSD: at_control.c,v 1.11 2007/10/01 16:39:30 krw Exp $ */
/*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -167,8 +167,7 @@ at_control( cmd, data, ifp, p )
panic( "at_control" );
if ( aa == (struct at_ifaddr *) 0 ) {
- aa0 = malloc(sizeof(struct at_ifaddr), M_IFADDR, M_WAITOK);
- bzero(aa0, sizeof(struct at_ifaddr));
+ aa0 = malloc(sizeof(*aa0), M_IFADDR, M_WAITOK | M_ZERO);
if (( aa = at_ifaddr ) != NULL ) {
/*
diff --git a/sys/netbt/hci_event.c b/sys/netbt/hci_event.c
index 91973c9e515..b4be8a5aff4 100644
--- a/sys/netbt/hci_event.c
+++ b/sys/netbt/hci_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hci_event.c,v 1.5 2007/06/19 08:12:35 uwe Exp $ */
+/* $OpenBSD: hci_event.c,v 1.6 2007/10/01 16:39:30 krw Exp $ */
/* $NetBSD: hci_event.c,v 1.6 2007/04/21 06:15:23 plunky Exp $ */
/*-
@@ -434,13 +434,12 @@ hci_event_inquiry_result(struct hci_unit *unit, struct mbuf *m)
memo = hci_memo_find(unit, &bdaddr);
if (memo == NULL) {
- memo = malloc(sizeof(struct hci_memo),
- M_BLUETOOTH, M_NOWAIT);
+ memo = malloc(sizeof(*memo), M_BLUETOOTH,
+ M_NOWAIT | M_ZERO);
if (memo == NULL) {
DPRINTFN(0, "out of memo memory!\n");
break;
}
- bzero(memo, sizeof *memo);
LIST_INSERT_HEAD(&unit->hci_memos, memo, next);
}
diff --git a/sys/netbt/l2cap_upper.c b/sys/netbt/l2cap_upper.c
index b33d51815f9..d3236a95a99 100644
--- a/sys/netbt/l2cap_upper.c
+++ b/sys/netbt/l2cap_upper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2cap_upper.c,v 1.1 2007/06/01 02:46:11 uwe Exp $ */
+/* $OpenBSD: l2cap_upper.c,v 1.2 2007/10/01 16:39:30 krw Exp $ */
/* $NetBSD: l2cap_upper.c,v 1.8 2007/04/29 20:23:36 msaitoh Exp $ */
/*-
@@ -67,11 +67,9 @@ l2cap_attach(struct l2cap_channel **handle,
KASSERT(proto != NULL);
KASSERT(upper != NULL);
- chan = malloc(sizeof(struct l2cap_channel), M_BLUETOOTH,
- M_NOWAIT);
+ chan = malloc(sizeof(*chan), M_BLUETOOTH, M_NOWAIT | M_ZERO);
if (chan == NULL)
return ENOMEM;
- bzero(chan, sizeof *chan);
chan->lc_proto = proto;
chan->lc_upper = upper;
diff --git a/sys/netbt/rfcomm_upper.c b/sys/netbt/rfcomm_upper.c
index 804d21e20a6..da606b2741b 100644
--- a/sys/netbt/rfcomm_upper.c
+++ b/sys/netbt/rfcomm_upper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rfcomm_upper.c,v 1.2 2007/06/26 10:30:05 tom Exp $ */
+/* $OpenBSD: rfcomm_upper.c,v 1.3 2007/10/01 16:39:30 krw Exp $ */
/* $NetBSD: rfcomm_upper.c,v 1.6 2007/04/21 06:15:23 plunky Exp $ */
/*-
@@ -69,10 +69,9 @@ rfcomm_attach(struct rfcomm_dlc **handle,
KASSERT(proto != NULL);
KASSERT(upper != NULL);
- dlc = malloc(sizeof(struct rfcomm_dlc), M_BLUETOOTH, M_NOWAIT);
+ dlc = malloc(sizeof(*dlc), M_BLUETOOTH, M_NOWAIT | M_ZERO);
if (dlc == NULL)
return ENOMEM;
- bzero(dlc, sizeof *dlc);
dlc->rd_state = RFCOMM_DLC_CLOSED;
dlc->rd_mtu = rfcomm_mtu_default;
diff --git a/sys/netbt/sco_upper.c b/sys/netbt/sco_upper.c
index f867367c5db..7a27b4a89cf 100644
--- a/sys/netbt/sco_upper.c
+++ b/sys/netbt/sco_upper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sco_upper.c,v 1.1 2007/06/01 02:46:12 uwe Exp $ */
+/* $OpenBSD: sco_upper.c,v 1.2 2007/10/01 16:39:30 krw Exp $ */
/* $NetBSD: sco_upper.c,v 1.6 2007/03/30 20:47:03 plunky Exp $ */
/*-
@@ -66,10 +66,9 @@ sco_attach(struct sco_pcb **handle,
KASSERT(proto != NULL);
KASSERT(upper != NULL);
- pcb = malloc(sizeof(struct sco_pcb), M_BLUETOOTH, M_NOWAIT);
+ pcb = malloc(sizeof(*pcb), M_BLUETOOTH, M_NOWAIT | M_ZERO);
if (pcb == NULL)
return ENOMEM;
- bzero(pcb, sizeof *pcb);
pcb->sp_proto = proto;
pcb->sp_upper = upper;
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index caf4e22c196..e7db8861f4f 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.50 2007/09/17 09:33:57 markus Exp $ */
+/* $OpenBSD: in.c,v 1.51 2007/10/01 16:39:30 krw Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -273,9 +273,7 @@ in_control(so, cmd, data, ifp)
if (ifp == 0)
panic("in_control");
if (ia == (struct in_ifaddr *)0) {
- ia = (struct in_ifaddr *)
- malloc(sizeof *ia, M_IFADDR, M_WAITOK);
- bzero((caddr_t)ia, sizeof *ia);
+ ia = malloc(sizeof *ia, M_IFADDR, M_WAITOK | M_ZERO);
s = splsoftnet();
TAILQ_INSERT_TAIL(&in_ifaddr, ia, ia_list);
TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia,
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 6d69d2463be..a9c7da10b2f 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.74 2007/06/08 09:31:38 henning Exp $ */
+/* $OpenBSD: nd6.c,v 1.75 2007/10/01 16:39:30 krw Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -141,8 +141,7 @@ nd6_ifattach(ifp)
{
struct nd_ifinfo *nd;
- nd = (struct nd_ifinfo *)malloc(sizeof(*nd), M_IP6NDP, M_WAITOK);
- bzero(nd, sizeof(*nd));
+ nd = malloc(sizeof(*nd), M_IP6NDP, M_WAITOK | M_ZERO);
nd->initialized = 1;
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 447a408258f..3d38253cc2f 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.43 2007/05/28 23:07:13 pyr Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.44 2007/10/01 16:39:30 krw Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -782,12 +782,11 @@ defrtrlist_update(new)
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) {
splx(s);
return (NULL);
}
- bzero(n, sizeof(*n));
*n = *new;
insert:
@@ -838,10 +837,9 @@ pfxrtr_add(pr, 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);
@@ -883,10 +881,9 @@ nd6_prelist_add(pr, dr, newp)
struct nd_prefix *new = NULL;
int i, s;
- 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));
*new = *pr;
if (newp != NULL)
*newp = new;
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index db8cf24d2ab..1b33801d9a5 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_quota.c,v 1.28 2007/08/03 18:41:44 millert Exp $ */
+/* $OpenBSD: ufs_quota.c,v 1.29 2007/10/01 16:39:30 krw Exp $ */
/* $NetBSD: ufs_quota.c,v 1.8 1996/02/09 22:36:09 christos Exp $ */
/*
@@ -834,8 +834,7 @@ dqget(struct vnode *vp, u_long id, struct ufsmount *ump, int type,
numdquot < MAXQUOTAS * desiredvnodes)
desireddquot += DQUOTINC;
if (numdquot < desireddquot) {
- dq = (struct dquot *)malloc(sizeof *dq, M_DQUOT, M_WAITOK);
- bzero((char *)dq, sizeof *dq);
+ dq = malloc(sizeof *dq, M_DQUOT, M_WAITOK | M_ZERO);
numdquot++;
} else {
if ((dq = TAILQ_FIRST(&dqfreelist)) == NULL) {