From owner-cvs-src@FreeBSD.ORG Fri Jun 4 00:38:19 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EBF7B16A4CE; Fri, 4 Jun 2004 00:38:19 -0700 (PDT) Received: from mailout1.pacific.net.au (mailout1.pacific.net.au [61.8.0.84]) by mx1.FreeBSD.org (Postfix) with ESMTP id 352E443D2D; Fri, 4 Jun 2004 00:38:19 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])i547cH4u027663; Fri, 4 Jun 2004 17:38:17 +1000 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i547cE2O014232; Fri, 4 Jun 2004 17:38:15 +1000 Date: Fri, 4 Jun 2004 17:38:13 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Nate Lawson In-Reply-To: <20040603160405.E45592@root.org> Message-ID: <20040604172728.X33153@gamplex.bde.org> References: <20040603223638.2187316A54D@hub.freebsd.org> <20040603160405.E45592@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: Poul-Henning Kamp cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/i386/include/pc bios.h src/sys/i386/i386 bios.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2004 07:38:20 -0000 On Thu, 3 Jun 2004, Nate Lawson wrote: > On Thu, 3 Jun 2004, Poul-Henning Kamp wrote: > > phk 2004/06/03 15:36:24 PDT > > ... > > +const u_char * > > +bios_string(u_int from, u_int to, const u_char *string, int len) > > +{ > > + const char *t, *te; > > + > > + if (len == 0) > > + len = strlen(string); > > + t = (const char *)(KERNBASE + from); > > + te = (const char *)(KERNBASE + to); > > + for (; t <= te; t++) > > + if (!memcmp(string, t, len)) > > + return (t); > > + return (NULL); > > } This has some style bugs: - dubious types for `from' and `to', Should probably be vm_offset_t. - wrong type for `len'. Should be size_t. - memcmp() should not be used in the kernel. It doesn't exist in some of my kernels. In -current, it is just a just a broken wrapper for bcmp() in the kernel. (memcmp() cannot be implemented using just bcmp(), since bcmp() returns a 2-state value while memcmp() returns a 3-state value.) - boolean comparison for the non-boolean value that should be returned by memcmp(). Bruce