Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/booke copyoutstr(9): return ENAMETOOLONG co...



details:   https://anonhg.NetBSD.org/src/rev/ebd77d16d35b
branches:  trunk
changeset: 969902:ebd77d16d35b
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Mar 05 02:02:08 2020 +0000

description:
copyoutstr(9): return ENAMETOOLONG correctly when source string is
not NUL-terminated.

diffstat:

 sys/arch/powerpc/booke/copyout.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r d17aad8ca6c1 -r ebd77d16d35b sys/arch/powerpc/booke/copyout.c
--- a/sys/arch/powerpc/booke/copyout.c  Thu Mar 05 01:35:00 2020 +0000
+++ b/sys/arch/powerpc/booke/copyout.c  Thu Mar 05 02:02:08 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: copyout.c,v 1.7 2020/03/05 00:33:56 rin Exp $  */
+/*     $NetBSD: copyout.c,v 1.8 2020/03/05 02:02:08 rin Exp $  */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.7 2020/03/05 00:33:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.8 2020/03/05 02:02:08 rin Exp $");
 
 #define        __UFETCHSTORE_PRIVATE
 
@@ -432,13 +432,15 @@
                const uint8_t data = *ksaddr8++;
                copyout_uint8(udaddr8++, data, ds_msr);
                if (data == 0)
-                       break;
+                       goto out;
        }
+       rv = ENAMETOOLONG;
 
+out:
        pcb->pcb_onfault = NULL;
        if (done)
                *done = copylen;
-       return 0;
+       return rv;
 }
 #else
 /* XXX This version of copyoutstr(9) has never beeen enabled so far. */



Home | Main Index | Thread Index | Old Index