From patchwork Fri Oct 17 19:27:51 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Ditto X-Patchwork-Id: 4901 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id BD444DE24A for ; Sat, 18 Oct 2008 06:28:26 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from tidalnetworks.net (mail.consentry.com [75.35.230.10]) by ozlabs.org (Postfix) with ESMTP id E550DDE114 for ; Sat, 18 Oct 2008 06:28:13 +1100 (EST) Received: from swdev19.tidalnetworks.net ([172.16.1.134]) by tidalnetworks.net over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 17 Oct 2008 12:28:07 -0700 Message-ID: <48F8E737.9090904@consentry.com> Date: Fri, 17 Oct 2008 12:27:51 -0700 From: Mike Ditto User-Agent: Thunderbird 2.0.0.17 (X11/20080914) MIME-Version: 1.0 To: linuxppc-dev@ozlabs.org Subject: Bug in boot code memcmp with zero length X-OriginalArrivalTime: 17 Oct 2008 19:28:07.0125 (UTC) FILETIME=[7B70D050:01C9308E] X-TM-AS-Product-Ver: SMEX-7.5.0.1243-5.5.1027-16224.001 X-TM-AS-Result: No--0.316400-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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