From owner-freebsd-hackers Fri Jul 13 8:16:16 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from bugz.infotecs.ru (bugz.infotecs.ru [195.210.139.22]) by hub.freebsd.org (Postfix) with ESMTP id 34BC037B403 for ; Fri, 13 Jul 2001 08:16:13 -0700 (PDT) (envelope-from vel@bugz.infotecs.ru) Received: (from root@localhost) by bugz.infotecs.ru (8.11.1/8.11.1) id f6DFTZI00705; Fri, 13 Jul 2001 19:29:35 +0400 (MSD) (envelope-from vel) From: "Eugene L. Vorokov" Message-Id: <200107131529.f6DFTZI00705@bugz.infotecs.ru> Subject: Re: Some questions about kernel programming In-Reply-To: <20010712212809.F6664@sneakerz.org> "from Alfred Perlstein at Jul 12, 2001 09:28:09 pm" To: Alfred Perlstein Date: Fri, 13 Jul 2001 19:29:35 +0400 (MSD) Cc: freebsd-hackers@freebsd.org X-Mailer: ELM [version 2.4ME+ PL82 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > /* > * 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