don't use MALLOC with a non-constant size; use malloc instead.
This commit is contained in:
parent
ee3808b74f
commit
5a57baa413
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: gus.c,v 1.90 2005/12/11 12:22:02 christos Exp $ */
|
||||
/* $NetBSD: gus.c,v 1.91 2006/03/17 23:29:07 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -95,7 +95,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.90 2005/12/11 12:22:02 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: gus.c,v 1.91 2006/03/17 23:29:07 christos Exp $");
|
||||
|
||||
#include "gus.h"
|
||||
#if NGUS > 0
|
||||
|
@ -2390,7 +2390,7 @@ gus_round_blocksize(void * addr, int blocksize,
|
|||
FREE(sc->sc_deintr_buf, M_DEVBUF);
|
||||
sc->sc_deintr_buf = NULL;
|
||||
}
|
||||
MALLOC(sc->sc_deintr_buf, void *, blocksize>>1, M_DEVBUF, M_WAITOK);
|
||||
sc->sc_deintr_buf = malloc(blocksize>>1, M_DEVBUF, M_WAITOK);
|
||||
|
||||
sc->sc_blocksize = blocksize;
|
||||
/* multi-buffering not quite working yet. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_compat.h,v 1.8 2005/12/11 12:24:21 christos Exp $ */
|
||||
/* $NetBSD: ip_compat.h,v 1.9 2006/03/17 23:29:07 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1993-2001, 2003 by Darren Reed.
|
||||
|
@ -444,7 +444,7 @@ extern void *get_unit __P((char *, int));
|
|||
spinunlock(_l); \
|
||||
}
|
||||
# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_IOSYS, M_NOWAIT)
|
||||
# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_IOSYS, M_NOWAIT)
|
||||
# define KMALLOCS(a, b, c) (a) = (b)malloc((c), M_IOSYS, M_NOWAIT)
|
||||
# define KFREE(x) kmem_free((char *)(x), sizeof(*(x)))
|
||||
# define KFREES(x,s) kmem_free((char *)(x), (s))
|
||||
# define MSGDSIZE(x) msgdsize(x)
|
||||
|
@ -666,7 +666,7 @@ typedef struct mbuf mb_t;
|
|||
# define BCOPYIN(a,b,c) bcopy((caddr_t)(a), (caddr_t)(b), (c))
|
||||
# define BCOPYOUT(a,b,c) bcopy((caddr_t)(a), (caddr_t)(b), (c))
|
||||
# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_PFILT, M_NOWAIT)
|
||||
# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_PFILT, \
|
||||
# define KMALLOCS(a, b, c) (a) = (b)malloc((c), M_PFILT, \
|
||||
((c) > 4096) ? M_WAITOK : M_NOWAIT)
|
||||
# define KFREE(x) FREE((x), M_PFILT)
|
||||
# define KFREES(x,s) FREE((x), M_PFILT)
|
||||
|
@ -1460,7 +1460,7 @@ MALLOC_DECLARE(M_IPFILTER);
|
|||
# endif /* M_PFIL */
|
||||
# endif /* IPFILTER_M_IPFILTER */
|
||||
# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT)
|
||||
# define KMALLOCS(a, b, c) MALLOC((a), b, (c), _M_IPF, M_NOWAIT)
|
||||
# define KMALLOCS(a, b, c) (a) = (b)malloc((c), _M_IPF, M_NOWAIT)
|
||||
# define KFREE(x) FREE((x), _M_IPF)
|
||||
# define KFREES(x,s) FREE((x), _M_IPF)
|
||||
# define UIOMOVE(a,b,c,d) uiomove(a,b,d)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ntfs_subr.c,v 1.21 2005/12/11 12:24:29 christos Exp $ */
|
||||
/* $NetBSD: ntfs_subr.c,v 1.22 2006/03/17 23:29:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 Semen Ustimenko (semenu@FreeBSD.org)
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.21 2005/12/11 12:24:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ntfs_subr.c,v 1.22 2006/03/17 23:29:08 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -1823,9 +1823,9 @@ ntfs_readattr(
|
|||
ddprintf(("ntfs_ntreadattr: compression: %d\n",
|
||||
vap->va_compressalg));
|
||||
|
||||
MALLOC(cup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL),
|
||||
cup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL),
|
||||
M_NTFSDECOMP, M_WAITOK);
|
||||
MALLOC(uup, u_int8_t *, ntfs_cntob(NTFS_COMPUNIT_CL),
|
||||
uup = malloc(ntfs_cntob(NTFS_COMPUNIT_CL),
|
||||
M_NTFSDECOMP, M_WAITOK);
|
||||
|
||||
cn = (ntfs_btocn(roff)) & (~(NTFS_COMPUNIT_CL - 1));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: exec_script.c,v 1.45 2005/12/11 12:24:29 christos Exp $ */
|
||||
/* $NetBSD: exec_script.c,v 1.46 2006/03/17 23:29:09 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.45 2005/12/11 12:24:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.46 2006/03/17 23:29:09 christos Exp $");
|
||||
|
||||
#if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
|
||||
#define FDSCRIPTS /* Need this for safe set-id scripts. */
|
||||
|
@ -223,10 +223,10 @@ check_shell:
|
|||
/* and set up the fake args list, for later */
|
||||
MALLOC(shellargp, char **, 4 * sizeof(char *), M_EXEC, M_WAITOK);
|
||||
tmpsap = shellargp;
|
||||
MALLOC(*tmpsap, char *, shellnamelen + 1, M_EXEC, M_WAITOK);
|
||||
*tmpsap = malloc(shellnamelen + 1, M_EXEC, M_WAITOK);
|
||||
strlcpy(*tmpsap++, shellname, shellnamelen + 1);
|
||||
if (shellarg != NULL) {
|
||||
MALLOC(*tmpsap, char *, shellarglen + 1, M_EXEC, M_WAITOK);
|
||||
*tmpsap = malloc(shellarglen + 1, M_EXEC, M_WAITOK);
|
||||
strlcpy(*tmpsap++, shellarg, shellarglen + 1);
|
||||
}
|
||||
MALLOC(*tmpsap, char *, MAXPATHLEN, M_EXEC, M_WAITOK);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_acl.c,v 1.4 2005/08/13 17:31:48 sam Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_acl.c,v 1.4 2005/11/18 16:40:08 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_acl.c,v 1.5 2006/03/17 23:29:09 christos Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -292,8 +292,7 @@ acl_getioctl(struct ieee80211com *ic, struct ieee80211req *ireq)
|
|||
ireq->i_len = space; /* return required space */
|
||||
return 0; /* NB: must not error */
|
||||
}
|
||||
MALLOC(ap, struct ieee80211req_maclist *, space,
|
||||
M_TEMP, M_NOWAIT);
|
||||
ap = malloc(space, M_TEMP, M_NOWAIT);
|
||||
if (ap == NULL)
|
||||
return ENOMEM;
|
||||
i = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ieee80211_input.c,v 1.57 2006/03/02 03:38:48 dyoung Exp $ */
|
||||
/* $NetBSD: ieee80211_input.c,v 1.58 2006/03/17 23:29:09 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
|
@ -36,7 +36,7 @@
|
|||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.81 2005/08/10 16:22:29 sam Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.57 2006/03/02 03:38:48 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_input.c,v 1.58 2006/03/17 23:29:09 christos Exp $");
|
||||
#endif
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
@ -1780,7 +1780,7 @@ ieee80211_saveie(u_int8_t **iep, const u_int8_t *ie)
|
|||
if (*iep == NULL || (*iep)[1] != ie[1]) {
|
||||
if (*iep != NULL)
|
||||
FREE(*iep, M_DEVBUF);
|
||||
MALLOC(*iep, void*, ielen, M_DEVBUF, M_NOWAIT);
|
||||
*iep = malloc(ielen, M_DEVBUF, M_NOWAIT);
|
||||
}
|
||||
if (*iep != NULL)
|
||||
memcpy(*iep, ie, ielen);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ieee80211_ioctl.c,v 1.30 2006/03/02 03:38:48 dyoung Exp $ */
|
||||
/* $NetBSD: ieee80211_ioctl.c,v 1.31 2006/03/17 23:29:09 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
|
@ -36,7 +36,7 @@
|
|||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.35 2005/08/30 14:27:47 avatar Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.30 2006/03/02 03:38:48 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_ioctl.c,v 1.31 2006/03/17 23:29:09 christos Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -1201,7 +1201,7 @@ ieee80211_ioctl_getstainfo(struct ieee80211com *ic, struct ieee80211req *ireq)
|
|||
|
||||
space = req.space;
|
||||
/* XXX M_WAITOK after driver lock released */
|
||||
MALLOC(p, void *, space, M_TEMP, M_NOWAIT);
|
||||
p = malloc(space, M_TEMP, M_NOWAIT);
|
||||
if (p == NULL)
|
||||
return ENOMEM;
|
||||
req.si = p;
|
||||
|
@ -1558,7 +1558,7 @@ ieee80211_ioctl_setoptie(struct ieee80211com *ic, struct ieee80211req *ireq)
|
|||
if (ireq->i_len > IEEE80211_MAX_OPT_IE)
|
||||
return EINVAL;
|
||||
/* NB: data.length is validated by the wireless extensions code */
|
||||
MALLOC(ie, void *, (u_long)ireq->i_len, M_DEVBUF, M_WAITOK);
|
||||
ie = malloc(ireq->i_len, M_DEVBUF, M_WAITOK);
|
||||
if (ie == NULL)
|
||||
return ENOMEM;
|
||||
error = copyin(ireq->i_data, ie, ireq->i_len);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ieee80211_node.c,v 1.53 2006/03/08 23:46:27 lukem Exp $ */
|
||||
/* $NetBSD: ieee80211_node.c,v 1.54 2006/03/17 23:29:10 christos Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 Atsushi Onoe
|
||||
* Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
|
||||
|
@ -36,7 +36,7 @@
|
|||
__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_node.c,v 1.65 2005/08/13 17:50:21 sam Exp $");
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.53 2006/03/08 23:46:27 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ieee80211_node.c,v 1.54 2006/03/17 23:29:10 christos Exp $");
|
||||
#endif
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
@ -130,9 +130,8 @@ ieee80211_node_lateattach(struct ieee80211com *ic)
|
|||
|
||||
if (ic->ic_max_aid > IEEE80211_AID_MAX)
|
||||
ic->ic_max_aid = IEEE80211_AID_MAX;
|
||||
MALLOC(ic->ic_aid_bitmap, u_int32_t *,
|
||||
howmany(ic->ic_max_aid, 32) * sizeof(u_int32_t),
|
||||
M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
ic->ic_aid_bitmap = malloc(howmany(ic->ic_max_aid, 32) *
|
||||
sizeof(u_int32_t), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (ic->ic_aid_bitmap == NULL) {
|
||||
/* XXX no way to recover */
|
||||
printf("%s: no memory for AID bitmap!\n", __func__);
|
||||
|
@ -141,8 +140,7 @@ ieee80211_node_lateattach(struct ieee80211com *ic)
|
|||
|
||||
/* XXX defer until using hostap/ibss mode */
|
||||
ic->ic_tim_len = howmany(ic->ic_max_aid, 8) * sizeof(u_int8_t);
|
||||
MALLOC(ic->ic_tim_bitmap, u_int8_t *, ic->ic_tim_len,
|
||||
M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
ic->ic_tim_bitmap = malloc(ic->ic_tim_len, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (ic->ic_tim_bitmap == NULL) {
|
||||
/* XXX no way to recover */
|
||||
printf("%s: no memory for TIM bitmap!\n", __func__);
|
||||
|
@ -2389,9 +2387,9 @@ ieee80211_node_table_init(struct ieee80211com *ic,
|
|||
nt->nt_timeout = timeout;
|
||||
nt->nt_keyixmax = keyixmax;
|
||||
if (nt->nt_keyixmax > 0) {
|
||||
MALLOC(nt->nt_keyixmap, struct ieee80211_node **,
|
||||
keyixmax * sizeof(struct ieee80211_node *),
|
||||
M_80211_NODE, M_NOWAIT | M_ZERO);
|
||||
nt->nt_keyixmap = malloc(keyixmax *
|
||||
sizeof(struct ieee80211_node *), M_80211_NODE,
|
||||
M_NOWAIT | M_ZERO);
|
||||
if (nt->nt_keyixmap == NULL)
|
||||
if_printf(ic->ic_ifp,
|
||||
"Cannot allocate key index map with %u entries\n",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: llc_subr.c,v 1.22 2005/12/11 12:24:54 christos Exp $ */
|
||||
/* $NetBSD: llc_subr.c,v 1.23 2006/03/17 23:29:10 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -76,7 +76,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: llc_subr.c,v 1.22 2005/12/11 12:24:54 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: llc_subr.c,v 1.23 2006/03/17 23:29:10 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -2331,7 +2331,7 @@ llc_newlink(dst, ifp, nlrt, nlnext, llrt)
|
|||
llcwindow = LLC_MAX_WINDOW;
|
||||
|
||||
/* allocate memory for window buffer */
|
||||
MALLOC(nlinkp->llcl_output_buffers, struct mbuf **,
|
||||
nlinkp->llcl_output_buffers = malloc(
|
||||
llcwindow * sizeof(struct mbuf *), M_PCB, M_NOWAIT|M_ZERO);
|
||||
if (nlinkp->llcl_output_buffers == 0) {
|
||||
FREE(nlinkp, M_PCB);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cryptodev.c,v 1.18 2006/03/06 00:50:44 christos Exp $ */
|
||||
/* $NetBSD: cryptodev.c,v 1.19 2006/03/17 23:29:11 christos Exp $ */
|
||||
/* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */
|
||||
/* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.18 2006/03/06 00:50:44 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.19 2006/03/17 23:29:11 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -255,8 +255,8 @@ cryptof_ioctl(struct file *fp, u_long cmd, void* data, struct lwp *l)
|
|||
goto bail;
|
||||
}
|
||||
|
||||
MALLOC(crie.cri_key, u_int8_t *,
|
||||
crie.cri_klen / 8, M_XDATA, M_WAITOK);
|
||||
crie.cri_key = malloc(crie.cri_klen / 8, M_XDATA,
|
||||
M_WAITOK);
|
||||
if ((error = copyin(sop->key, crie.cri_key,
|
||||
crie.cri_klen / 8)))
|
||||
goto bail;
|
||||
|
@ -275,8 +275,8 @@ cryptof_ioctl(struct file *fp, u_long cmd, void* data, struct lwp *l)
|
|||
}
|
||||
|
||||
if (cria.cri_klen) {
|
||||
MALLOC(cria.cri_key, u_int8_t *,
|
||||
cria.cri_klen / 8, M_XDATA, M_WAITOK);
|
||||
cria.cri_key = malloc(cria.cri_klen / 8,
|
||||
M_XDATA, M_WAITOK);
|
||||
if ((error = copyin(sop->mackey, cria.cri_key,
|
||||
cria.cri_klen / 8)))
|
||||
goto bail;
|
||||
|
@ -564,7 +564,7 @@ cryptodev_key(struct crypt_kop *kop)
|
|||
size = (krp->krp_param[i].crp_nbits + 7) / 8;
|
||||
if (size == 0)
|
||||
continue;
|
||||
MALLOC(krp->krp_param[i].crp_p, caddr_t, size, M_XDATA, M_WAITOK);
|
||||
krp->krp_param[i].crp_p = malloc(size, M_XDATA, M_WAITOK);
|
||||
if (i >= krp->krp_iparams)
|
||||
continue;
|
||||
error = copyin(kop->crk_param[i].crp_p, krp->krp_param[i].crp_p, size);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cryptosoft.c,v 1.11 2005/11/25 16:41:31 thorpej Exp $ */
|
||||
/* $NetBSD: cryptosoft.c,v 1.12 2006/03/17 23:29:11 christos Exp $ */
|
||||
/* $FreeBSD: src/sys/opencrypto/cryptosoft.c,v 1.2.2.1 2002/11/21 23:34:23 sam Exp $ */
|
||||
/* $OpenBSD: cryptosoft.c,v 1.35 2002/04/26 08:43:50 deraadt Exp $ */
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.11 2005/11/25 16:41:31 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cryptosoft.c,v 1.12 2006/03/17 23:29:11 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -642,7 +642,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw,
|
|||
* copy in a buffer.
|
||||
*/
|
||||
|
||||
MALLOC(data, u_int8_t *, crd->crd_len, M_CRYPTO_DATA, M_NOWAIT);
|
||||
data = malloc(crd->crd_len, M_CRYPTO_DATA, M_NOWAIT);
|
||||
if (data == NULL)
|
||||
return (EINVAL);
|
||||
COPYDATA(outtype, buf, crd->crd_skip, crd->crd_len, data);
|
||||
|
@ -756,8 +756,7 @@ swcr_newsession(void *arg, u_int32_t *sid, struct cryptoini *cri)
|
|||
*sid = i;
|
||||
|
||||
while (cri) {
|
||||
MALLOC(*swd, struct swcr_data *, sizeof(struct swcr_data),
|
||||
M_CRYPTO_DATA, M_NOWAIT);
|
||||
*swd = malloc(sizeof(*swd), M_CRYPTO_DATA, M_NOWAIT);
|
||||
if (*swd == NULL) {
|
||||
swcr_freesession(NULL, i);
|
||||
return ENOBUFS;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: deflate.c,v 1.4 2005/12/11 12:25:20 christos Exp $ */
|
||||
/* $NetBSD: deflate.c,v 1.5 2006/03/17 23:29:11 christos Exp $ */
|
||||
/* $FreeBSD: src/sys/opencrypto/deflate.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */
|
||||
/* $OpenBSD: deflate.c,v 1.3 2001/08/20 02:45:22 hugh Exp $ */
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.4 2005/12/11 12:25:20 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.5 2006/03/17 23:29:11 christos Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@ -95,8 +95,7 @@ deflate_global(data, size, decomp, out)
|
|||
zbuf.avail_in = size; /* Total length of data to be processed */
|
||||
|
||||
if (!decomp) {
|
||||
MALLOC(buf[i].out, u_int8_t *, (u_long) size, M_CRYPTO_DATA,
|
||||
M_NOWAIT);
|
||||
buf[i].out = malloc(size, M_CRYPTO_DATA, M_NOWAIT);
|
||||
if (buf[i].out == NULL)
|
||||
goto bad;
|
||||
buf[i].size = size;
|
||||
|
@ -110,11 +109,10 @@ deflate_global(data, size, decomp, out)
|
|||
* updated while the decompression is going on
|
||||
*/
|
||||
|
||||
MALLOC(buf[i].out, u_int8_t *, (u_long) (size * 4),
|
||||
M_CRYPTO_DATA, M_NOWAIT);
|
||||
buf[i].size = size * 4;
|
||||
buf[i].out = malloc(buf[i].size, M_CRYPTO_DATA, M_NOWAIT);
|
||||
if (buf[i].out == NULL)
|
||||
goto bad;
|
||||
buf[i].size = size * 4;
|
||||
buf[i].flag = 1;
|
||||
i++;
|
||||
}
|
||||
|
@ -137,8 +135,7 @@ deflate_global(data, size, decomp, out)
|
|||
goto end;
|
||||
else if (zbuf.avail_out == 0 && i < (ZBUF - 1)) {
|
||||
/* we need more output space, allocate size */
|
||||
MALLOC(buf[i].out, u_int8_t *, (u_long) size,
|
||||
M_CRYPTO_DATA, M_NOWAIT);
|
||||
buf[i].out = malloc(size, M_CRYPTO_DATA, M_NOWAIT);
|
||||
if (buf[i].out == NULL)
|
||||
goto bad;
|
||||
zbuf.next_out = buf[i].out;
|
||||
|
@ -153,7 +150,7 @@ deflate_global(data, size, decomp, out)
|
|||
end:
|
||||
result = count = zbuf.total_out;
|
||||
|
||||
MALLOC(*out, u_int8_t *, (u_long) result, M_CRYPTO_DATA, M_NOWAIT);
|
||||
*out = malloc(result, M_CRYPTO_DATA, M_NOWAIT);
|
||||
if (*out == NULL)
|
||||
goto bad;
|
||||
if (decomp)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_inode.c,v 1.52 2005/12/11 12:25:25 christos Exp $ */
|
||||
/* $NetBSD: ext2fs_inode.c,v 1.53 2006/03/17 23:29:11 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1993
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.52 2005/12/11 12:25:25 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.53 2006/03/17 23:29:11 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -507,7 +507,7 @@ ext2fs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, daddr_t lastbn,
|
|||
bap = (int32_t *)bp->b_data; /* XXX ondisk32 */
|
||||
if (lastbn >= 0) {
|
||||
/* XXX ondisk32 */
|
||||
MALLOC(copy, int32_t *, fs->e2fs_bsize, M_TEMP, M_WAITOK);
|
||||
copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK);
|
||||
memcpy((caddr_t)copy, (caddr_t)bap, (u_int)fs->e2fs_bsize);
|
||||
memset((caddr_t)&bap[last + 1], 0,
|
||||
(u_int)(NINDIR(fs) - (last + 1)) * sizeof (u_int32_t));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ext2fs_lookup.c,v 1.40 2006/03/01 12:38:33 yamt Exp $ */
|
||||
/* $NetBSD: ext2fs_lookup.c,v 1.41 2006/03/17 23:29:11 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Modified for NetBSD 1.2E
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.40 2006/03/01 12:38:33 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ext2fs_lookup.c,v 1.41 2006/03/17 23:29:11 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -165,7 +165,7 @@ ext2fs_readdir(void *v)
|
|||
aiov.iov_len = e2fs_count;
|
||||
auio.uio_resid = e2fs_count;
|
||||
UIO_SETUP_SYSSPACE(&auio);
|
||||
MALLOC(dirbuf, caddr_t, e2fs_count, M_TEMP, M_WAITOK);
|
||||
dirbuf = malloc(e2fs_count, M_TEMP, M_WAITOK);
|
||||
if (ap->a_ncookies) {
|
||||
nc = ncookies = e2fs_count / 16;
|
||||
cookies = malloc(sizeof (off_t) * ncookies, M_TEMP, M_WAITOK);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_snapshot.c,v 1.24 2006/01/04 10:13:06 yamt Exp $ */
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.25 2006/03/17 23:29:12 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.24 2006/01/04 10:13:06 yamt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.25 2006/03/17 23:29:12 christos Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -254,7 +254,7 @@ ffs_snapshot(struct mount *mp, struct vnode *vp, struct timespec *ctime)
|
|||
* the suspension period.
|
||||
*/
|
||||
len = howmany(fs->fs_ncg, NBBY);
|
||||
MALLOC(fs->fs_active, u_char *, len, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
fs->fs_active = malloc(len, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
for (cg = 0; cg < fs->fs_ncg; cg++) {
|
||||
if ((error = ffs_balloc(vp, lfragtosize(fs, cgtod(fs, cg)),
|
||||
fs->fs_bsize, KERNCRED, 0, &nbp)) != 0)
|
||||
|
@ -466,7 +466,7 @@ loop:
|
|||
* keep us out of deadlock until the full one is ready.
|
||||
*/
|
||||
if (xp == NULL) {
|
||||
MALLOC(snapblklist, ufs2_daddr_t *,
|
||||
snapblklist = malloc(
|
||||
snaplistsize * sizeof(ufs2_daddr_t), M_UFSMNT, M_WAITOK);
|
||||
blkp = &snapblklist[1];
|
||||
*blkp++ = lblkno(fs, fs->fs_sblockloc);
|
||||
|
@ -549,7 +549,7 @@ out1:
|
|||
/*
|
||||
* Allocate space for the full list of preallocated snapshot blocks.
|
||||
*/
|
||||
MALLOC(snapblklist, ufs2_daddr_t *, snaplistsize * sizeof(ufs2_daddr_t),
|
||||
snapblklist = malloc(snaplistsize * sizeof(ufs2_daddr_t),
|
||||
M_UFSMNT, M_WAITOK);
|
||||
ip->i_snapblklist = &snapblklist[1];
|
||||
/*
|
||||
|
@ -908,7 +908,7 @@ indiracct_ufs1(struct vnode *snapvp, struct vnode *cancelvp, int level,
|
|||
last = howmany(remblks, blksperindir);
|
||||
if (last > NINDIR(fs))
|
||||
last = NINDIR(fs);
|
||||
MALLOC(bap, ufs1_daddr_t *, fs->fs_bsize, M_DEVBUF, M_WAITOK);
|
||||
bap = malloc(fs->fs_bsize, M_DEVBUF, M_WAITOK);
|
||||
bcopy(bp->b_data, (caddr_t)bap, fs->fs_bsize);
|
||||
brelse(bp);
|
||||
error = (*acctfunc)(snapvp, &bap[0], &bap[last], fs,
|
||||
|
@ -1176,7 +1176,7 @@ indiracct_ufs2(struct vnode *snapvp, struct vnode *cancelvp, int level,
|
|||
last = howmany(remblks, blksperindir);
|
||||
if (last > NINDIR(fs))
|
||||
last = NINDIR(fs);
|
||||
MALLOC(bap, ufs2_daddr_t *, fs->fs_bsize, M_DEVBUF, M_WAITOK);
|
||||
bap = malloc(fs->fs_bsize, M_DEVBUF, M_WAITOK);
|
||||
bcopy(bp->b_data, (caddr_t)bap, fs->fs_bsize);
|
||||
brelse(bp);
|
||||
error = (*acctfunc)(snapvp, &bap[0], &bap[last], fs,
|
||||
|
@ -1698,7 +1698,7 @@ ffs_snapshot_mount(struct mount *mp)
|
|||
snaplistsize = 1;
|
||||
} else
|
||||
snaplistsize = ufs_rw64(snaplistsize, ns);
|
||||
MALLOC(snapblklist, ufs2_daddr_t *,
|
||||
snapblklist = malloc(
|
||||
snaplistsize * sizeof(ufs2_daddr_t), M_UFSMNT, M_WAITOK);
|
||||
if (error)
|
||||
snapblklist[0] = 1;
|
||||
|
|
Loading…
Reference in New Issue