powerpc: Fix boot wrapper memcmp() called with zero length argument
authorMike Ditto <mditto@consentry.com>
Fri, 17 Oct 2008 09:27:51 +0000 (09:27 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 21 Oct 2008 04:17:48 +0000 (15:17 +1100)
I noticed, when trying to use, e.g.,
node = find_node_by_prop_value(prev, "booleanprop", "", 0))
to search for all nodes with a certain boolean property, that memcmp()
returns garbage when comparing zero bytes.  It should return zero.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/boot/string.S

index 643e4cb2f11da67f3c55f237ff68fbda5b07687f..acc9428f27897d80db4cd65430fedf1069adbe6c 100644 (file)
@@ -235,7 +235,7 @@ memchr:
        .globl  memcmp
 memcmp:
        cmpwi   0,r5,0
-       blelr
+       ble     2f
        mtctr   r5
        addi    r6,r3,-1
        addi    r4,r4,-1
@@ -244,6 +244,8 @@ memcmp:
        subf.   r3,r0,r3
        bdnzt   2,1b
        blr
+2:     li      r3,0
+       blr
 
 
 /*