grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Bug fix for LVM


From: Vladimir 'phcoder' Serbinenko
Subject: Re: [PATCH] Bug fix for LVM
Date: Sat, 18 Jul 2009 21:59:55 +0200

On Sat, Jul 18, 2009 at 9:43 PM, Bean<address@hidden> wrote:
> On Sun, Jul 19, 2009 at 3:11 AM, Robert Millan<address@hidden> wrote:
>> On Sat, Jul 18, 2009 at 10:11:19PM +0800, Bean wrote:
>>>      }
>>>
>>>    grub_raid_rescan ();
>>> +  grub_lvm_fini ();
>>> +  grub_lvm_init ();
>>
>> This is aside from this patch, but I don't see the purpose of this
>> grub_raid_rescan() function.  It's in raid.mod but only used by
>> grub-fstest, so at least it should be #ifdef'ed out, but looking at
>> what it does, it seems very ad-hoc.  It basically amounts to the
>> same you're doing with grub_lvm_fini() and grub_lvm_init().  Could
>> you fix this while at it?
>
> This is required. As raid and lvm scan device in init function, but
> grub-fstest uses loopback device, which hasn't been setup in
> grub_init_all. This code rescan raid and lvm, otherwise there won't be
> available.
>
This situation isn't strictly speaking restricted to grub-fstest then.
One would sensibly want to loopmount lvm image in grub shell. Is there
a way to do it cleanly?
>>> +  if (print == PRINT_ABSTRACTION)
>>> +    {
>>> +      char buf[30];
>>
>> This is a buffer overflow waiting to happen.  Please use asprintf(), this
>> will help you avoid the "&buf[1]" hack.
>>
>>> +      grub_disk_memberlist_t list = NULL, tmp;
>>> +      int is_lvm = 0;
>>> +      int is_raid = 0;
>>
>> I think you can add const qualifier in the is_lvm one.
>>
>>> +      is_lvm = (dev->disk->dev->id == GRUB_DISK_DEVICE_LVM_ID);
>>> +      is_raid |= (dev->disk->dev->id == GRUB_DISK_DEVICE_RAID_ID);
>>
>> No need for logic OR here.
>
> Ok.
>
> --
> Bean
>
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git




reply via email to

[Prev in Thread] Current Thread [Next in Thread]