Date: Sat, 1 Aug 2009 14:32:33 +0800 From: MQ <antinvidia@gmail.com> To: Ed Schouten <ed@80386.nl> Cc: jmg@freebsd.org, =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= <des@des.no>, d@delphij.net, freebsd-arch@freebsd.org Subject: Re: [PATCH] type issue in kern_event.c Message-ID: <be0088ce0907312332m6ae8b9f1r7ca9ae17a9a27850@mail.gmail.com> In-Reply-To: <20090731221719.GS1292@hoeg.nl> References: <4A72B1DC.3040907@delphij.net> <86ocr062w9.fsf@ds4.des.no> <20090731221719.GS1292@hoeg.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
2009/8/1 Ed Schouten <ed@80386.nl>:
> Hi Dag-Erling,
>
> * Dag-Erling Sm=F8rgrav <des@des.no> wrote:
>> Xin LI <delphij@delphij.net> writes:
>> > I think these should be fixed, and here is my proposed patch.
>>
>> 404 Patch Not Found
>
> Xin Li sent it to me, but I think he has forgotten to add the lists back
> to Cc again. Here's the patch he sent to me earlier today.
>
> Index: kern_event.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- kern_event.c (revision 195945)
> +++ kern_event.c (working copy)
> @@ -1106,7 +1106,7 @@ kqueue_expand(struct kqueue *kq, struct filterops
> size =3D kq->kq_knlistsize;
> while (size <=3D fd)
> size +=3D KQEXTENT;
> - list =3D malloc(size * sizeof list, M_KQUEUE, mfl=
ag);
> + list =3D malloc(size * sizeof *list, M_KQUEUE, mf=
lag);
> if (list =3D=3D NULL)
> return ENOMEM;
> KQ_LOCK(kq);
> @@ -1116,13 +1116,13 @@ kqueue_expand(struct kqueue *kq, struct filterops
> } else {
> if (kq->kq_knlist !=3D NULL) {
> bcopy(kq->kq_knlist, list,
> - kq->kq_knlistsize * sizeof li=
st);
> + kq->kq_knlistsize * sizeof *l=
ist);
> free(kq->kq_knlist, M_KQUEUE);
> kq->kq_knlist =3D NULL;
> }
> bzero((caddr_t)list +
> kq->kq_knlistsize * sizeof list,
> - (size - kq->kq_knlistsize) * sizeof l=
ist);
> + (size - kq->kq_knlistsize) * sizeof *=
list);
> kq->kq_knlistsize =3D size;
> kq->kq_knlist =3D list;
> }
>
> --
> Ed Schouten <ed@80386.nl>
> WWW: http://80386.nl/
>
The sizof in the first argument of bzero should also be replaced.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?be0088ce0907312332m6ae8b9f1r7ca9ae17a9a27850>
