Date: Fri, 13 Jul 2001 12:29:58 -0500 From: Alfred Perlstein <bright@sneakerz.org> To: "Eugene L. Vorokov" <vel@bugz.infotecs.ru> Cc: freebsd-hackers@freebsd.org Subject: Re: Some questions about kernel programming Message-ID: <20010713122958.S6664@sneakerz.org> In-Reply-To: <200107131529.f6DFTZI00705@bugz.infotecs.ru>; from vel@bugz.infotecs.ru on Fri, Jul 13, 2001 at 07:29:35PM %2B0400 References: <20010712212809.F6664@sneakerz.org> <200107131529.f6DFTZI00705@bugz.infotecs.ru>
index | next in thread | previous in thread | raw e-mail
* Eugene L. Vorokov <vel@bugz.infotecs.ru> [010713 10:16] wrote:
> > /*
> > * return number of characters in a userland address string
> > * or -1 if an illegal access occurs.
> > */
> Then I don't get it. Won't this piece of code cycle forever fetching
> first byte of the string again and again ? According to fetch(9)
> fubyte() doesn't change uaddr, or am I missing something again ?
> Am I allowed to do uaddr++ for userspace addresses in such a case ?
Yes, I forgot something:
> > int
> > user_strlen(uaddr)
> > char *uaddr;
> > {
> > int ret;
> >
> > ret = -1;
> > do {
> > ch = fubyte(uaddr);
> > ret++;
----------> uaddr++; <-------------
> > } while (ch != 0 && ch != -1);
> >
> > return (ch == -1 ? -1 : ret);
> > }
>
doh :)
--
-Alfred Perlstein [alfred@freebsd.org]
Ok, who wrote this damn function called '??'?
And why do my programs keep crashing in it?
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010713122958.S6664>
