linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Zefan <lizefan@huawei.com>
To: Wang Sheng-Hui <shhuiw@gmail.com>
Cc: <chris.mason@fusionio.com>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: make sure fs_info is not null before its field is used in __btrfs_panic
Date: Sat, 8 Dec 2012 18:10:32 +0800	[thread overview]
Message-ID: <50C31218.6070807@huawei.com> (raw)
In-Reply-To: <1354894924-13050-1-git-send-email-shhuiw@gmail.com>

On 2012/12/7 23:42, Wang Sheng-Hui wrote:
> We should make sure fs_info is not null before we refer to its field.
> Add simple check here.

Why? Is there any caller passing NULL @fs_info to this function?

> 
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
> ---
>  fs/btrfs/super.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 915ac14..c6a3633 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -280,7 +280,7 @@ void __btrfs_panic(struct btrfs_fs_info *fs_info, const char *function,
>  	vaf.va = &args;
>  
>  	errstr = btrfs_decode_error(fs_info, errno, nbuf);
> -	if (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR)
> +	if (fs_info && (fs_info->mount_opt & BTRFS_MOUNT_PANIC_ON_FATAL_ERROR))
>  		panic(KERN_CRIT "BTRFS panic (device %s) in %s:%d: %pV (%s)\n",
>  			s_id, function, line, &vaf, errstr);
>  
> 


  reply	other threads:[~2012-12-08 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-07 15:42 [PATCH] Btrfs: make sure fs_info is not null before its field is used in __btrfs_panic Wang Sheng-Hui
2012-12-08 10:10 ` Li Zefan [this message]
2012-12-08 15:08   ` Wang Sheng-Hui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50C31218.6070807@huawei.com \
    --to=lizefan@huawei.com \
    --cc=chris.mason@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=shhuiw@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).