From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JNcNa-0000NJ-DA for mharc-grub-devel@gnu.org; Fri, 08 Feb 2008 18:11:34 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JNcNY-0000KJ-Uv for grub-devel@gnu.org; Fri, 08 Feb 2008 18:11:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JNcNX-0000HH-EL for grub-devel@gnu.org; Fri, 08 Feb 2008 18:11:32 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JNcNX-0000H4-B3 for grub-devel@gnu.org; Fri, 08 Feb 2008 18:11:31 -0500 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JNcNW-0002N7-W4 for grub-devel@gnu.org; Fri, 08 Feb 2008 18:11:31 -0500 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1JNcNT-0007pU-Tr for grub-devel@gnu.org; Sat, 09 Feb 2008 00:11:30 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1JNcLi-0004Wj-BY for grub-devel@gnu.org; Sat, 09 Feb 2008 00:09:38 +0100 Date: Sat, 9 Feb 2008 00:09:38 +0100 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080208230938.GA17287@thorin> References: <20080206164507.GA3287@thorin> <87bq6thfj8.wl@dekkers.cx> <20080206225954.GA17090@thorin> <874pcj9hx4.wl@dekkers.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <874pcj9hx4.wl@dekkers.cx> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: [PATCH] simplify grub_raid_array X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2008 23:11:33 -0000 On Fri, Feb 08, 2008 at 11:56:07PM +0100, Jeroen Dekkers wrote: > 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. Yep. I just fixed this a while ago (Sam caught that in a segfault). Does it look good now? -- Robert Millan I know my rights; I want my phone call! What use is a phone call… if you are unable to speak? (as seen on /.)