Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in hea driver?



Hi all,

could someone please comment on the attached patch? There seems to be a
bug in the on-card memory allocator. The problem is, that when we need to
split a block that appears to be large enough because of alignment, we
want to check, that what remains after splitting is large enough (with
regard to the size we are trying to allocated), not that it is >= 0. The
test for >= 0 should always be true, because a block of size N (N beeing a
power of two) always contains an address that is aligned to N, so that the
upper half when splitting such a block is always >= 0.

harti

-- 
harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private
              brandt@xxxxxxxxxxxxxxxxxxx, harti@xxxxxxxxxxx
Index: eni_buffer.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/hea/eni_buffer.c,v
retrieving revision 1.15
diff -u -r1.15 eni_buffer.c
--- eni_buffer.c	8 Nov 2002 18:27:28 -0000	1.15
+++ eni_buffer.c	11 Feb 2003 10:19:58 -0000
@@ -267,7 +267,7 @@
 		    /*
 		     * If we use this alignment, will it still fit?
 		     */
-		    if ( (eptr->size - (nbase - eptr->base)) >= 0 )
+		    if ( (eptr->size - (nbase - eptr->base)) >= nsize )
 		    {
 			Mbd	*etmp;