]> git.karo-electronics.de Git - karo-tx-linux.git/commit
powerpc: Fix handling of strncmp with zero len
authorJeff Mahoney <jeffm@suse.com>
Wed, 17 Mar 2010 10:55:51 +0000 (10:55 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:22:19 +0000 (11:22 -0700)
commit875a8e03ec3a1ad083a6b308ce993710c5c54f0c
tree83d66739cd4ff91bdb1f76925d5c64b2d64ce8f0
parent9f819608412a8195c82ea8fb94b5755346f1b4ac
powerpc: Fix handling of strncmp with zero len

commit 637a99022fb119b90fb281715d13172f0394fc12 upstream.

Commit 0119536c, which added the assembly version of strncmp to
powerpc, mentions that it adds two instructions to the version from
boot/string.S to allow it to handle len=0. Unfortunately, it doesn't
always return 0 when that is the case. The length is passed in r5, but
the return value is passed back in r3. In certain cases, this will
happen to work. Otherwise it will pass back the address of the first
string as the return value.

This patch lifts the len <= 0 handling code from memcpy to handle that
case.

Reported by: Christian_Sellars@symantec.com
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/powerpc/lib/string.S