Btrfs: Fix an assert statement in __btrfs_map_block()
diff mbox series

Message ID 20190809140739.GA3552@mwanda
State New
Headers show
Series
  • Btrfs: Fix an assert statement in __btrfs_map_block()
Related show

Commit Message

Dan Carpenter Aug. 9, 2019, 2:07 p.m. UTC
The btrfs_get_chunk_map() never returns NULL, it returns error pointers.

Fixes: 89b798ad1b42 ("btrfs: Use btrfs_get_io_geometry appropriately")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/btrfs/volumes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nikolay Borisov Aug. 9, 2019, 2:36 p.m. UTC | #1
On 9.08.19 г. 17:07 ч., Dan Carpenter wrote:
> The btrfs_get_chunk_map() never returns NULL, it returns error pointers.
> 
> Fixes: 89b798ad1b42 ("btrfs: Use btrfs_get_io_geometry appropriately")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/volumes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 6edd1d57e530..e69d135c7d3c 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -5818,7 +5818,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
>  		return ret;
>  
>  	em = btrfs_get_chunk_map(fs_info, logical, *length);
> -	ASSERT(em);
> +	ASSERT(!IS_ERR(em));
>  	map = em->map_lookup;
>  
>  	*length = geom.len;
>
David Sterba Aug. 22, 2019, 2:14 p.m. UTC | #2
On Fri, Aug 09, 2019 at 05:07:39PM +0300, Dan Carpenter wrote:
> The btrfs_get_chunk_map() never returns NULL, it returns error pointers.
> 
> Fixes: 89b798ad1b42 ("btrfs: Use btrfs_get_io_geometry appropriately")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Queued for 5.3, thanks.

Patch
diff mbox series

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 6edd1d57e530..e69d135c7d3c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5818,7 +5818,7 @@  static int __btrfs_map_block(struct btrfs_fs_info *fs_info,
 		return ret;
 
 	em = btrfs_get_chunk_map(fs_info, logical, *length);
-	ASSERT(em);
+	ASSERT(!IS_ERR(em));
 	map = em->map_lookup;
 
 	*length = geom.len;