Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 fix copy{in, out}str to return ENAME...



details:   https://anonhg.NetBSD.org/src/rev/3ce98ef1625a
branches:  trunk
changeset: 365070:3ce98ef1625a
user:      ryo <ryo%NetBSD.org@localhost>
date:      Mon Jul 30 09:08:41 2018 +0000

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

diffstat:

 sys/arch/aarch64/aarch64/copyinout.S |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 05279c738776 -r 3ce98ef1625a sys/arch/aarch64/aarch64/copyinout.S
--- a/sys/arch/aarch64/aarch64/copyinout.S      Mon Jul 30 06:18:25 2018 +0000
+++ b/sys/arch/aarch64/aarch64/copyinout.S      Mon Jul 30 09:08:41 2018 +0000
@@ -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 @@
 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 @@
 
        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 @@
 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 @@
 
        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)



Home | Main Index | Thread Index | Old Index