[bug report] ovl: factor out ovl_free_fs() helper

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

 



Hello Miklos Szeredi,

The patch df6c653fd465: "ovl: factor out ovl_free_fs() helper" from
Nov 9, 2017, leads to the following static checker warning:

	fs/overlayfs/super.c:1260 ovl_fill_super()
	error: we previously assumed 'ofs' could be null (see line 1156)

fs/overlayfs/super.c
  1145  static int ovl_fill_super(struct super_block *sb, void *data, int silent)
  1146  {
  1147          struct path upperpath = { };
  1148          struct dentry *root_dentry;
  1149          struct ovl_entry *oe;
  1150          struct ovl_fs *ofs;
  1151          struct cred *cred;
  1152          int err;
  1153  
  1154          err = -ENOMEM;
  1155          ofs = kzalloc(sizeof(struct ovl_fs), GFP_KERNEL);
  1156          if (!ofs)
                     ^^^
kzalloc() fails

  1157                  goto out_err;
  1158  
  1159          ofs->creator_cred = cred = prepare_creds();
  1160          if (!cred)
  1161                  goto out_err;
  1162  

[ snip ]


  1252  
  1253          return 0;
  1254  
  1255  out_free_oe:
  1256          ovl_entry_stack_free(oe);
  1257          kfree(oe);
  1258  out_err:
  1259          path_put(&upperpath);
  1260          ovl_free_fs(ofs);
                            ^^^
it gets dereferenced inside the function.  The path_put() is a no-op at
that point.

  1261  
  1262          return err;
  1263  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux