linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] btrfs: root->fs_info cleanup, add fs_info convenience variables
@ 2016-07-08 16:40 Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-07-08 16:40 UTC (permalink / raw)
  To: jeffm; +Cc: linux-btrfs

Hello Jeff Mahoney,

This is a semi-automatic email about new static checker warnings.

The patch b286384aac32: "btrfs: root->fs_info cleanup, add fs_info
convenience variables" from Jun 22, 2016, leads to the following
Smatch complaint:

fs/btrfs/export.c:238 btrfs_get_name()
	 warn: variable dereferenced before check 'inode' (see line 226)

fs/btrfs/export.c
   225		struct inode *dir = d_inode(parent);
   226		struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
                                                         ^^^^^^^^^^^
New dereference.

   227		struct btrfs_path *path;
   228		struct btrfs_root *root = BTRFS_I(dir)->root;
   229		struct btrfs_inode_ref *iref;
   230		struct btrfs_root_ref *rref;
   231		struct extent_buffer *leaf;
   232		unsigned long name_ptr;
   233		struct btrfs_key key;
   234		int name_len;
   235		int ret;
   236		u64 ino;
   237	
   238		if (!dir || !inode)
                             ^^^^^
Old code assumed it can be NULL.

   239			return -EINVAL;
   240	

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug report] btrfs: root->fs_info cleanup, add fs_info convenience variables
@ 2016-12-22 12:53 Dan Carpenter
  2016-12-22 14:18 ` Jeff Mahoney
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-12-22 12:53 UTC (permalink / raw)
  To: jeffm; +Cc: linux-btrfs

Hello Jeff Mahoney,

This is a semi-automatic email about new static checker warnings.

The patch 0b246afa62b0: "btrfs: root->fs_info cleanup, add fs_info 
convenience variables" from Jun 22, 2016, leads to the following 
Smatch complaint:

fs/btrfs/export.c:238 btrfs_get_name()
	 warn: variable dereferenced before check 'inode' (see line 226)

fs/btrfs/export.c
   225		struct inode *dir = d_inode(parent);
   226		struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
                                                         ^^^^^^^^^^^
Patch adds dereference.

   227		struct btrfs_path *path;
   228		struct btrfs_root *root = BTRFS_I(dir)->root;
   229		struct btrfs_inode_ref *iref;
   230		struct btrfs_root_ref *rref;
   231		struct extent_buffer *leaf;
   232		unsigned long name_ptr;
   233		struct btrfs_key key;
   234		int name_len;
   235		int ret;
   236		u64 ino;
   237	
   238		if (!dir || !inode)
                             ^^^^^
Old code checked for NULL.

   239			return -EINVAL;
   240	

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bug report] btrfs: root->fs_info cleanup, add fs_info convenience variables
  2016-12-22 12:53 Dan Carpenter
@ 2016-12-22 14:18 ` Jeff Mahoney
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Mahoney @ 2016-12-22 14:18 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 1469 bytes --]

On 12/22/16 7:53 AM, Dan Carpenter wrote:
> Hello Jeff Mahoney,
> 
> This is a semi-automatic email about new static checker warnings.

Hi Dan -

Thanks for the report.  We've already seen this one and the right fix is
to remove the checks in btrfs_get_name since exportfs won't pass
negative dentries.  The original reporter has submitted a patch for that.

-Jeff

> The patch 0b246afa62b0: "btrfs: root->fs_info cleanup, add fs_info 
> convenience variables" from Jun 22, 2016, leads to the following 
> Smatch complaint:
> 
> fs/btrfs/export.c:238 btrfs_get_name()
> 	 warn: variable dereferenced before check 'inode' (see line 226)
> 
> fs/btrfs/export.c
>    225		struct inode *dir = d_inode(parent);
>    226		struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
>                                                          ^^^^^^^^^^^
> Patch adds dereference.
> 
>    227		struct btrfs_path *path;
>    228		struct btrfs_root *root = BTRFS_I(dir)->root;
>    229		struct btrfs_inode_ref *iref;
>    230		struct btrfs_root_ref *rref;
>    231		struct extent_buffer *leaf;
>    232		unsigned long name_ptr;
>    233		struct btrfs_key key;
>    234		int name_len;
>    235		int ret;
>    236		u64 ino;
>    237	
>    238		if (!dir || !inode)
>                              ^^^^^
> Old code checked for NULL.
> 
>    239			return -EINVAL;
>    240	
> 
> regards,
> dan carpenter
> 


-- 
Jeff Mahoney
SUSE Labs


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 827 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-22 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-08 16:40 [bug report] btrfs: root->fs_info cleanup, add fs_info convenience variables Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2016-12-22 12:53 Dan Carpenter
2016-12-22 14:18 ` Jeff Mahoney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).