* Bug in boot code memcmp with zero length
@ 2008-10-17 19:27 Mike Ditto
0 siblings, 0 replies; only message in thread
From: Mike Ditto @ 2008-10-17 19:27 UTC (permalink / raw)
To: linuxppc-dev
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.
Index: arch/powerpc/boot/string.S
===================================================================
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 string.S
--- arch/powerpc/boot/string.S 11 Oct 2008 02:51:35 -0000 1.1.1.1
+++ arch/powerpc/boot/string.S 17 Oct 2008 19:11:18 -0000
@@ -235,7 +235,7 @@
.globl memcmp
memcmp:
cmpwi 0,r5,0
- blelr
+ ble 2f
mtctr r5
addi r6,r3,-1
addi r4,r4,-1
@@ -243,6 +243,8 @@
lbzu r0,1(r4)
subf. r3,r0,r3
bdnzt 2,1b
+ blr
+2: li r3,0
blr
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-17 19:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-17 19:27 Bug in boot code memcmp with zero length Mike Ditto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.