Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ufs Revert -r1.244-245 of ufs_vnops.c; they are wrong.



details:   https://anonhg.NetBSD.org/src/rev/2f28079fa07d
branches:  trunk
changeset: 449180:2f28079fa07d
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Feb 25 06:00:40 2019 +0000

description:
Revert -r1.244-245 of ufs_vnops.c; they are wrong.
Fix the mistake in -r1.243 that made them look like reasonable changes.

(this does not affect whether the -r1.243 change works with the union
mount path in libc, but fixes an immediate hazard)

diffstat:

 sys/ufs/ufs/ufs_vnops.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r f2046323612e -r 2f28079fa07d sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c   Mon Feb 25 04:56:30 2019 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c   Mon Feb 25 06:00:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $ */
+/*     $NetBSD: ufs_vnops.c,v 1.246 2019/02/25 06:00:40 dholland Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.245 2019/02/25 00:51:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.246 2019/02/25 06:00:40 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -1246,7 +1246,7 @@
        size_t          numcookies, maxcookies;
        /* disk buffer */
        off_t           physstart, physend;
-       size_t          skipstart;
+       size_t          skipstart, dropend;
        char            *rawbuf;
        size_t          rawbufmax, rawbytes;
        struct uio      rawuio;
@@ -1277,11 +1277,13 @@
        }
 
        skipstart = startoffset - physstart;
+       dropend = endoffset - physend;
 
        /* how much to actually read */
        rawbufmax = callerbytes + skipstart;
        if (rawbufmax < callerbytes)
                return EINVAL;
+       rawbufmax -= dropend;
 
        if (rawbufmax < _DIRENT_MINSIZE(rawdp)) {
                /* no room for even one struct direct */



Home | Main Index | Thread Index | Old Index