Skip to content

Commit

Permalink
powerpc: Fix boot wrapper memcmp() called with zero length argument
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Ditto authored and Benjamin Herrenschmidt committed Oct 21, 2008
1 parent e817037 commit 59fd6b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/powerpc/boot/string.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -244,6 +244,8 @@ memcmp:
subf. r3,r0,r3
bdnzt 2,1b
blr
2: li r3,0
blr


/*
Expand Down

0 comments on commit 59fd6b8

Please sign in to comment.