Module Name:    src
Committed By:   ryo
Date:           Mon Jul 30 09:08:41 UTC 2018

Modified Files:
        src/sys/arch/aarch64/aarch64: copyinout.S

Log Message:
fix copy{in,out}str to return ENAMETOOLONG if the string is longer than len 
bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/aarch64/copyinout.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/copyinout.S
diff -u src/sys/arch/aarch64/aarch64/copyinout.S:1.6 src/sys/arch/aarch64/aarch64/copyinout.S:1.7
--- src/sys/arch/aarch64/aarch64/copyinout.S:1.6	Tue Jul 24 20:55:49 2018
+++ src/sys/arch/aarch64/aarch64/copyinout.S	Mon Jul 30 09:08:41 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: copyinout.S,v 1.6 2018/07/24 20:55:49 ryo Exp $ */
+/* $NetBSD: copyinout.S,v 1.7 2018/07/30 09:08:41 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,10 +29,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <sys/errno.h>
 #include <aarch64/asm.h>
 #include "assym.h"
 
-RCSID("$NetBSD: copyinout.S,v 1.6 2018/07/24 20:55:49 ryo Exp $");
+RCSID("$NetBSD: copyinout.S,v 1.7 2018/07/30 09:08:41 ryo Exp $");
 
 	.macro enter_cpu_onfault
 	stp	fp, lr, [sp, #-16]!	/* save fp, lr */
@@ -260,6 +261,8 @@ END(copyout)
 ENTRY(copyinstr)
 	enter_cpu_onfault
 
+	mov	x8, #0			/* error = 0 */
+
 	mov	x4, xzr			/* i = 0 */
 	cbz	x2, copyinstr_done	/* if (len == 0) goto done */
 copyinstr_loop:
@@ -271,14 +274,12 @@ copyinstr_loop:
 
 	cmp	x4, x2			/* if (i < len) goto loop */
 	bcc	copyinstr_loop
+	mov	x8, #ENAMETOOLONG	/* error = ENAMETOOLONG */
 
 copyinstr_done:
 	cbz	x3, 1f			/* if (done != NULL) *done = i */
 	str	x4, [x3]
 1:
-
-	mov	x8, #0			/* return 0 */
-
 	exit_cpu_onfault
 	ret
 END(copyinstr)
@@ -289,6 +290,8 @@ END(copyinstr)
 ENTRY(copyoutstr)
 	enter_cpu_onfault
 
+	mov	x8, #0			/* error = 0 */
+
 	mov	x4, xzr			/* i = 0 */
 	cbz	x2, copyoutstr_done	/* if (len == 0) goto done */
 copyoutstr_loop:
@@ -300,14 +303,12 @@ copyoutstr_loop:
 
 	cmp	x4, x2			/* if (i < len) goto loop */
 	bcc	copyoutstr_loop
+	mov	x8, #ENAMETOOLONG	/* error = ENAMETOOLONG */
 
 copyoutstr_done:
 	cbz	x3, 1f			/* if (done != NULL) *done = i */
 	str	x4, [x3]
 1:
-
-	mov	x8, #0			/* return 0 */
-
 	exit_cpu_onfault
 	ret
 END(copyoutstr)

Reply via email to