[bug report] NFS: Convert mount option parsing to use functionality from fs_parser.h

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

 



Hello Scott Mayhew,

The patch e38bb238ed8c: "NFS: Convert mount option parsing to use
functionality from fs_parser.h" from Dec 10, 2019, leads to the
following static checker warning:

	fs/namespace.c:1011 vfs_kern_mount()
	error: passing non negative 1 to ERR_PTR

fs/namespace.c
   988  struct vfsmount *vfs_kern_mount(struct file_system_type *type,
   989                                  int flags, const char *name,
   990                                  void *data)
   991  {
   992          struct fs_context *fc;
   993          struct vfsmount *mnt;
   994          int ret = 0;
   995  
   996          if (!type)
   997                  return ERR_PTR(-EINVAL);
   998  
   999          fc = fs_context_for_mount(type, flags);
  1000          if (IS_ERR(fc))
  1001                  return ERR_CAST(fc);
  1002  
  1003          if (name)
  1004                  ret = vfs_parse_fs_string(fc, "source",
  1005                                            name, strlen(name));

The nfs_fs_context_parse_param() function returns 1 if ->sloppy is true.
There are no comments explaining what the 1 means, but the comments for
vfs_parse_fs_param() say it should only return zero or negative error
codes.

        opt = fs_parse(fc, nfs_fs_parameters, param, &result);
        if (opt < 0)
                return ctx->sloppy ? 1 : opt;

I feel like this code is buggy, but if it's not then it really needs
some documentation.

  1006          if (!ret)
  1007                  ret = parse_monolithic_mount_data(fc, data);
  1008          if (!ret)
  1009                  mnt = fc_mount(fc);
  1010          else
  1011                  mnt = ERR_PTR(ret);
  1012  
  1013          put_fs_context(fc);
  1014          return mnt;
  1015  }
  1016  EXPORT_SYMBOL_GPL(vfs_kern_mount);

regards,
dan carpenter



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux