On Wed, May 02, 2018 at 09:28:35AM -0500, Eric Sandeen wrote: > On 5/2/18 9:24 AM, Darrick J. Wong wrote: > > On Tue, May 01, 2018 at 06:04:09PM -0500, Eric Sandeen wrote: > >> The GET ioctl is trivial, just return the current label. > >> +static int > >> +xfs_ioc_getlabel( > >> + struct xfs_mount *mp, > >> + char __user *label) > >> +{ > >> + struct xfs_sb *sbp = &mp->m_sb; > >> + > >> + /* Paranoia */ > >> + BUILD_BUG_ON(sizeof(sbp->sb_fname) > FSLABEL_MAX); > >> + > >> + if (copy_to_user(label, sbp->sb_fname, sizeof(sbp->sb_fname))) > > > > Needs to ensure that a null is set at the end of the (userspace) buffer > > just in case the label is "123456789012". > > Oh, yup! > > > There's nothing in the documentation for this ioctl <cough> that says > > the passed in buffer must already be zeroed. > > where /do/ we document ioctls like this, anyway? man pages. You should really cc linux-api@xxxxxxxxxxxxxxx on any patch that introduces/hoists a new VFS ioctl, as well as the man page patch to document it. Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html