Source-Changes-HG archive

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

[src/trunk]: src/sys/kern ttwrite(9): Assert we mangle uio_resid only if we a...



details:   https://anonhg.NetBSD.org/src/rev/35ffd223cd2a
branches:  trunk
changeset: 374217:35ffd223cd2a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Apr 11 10:23:47 2023 +0000

description:
ttwrite(9): Assert we mangle uio_resid only if we also return error.

diffstat:

 sys/kern/tty.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 817f62cf23f5 -r 35ffd223cd2a sys/kern/tty.c
--- a/sys/kern/tty.c    Tue Apr 11 10:22:04 2023 +0000
+++ b/sys/kern/tty.c    Tue Apr 11 10:23:47 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.308 2023/02/17 23:13:01 riastradh Exp $      */
+/*     $NetBSD: tty.c,v 1.309 2023/04/11 10:23:47 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.308 2023/02/17 23:13:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.309 2023/04/11 10:23:47 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -2380,6 +2380,7 @@ ttwrite(struct tty *tp, struct uio *uio,
         * offset and iov pointers have moved forward, but it doesn't matter
         * (the call will either return short or restart with a new uio).
         */
+       KASSERTMSG(error || cc == 0, "error=%d cc=%d", error, cc);
        uio->uio_resid += cc;
        return (error);
 



Home | Main Index | Thread Index | Old Index