[PATCH] rheap.c rh_alloc_fixed

Rune Torgersen runet at innovsys.com
Tue Aug 30 08:43:28 EST 2005


rh_alloc_fixed() used by cpm_dpalloc_fixed incorrectly returned next
free area 
if the requested fixed area is not available.
This fixes it to return an error if requested area is not available.

Signed-off-by Rune Torgersen <runet at innovsys.com>

Index: linux-innsys/arch/ppc/lib/rheap.c
===================================================================
--- linux-innsys/arch/ppc/lib/rheap.c	(revision 29)
+++ linux-innsys/arch/ppc/lib/rheap.c	(working copy)
@@ -522,6 +522,10 @@
 	if (blk == NULL)
 		return ERR_PTR(-ENOMEM);
 
+	/* make sure block actually fits */
+	if (bs > s ) 
+		return ERR_PTR(-ENOMEM);
+
 	/* Perfect fit */
 	if (bs == s && be == e) {
 		/* Move from free list to taken list */



More information about the Linuxppc-embedded mailing list