linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: md/raid10: handle recovery of replacement devices.
@ 2011-11-15  6:32 Dan Carpenter
  2011-11-15  6:58 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-11-15  6:32 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: md/raid10: handle recovery of replacement devices.
  2011-11-15  6:32 md/raid10: handle recovery of replacement devices Dan Carpenter
@ 2011-11-15  6:58 ` NeilBrown
  0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2011-11-15  6:58 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-raid

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-15  6:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-15  6:32 md/raid10: handle recovery of replacement devices Dan Carpenter
2011-11-15  6:58 ` NeilBrown

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).