misc/159357: ZFS MAXNAMELEN macro has confusing name (off-by-one)

Robert Millan rmh at debian.org
Mon Aug 1 14:50:11 UTC 2011


>Number:         159357
>Category:       misc
>Synopsis:       ZFS MAXNAMELEN macro has confusing name (off-by-one)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 01 14:50:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Robert Millan
>Release:        FreeBSD 8.2
>Organization:
>Environment:
>Description:

It's not clear what MAXNAMELEN in ZFS compat environment means. Name indicates it's the maximum name length (for ZFS objects), but actual checks error out when requested name has the maximum length. In practice this makes it the maximum plus one:

./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c: if (dsl_dataset_namelen(ds) + 1 + strlen(snapname) >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c: if (dsl_dir_namelen(ds->ds_dir) + 1 + strlen(newsnapname) >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c: if (strlen(oldname) + delta >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c:   if (strlcat(zc->zc_name, "@", sizeof (zc->zc_name)) >= MAXNAMELEN) {
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c:           if (strlen(propname) >= ZAP_MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c:    if (strlen(propname) >= ZAP_MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c:            if (strlen(nvpair_name(elem)) >= ZAP_MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:             if (strlen(path) >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:             if (p-path >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c:             if (p-path >= MAXNAMELEN)
./sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c:      if (strlen(path) >= MAXNAMELEN) {
./sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c:      if (strlen(path) >= MAXNAMELEN) {
./sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c:              if (end - start >= MAXNAMELEN) {
./sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c:      if (strlen(pool) >= MAXNAMELEN) {
./cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c:     } else if (p - volname >= ZFS_MAXNAMELEN) {
./cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c:                  if (strlen(nvpair_name(elem)) >= ZAP_MAXNAMELEN) {

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list