All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Ditto <mditto@consentry.com>
To: linuxppc-dev@ozlabs.org
Subject: Bug in boot code memcmp with zero length
Date: Fri, 17 Oct 2008 12:27:51 -0700	[thread overview]
Message-ID: <48F8E737.9090904@consentry.com> (raw)

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

                 reply	other threads:[~2008-10-17 19:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48F8E737.9090904@consentry.com \
    --to=mditto@consentry.com \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.