Module Name:    src
Committed By:   martin
Date:           Thu Jan 19 10:37:03 UTC 2023

Modified Files:
        src/common/lib/libc/arch/arm/string [netbsd-9]: strlen_arm.S

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1567):

        common/lib/libc/arch/arm/string/strlen_arm.S: revision 1.11

Fix strnlen with a large maxlen argument by using unsigned comparison
conditions - from mlelstv.

I had a similar, but not quite as good patch.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.26.1 \
    src/common/lib/libc/arch/arm/string/strlen_arm.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/common/lib/libc/arch/arm/string/strlen_arm.S
diff -u src/common/lib/libc/arch/arm/string/strlen_arm.S:1.9 src/common/lib/libc/arch/arm/string/strlen_arm.S:1.9.26.1
--- src/common/lib/libc/arch/arm/string/strlen_arm.S:1.9	Tue May  6 16:02:11 2014
+++ src/common/lib/libc/arch/arm/string/strlen_arm.S	Thu Jan 19 10:37:03 2023
@@ -29,7 +29,7 @@
 
 #include <machine/asm.h>
 
-RCSID("$NetBSD: strlen_arm.S,v 1.9 2014/05/06 16:02:11 joerg Exp $")
+RCSID("$NetBSD: strlen_arm.S,v 1.9.26.1 2023/01/19 10:37:03 martin Exp $")
 
 #if defined(__thumb__) && !defined(_ARM_ARCH_T2)
 #error Only Thumb2 or ARM supported
@@ -102,7 +102,7 @@ ENTRY(FUNCNAME)
 .Lmain_loop:
 #ifdef STRNLEN
 	cmp	r0, r5			/* gone too far? */
-	bge	.Lmaxed_out		/*   yes, return maxlen */
+	bhs	.Lmaxed_out		/*   yes, return maxlen */
 #endif
 	ldr	r3, [r0], #4		/* load next word */
 #if defined(_ARM_ARCH_6)
@@ -164,9 +164,9 @@ ENTRY(FUNCNAME)
 #ifdef STRNLEN
 	cmp	r0, r4			/* is it larger than maxlen? */
 #ifdef __thumb__
-	it	gt
+	it	hi
 #endif
-	movgt	r0, r4			/*   yes, return maxlen */
+	movhi	r0, r4			/*   yes, return maxlen */
 	pop	{r4, r5}		/* restore registers */
 #endif
 	RET				/* return */

Reply via email to