Bug 159357 - [zfs] ZFS MAXNAMELEN macro has confusing name (off-by-one)
Summary: [zfs] ZFS MAXNAMELEN macro has confusing name (off-by-one)
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Bugmeister
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-01 15:50 UTC by Robert Millan
Modified: 2025-01-19 06:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Millan 2011-08-01 15:50:10 UTC
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) {
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-08-05 02:33:39 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

reclassify.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:13 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2025-01-19 06:16:40 UTC
^Triage: I'm sorry that this PR did not get addressed in a timely fashion.

By now, the version that it was created against is long out of support.
As well, many newer versions of ZFS have been imported.

Please re-open if it is still a problem on a supported version.