linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: linux-raid@vger.kernel.org, mingo@redhat.com, dledford@redhat.com
Subject: Re: Curious code in autostart_array
Date: Thu, 22 Jun 2006 21:11:52 -0700	[thread overview]
Message-ID: <449B6A08.4080506@zytor.com> (raw)
In-Reply-To: <20060622210521.0aa68ec6.zaitcev@redhat.com>

Pete Zaitcev wrote:
> Hi, guys:
> 
> My copy of 2.6.17-rc5 has the following code in autostart_array():
> 		mdp_disk_t *desc = sb->disks + i;
> 		dev_t dev = MKDEV(desc->major, desc->minor);
> 
> 		if (!dev)
> 			continue;
> 		if (dev == startdev)
> 			continue;
> 		if (MAJOR(dev) != desc->major || MINOR(dev) != desc->minor)
> 			continue;
> 
> Under what conditions do you think the last if() statement can fire?
> What is its purpose? This looks like an attempt to detect bit clipping.
> But what exactly?
> 

It can fire if either desc->major or desc->minor overflow the respective 
fields in dev_t.  Unfortunately, it's not guaranteed to do so.

	-hpa

  reply	other threads:[~2006-06-23  4:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-23  4:05 Curious code in autostart_array Pete Zaitcev
2006-06-23  4:11 ` H. Peter Anvin [this message]
2006-06-23  4:46 ` Neil Brown
2006-06-23  5:25   ` Pete Zaitcev

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=449B6A08.4080506@zytor.com \
    --to=hpa@zytor.com \
    --cc=dledford@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=zaitcev@redhat.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).