Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Yan Zheng <zheng.yan@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: smatch stuff: potential NULL dereference in btrfs_rm_device()
Date: Tue, 8 Nov 2011 17:59:45 +0300	[thread overview]
Message-ID: <20111108145944.GA30841@elgon.mountain> (raw)

Hi Yan,

Smatch complains about this code from 2008.

fs/btrfs/volumes.c +1417 btrfs_rm_device(157)
	error: we previously assumed 'fs_devices' could be null (see line 1412)

  1412                  while (fs_devices) {
                               ^^^^^^^^^^
checked here.

  1413                          if (fs_devices->seed == cur_devices)
  1414                                  break;
  1415                          fs_devices = fs_devices->seed;
  1416                  }
  1417                  fs_devices->seed = cur_devices->seed;
                        ^^^^^^^^^^^^
dereferenced here.

If we don't hit the break statement, then at the end of the loop we'd
oops.

regards,
dan carpenter

             reply	other threads:[~2011-11-08 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-08 14:59 Dan Carpenter [this message]
2011-11-08 15:16 ` smatch stuff: potential NULL dereference in btrfs_rm_device() Ilya Dryomov

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=20111108145944.GA30841@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zheng.yan@oracle.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