Date: Fri, 13 Jul 2001 19:29:35 +0400 (MSD) From: "Eugene L. Vorokov" <vel@bugz.infotecs.ru> To: Alfred Perlstein <bright@sneakerz.org> Cc: freebsd-hackers@freebsd.org Subject: Re: Some questions about kernel programming Message-ID: <200107131529.f6DFTZI00705@bugz.infotecs.ru> In-Reply-To: <20010712212809.F6664@sneakerz.org> "from Alfred Perlstein at Jul 12, 2001 09:28:09 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
> /*
> * return number of characters in a userland address string
> * or -1 if an illegal access occurs.
> */
> int
> user_strlen(uaddr)
> char *uaddr;
> {
> int ret;
>
> ret = -1;
> do {
> ch = fubyte(uaddr);
> ret++;
> } while (ch != 0 && ch != -1);
>
> return (ch == -1 ? -1 : ret);
> }
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 ?
Regards,
Eugene
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107131529.f6DFTZI00705>
