Re: [PATCH 06/11] xfsprogs: xfs_db: check null derefernce after block_to_bt

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

 



I think this is ok; another "should never happen" scenario,
so the ASSERT seems fine.

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

On 12/2/15 5:19 AM, Vivek Trivedi wrote:
> add assert if block_to_bt returns NULL to avoid null pointer
> dereference and get backtrace.
> Reported by coverity.
> 
> Signed-off-by: Vivek Trivedi <t.vivek@xxxxxxxxxxx>
> ---
>  db/btblock.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/db/btblock.c b/db/btblock.c
> index 46140fc..91593f8 100644
> --- a/db/btblock.c
> +++ b/db/btblock.c
> @@ -180,6 +180,7 @@ btblock_key_offset(
>  	struct xfs_db_btree	*bt = block_to_bt(block);
>  	int			offset;
>  
> +	ASSERT(bt != NULL);
>  	ASSERT(startoff == 0);
>  	ASSERT(block->bb_level != 0);
>  
> @@ -201,6 +202,7 @@ btblock_ptr_offset(
>  	int			offset;
>  	int			maxrecs;
>  
> +	ASSERT(bt != NULL);
>  	ASSERT(startoff == 0);
>  	ASSERT(block->bb_level != 0);
>  
> @@ -225,6 +227,7 @@ btblock_rec_offset(
>  	struct xfs_db_btree	*bt = block_to_bt(block);
>  	int			offset;
>  
> +	ASSERT(bt != NULL);
>  	ASSERT(startoff == 0);
>  	ASSERT(block->bb_level == 0);
>  
> 

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux