Module Name: src Committed By: riastradh Date: Tue Apr 11 10:23:47 UTC 2023
Modified Files: src/sys/kern: tty.c Log Message: ttwrite(9): Assert we mangle uio_resid only if we also return error. To generate a diff of this commit: cvs rdiff -u -r1.308 -r1.309 src/sys/kern/tty.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/tty.c diff -u src/sys/kern/tty.c:1.308 src/sys/kern/tty.c:1.309 --- src/sys/kern/tty.c:1.308 Fri Feb 17 23:13:01 2023 +++ src/sys/kern/tty.c Tue Apr 11 10:23:47 2023 @@ -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);