[Ocfs2-devel] fs/ocfs2/super.c:1809 ocfs2_mount_volume() warn: missing error code 'status'

Dan Carpenter error27 at gmail.com
Mon Nov 7 07:52:55 UTC 2022


On Sun, Nov 06, 2022 at 08:38:07PM +0800, Joseph Qi wrote:
> 
> 
> On 11/5/22 7:15 PM, Dan Carpenter wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   10d916c86ecafeccaed89175ebf9b832dddde380
> > commit: 0737e01de9c411e4db87dcedf4a9789d41b1c5c1 ocfs2: ocfs2_mount_volume does cleanup job before return error
> > config: alpha-randconfig-m041-20221030
> > compiler: alpha-linux-gcc (GCC) 12.1.0
> > 
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <lkp at intel.com>
> > | Reported-by: Dan Carpenter <error27 at gmail.com>
> > 
> > smatch warnings:
> > fs/ocfs2/super.c:1809 ocfs2_mount_volume() warn: missing error code 'status'
> > 
> > vim +/status +1809 fs/ocfs2/super.c
> > 
> > ccd979bdbce9fba Mark Fasheh                 2005-12-15  1802  
> > ccd979bdbce9fba Mark Fasheh                 2005-12-15  1803  static int ocfs2_mount_volume(struct super_block *sb)
> > ccd979bdbce9fba Mark Fasheh                 2005-12-15  1804  {
> > ccd979bdbce9fba Mark Fasheh                 2005-12-15  1805  	int status = 0;
> > ccd979bdbce9fba Mark Fasheh                 2005-12-15  1806  	struct ocfs2_super *osb = OCFS2_SB(sb);
> > ccd979bdbce9fba Mark Fasheh                 2005-12-15  1807  
> > ccd979bdbce9fba Mark Fasheh                 2005-12-15  1808  	if (ocfs2_is_hard_readonly(osb))
> > 0737e01de9c411e Heming Zhao via Ocfs2-devel 2022-04-29 @1809  		goto out;
> > 
> > Unclear if this is an error path or a success path.  Honestly, I would
> > have thought the checker is correct that it looks like a failure path.
> > 
> This indicates a readonly mount and bypasses dlm related initialization.
> So it seems an expected success return.
> 

A comment would help.  Another way to silence this static checker warning
and answer any reviewer questions would be to set the "ret = 0;" within
4 lines of the goto.

	if (ocfs2_is_hard_readonly(osb)) {
		status = 0;
		goto out;
	}

regards,
dan carpenter




More information about the Ocfs2-devel mailing list