linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: md/raid10: handle recovery of replacement devices.
Date: Tue, 15 Nov 2011 17:58:02 +1100	[thread overview]
Message-ID: <20111115175802.498875b3@notabene.brown> (raw)
In-Reply-To: <20111115063239.GA30827@elgon.mountain>

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

On Tue, 15 Nov 2011 09:32:39 +0300 Dan Carpenter <dan.carpenter@oracle.com>
wrote:

> Hello NeilBrown,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch e1f6cbf7e1b0: "md/raid10: handle recovery of replacement 
> devices." from Nov 9, 2011, leads to the following Smatch complaint:
> 
> drivers/md/raid10.c +2814 sync_request()
> 	 error: we previously assumed 'bio' could be null (see line 2808)
> 
> drivers/md/raid10.c
>   2807					bio = r10_bio->devs[1].repl_bio;
>   2808					if (bio)
>                                             ^^^
> check.
> 
>   2809						bio->bi_end_io = NULL;
>   2810					rdev = mirror->replacement;
>   2811					if (rdev == NULL ||
>   2812					    test_bit(Faulty, &rdev->flags))
>   2813						break;
>   2814					bio->bi_next = biolist;
>                                         ^^^^^^^^^^^^
> unconditional dereference.
> 
>   2815					biolist = bio;
>   2816					bio->bi_private = r10_bio;
> 
> regards,
> dan carpenter


Thanks.

I happen to know that if mirror->replacement is not NULL, then
conf->have_replacement is true, so r10buf_pool_alloc will have allocated
[1].repl_bio so if we get to 2814, bio will definitely be non-NULL.

Still, it wouldn't hurt to add a test for 'bio' to keep match happy, and put
in a big comment to keep reviewers happy.  I'll consider doing that.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2011-11-15  6:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15  6:32 md/raid10: handle recovery of replacement devices Dan Carpenter
2011-11-15  6:58 ` NeilBrown [this message]

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=20111115175802.498875b3@notabene.brown \
    --to=neilb@suse.de \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-raid@vger.kernel.org \
    /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).