All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeroen Dekkers <jeroen@vrijschrift.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] simplify grub_raid_array
Date: Fri, 08 Feb 2008 23:56:07 +0100	[thread overview]
Message-ID: <874pcj9hx4.wl@dekkers.cx> (raw)
In-Reply-To: <20080206225954.GA17090@thorin>

At Wed, 6 Feb 2008 23:59:54 +0100,
Robert Millan wrote:
> 
> On Wed, Feb 06, 2008 at 11:43:39PM +0100, Jeroen Dekkers wrote:
> > At Wed, 6 Feb 2008 17:45:07 +0100,
> > Robert Millan wrote:
> > > Unless I missed something, it seems that grub_raid_array contains redundant
> > > information (`name' is already present via `disk->name').  I propose to
> > > simplify it this way.
> > 
> > No idea why, I don't have the time to look at the actual code, but 
> >  
> > > @@ -410,7 +410,7 @@ grub_raid_scan_device (const char *name)
> > >  	  return 0;
> > >  	}
> > >    
> > > -      if (array->device[sb.this_disk.number].name != 0)
> > > +      if (array->device[sb.this_disk.number]->name != 0)
> > >  	{
> > >  	  /* We found multiple devices with the same number. Again,
> > >  	     this shouldn't happen.*/
> > 
> > looks suspicious to me. Is that really doing what it is meant to do?
> 
> Yes.  

No, it doesn't. The meaning of the check .name != 0 is whether a
device with that number already exists in the array. If .name is 0, it
doesn't exist yet, because else it would've been assigned
something. What you're now doing is wrong because if there isn't a
device in the array then array->device[sb.this_disk.number] is 0. I
guess the only reason this actually works is because the first page of
memory (the one at address 0) happens to be zero by luck.


Jeroen Dekkers



  reply	other threads:[~2008-02-08 22:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-06 16:45 [PATCH] simplify grub_raid_array Robert Millan
2008-02-06 22:43 ` Jeroen Dekkers
2008-02-06 22:59   ` Robert Millan
2008-02-08 22:56     ` Jeroen Dekkers [this message]
2008-02-08 23:09       ` Robert Millan
2008-02-08 12:31 ` Robert Millan

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=874pcj9hx4.wl@dekkers.cx \
    --to=jeroen@vrijschrift.org \
    --cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.