From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KODKs-0002EL-8c for mharc-grub-devel@gnu.org; Wed, 30 Jul 2008 11:11:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KODKq-0002CV-3b for grub-devel@gnu.org; Wed, 30 Jul 2008 11:11:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KODKp-0002BZ-7h for grub-devel@gnu.org; Wed, 30 Jul 2008 11:11:27 -0400 Received: from [199.232.76.173] (port=49221 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KODKo-0002B5-Mr for grub-devel@gnu.org; Wed, 30 Jul 2008 11:11:26 -0400 Received: from moutng.kundenserver.de ([212.227.126.174]:64573) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KODKn-0007D5-NR for grub-devel@gnu.org; Wed, 30 Jul 2008 11:11:26 -0400 Received: from [85.180.34.54] (e180034054.adsl.alicedsl.de [85.180.34.54]) by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis) id 0ML29c-1KODKl0zXm-0000tY; Wed, 30 Jul 2008 17:11:23 +0200 From: Felix Zielcke To: The development of GRUB 2 In-Reply-To: <1217417950.6234.6.camel@fz-deb.local> References: <1217286307.4016.107.camel@fz-deb.local> <20080730103708.GA17771@thorin> <1217417950.6234.6.camel@fz-deb.local> Content-Type: text/plain Date: Wed, 30 Jul 2008 17:11:24 +0200 Message-Id: <1217430684.6234.14.camel@fz-deb.local> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX19UvmjSIPb3dT7xtuNCkUglQGxPInK645wOA15 iTHteX0aw+ULRzN2BGAz3PQ+AIsLRkm4kdU/14GDwkSo7dmQVm BHPSXr5hI7QRmIoEnBOlMR/WCwKLadb X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) Subject: Re: [PATCH] show an error instead of segfaulting on grub-probe -t partmap on a unsynced raid 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: Wed, 30 Jul 2008 15:11:28 -0000 Am Mittwoch, den 30.07.2008, 13:39 +0200 schrieb Felix Zielcke: > for (i = 0; i < array->total_devs; i++) > { > if (array->device[i]) > > Above code isn't correct either, as you can see on my mail before in my testing case device[0] is 0x0 and device[1] is the working one. I don't think now that on RAID 1 there's a need for a warning/error on not fully synced mdraid Here's a patch which fixes this, if this is ok I'll have to think about the changelog. Please comment. Index: disk/raid.c =================================================================== --- disk/raid.c (Revision 1753) +++ disk/raid.c (Arbeitskopie) @@ -75,8 +75,10 @@ grub_disk_memberlist_t list = NULL, tmp; unsigned int i; - for (i = 0; i < array->total_devs; i++) + for (i = 0; i < GRUB_RAID_MAX_DEVICES; i++) { + if (! array->device[i]) + continue; tmp = grub_malloc (sizeof (*tmp)); tmp->disk = array->device[i]; tmp->next = list; @@ -213,7 +215,7 @@ { unsigned int i = 0; - for (i = 0; i < array->total_devs; i++) + for (i = 0; i < GRUB_RAID_MAX_DEVICES; i++) { if (array->device[i]) { Index: include/grub/raid.h =================================================================== --- include/grub/raid.h (Revision 1753) +++ include/grub/raid.h (Arbeitskopie) @@ -22,6 +22,8 @@ #include +#define GRUB_RAID_MAX_DEVICES 32 + struct grub_raid_array { int number; /* The device number, taken from md_minor so we @@ -37,7 +39,7 @@ char *name; /* That will be "md". */ grub_uint64_t disk_size; /* Size of an individual disk, in 512 byte sectors. */ - grub_disk_t device[32]; /* Array of total_devs devices. */ + grub_disk_t device[GRUB_RAID_MAX_DEVICES]; /* Array of total_devs devices. */ struct grub_raid_array *next; };