Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Merge -r1.216 of ufs_vnops.c: comments about max...



details:   https://anonhg.NetBSD.org/src/rev/d92e6deec319
branches:  trunk
changeset: 345992:d92e6deec319
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Jun 19 22:07:17 2016 +0000

description:
Merge -r1.216 of ufs_vnops.c: comments about maxsymlinklen handling

diffstat:

 sys/ufs/lfs/lfs_vnops.c  |  11 +++++++++--
 sys/ufs/lfs/ulfs_vnops.c |  12 +++++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)

diffs (65 lines):

diff -r f8675b80a2eb -r d92e6deec319 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Sun Jun 19 22:03:06 2016 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Sun Jun 19 22:07:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.293 2015/09/21 01:24:23 dholland Exp $ */
+/*     $NetBSD: lfs_vnops.c,v 1.294 2016/06/19 22:07:17 dholland Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.293 2015/09/21 01:24:23 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.294 2016/06/19 22:07:17 dholland Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -654,6 +654,13 @@
        VN_KNOTE(ap->a_dvp, NOTE_WRITE);
        ip = VTOI(*vpp);
 
+       /*
+        * This test is off by one. um_maxsymlinklen contains the
+        * number of bytes available, and we aren't storing a \0, so
+        * the test should properly be <=. However, it cannot be
+        * changed as this would break compatibility with existing fs
+        * images -- see the way ulfs_readlink() works.
+        */
        len = strlen(ap->a_target);
        if (len < ip->i_lfs->um_maxsymlinklen) {
                memcpy((char *)SHORTLINK(ip), ap->a_target, len);
diff -r f8675b80a2eb -r d92e6deec319 sys/ufs/lfs/ulfs_vnops.c
--- a/sys/ufs/lfs/ulfs_vnops.c  Sun Jun 19 22:03:06 2016 +0000
+++ b/sys/ufs/lfs/ulfs_vnops.c  Sun Jun 19 22:07:17 2016 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: ulfs_vnops.c,v 1.36 2016/06/19 22:03:06 dholland Exp $ */
-/*  from NetBSD: NetBSD: ufs_vnops.c,v 1.215 2013/06/09 18:54:05 christos Exp  */
+/*     $NetBSD: ulfs_vnops.c,v 1.37 2016/06/19 22:07:17 dholland Exp $ */
+/*  from NetBSD: ufs_vnops.c,v 1.216 2013/06/16 00:13:58 dholland Exp  */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.36 2016/06/19 22:03:06 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.37 2016/06/19 22:07:17 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -912,6 +912,12 @@
        struct lfs *fs = ump->um_lfs;
        int             isize;
 
+       /*
+        * The test against um_maxsymlinklen is off by one; it should
+        * theoretically be <=, not <. However, it cannot be changed
+        * as that would break compatibility with existing fs images.
+        */
+
        isize = ip->i_size;
        if (isize < fs->um_maxsymlinklen ||
            (fs->um_maxsymlinklen == 0 && DIP(ip, blocks) == 0)) {



Home | Main Index | Thread Index | Old Index