This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: m_clalloc(ncl, nowait),whether ncl will be too large toalloc?
- From: Gary Thomas <gary at mlbassoc dot com>
- To: =?UTF-8?Q?=E5=BC=A0_?= =?UTF-8?Q?=E4=BA=AE?= <johnsonest at hotmail dot com>
- Cc: eCos Discussion <ecos-discuss at sources dot redhat dot com>
- Date: 01 Jan 2003 08:40:50 -0700
- Subject: Re: [ECOS] m_clalloc(ncl, nowait),whether ncl will be too large toalloc?
- References: <F141eakU75VZfrDS65w0000850c@hotmail.com>
On Tue, 2002-12-31 at 20:24, 张 亮 wrote:
>
> m_clalloc(ncl, nowait),whether ncl will be too large to alloc?
> when this occur,
>
>
> m_clalloc(ncl, nowait)
> register int ncl;
> int nowait;
> {
> #ifdef __ECOS
> caddr_t p;
> int i;
>
> if (ncl != 1) {
> panic("Allocate multiple clusters!");
> }
> p = (caddr_t)cyg_net_cluster_alloc();
> if (p == NULL) {
> m_reclaim();
> return (mclfree != NULL);
> }
> for (i = 0; i < ncl; i++) {//DANGER!
> ((union mcluster *)p)->mcl_next = mclfree;
> mclfree = (union mcluster *)p;
> p += MCLBYTES;
> mbstat.m_clfree++;
> }
> mbstat.m_clusters += ncl;
> return (1);
>
>
>
> p += MCLBYTES maybe overflowed!
> right?
No, because ncl == 1.
--
------------------------------------------------------------
Gary Thomas |
MLB Associates | Consulting for the
+1 (970) 229-1963 | Embedded world
http://www.mlbassoc.com/ |
email: <gary@mlbassoc.com> |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss