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: Robert Millan
Subject: Re: [PATCH] Bug fix for LVM
Date: Sat, 18 Jul 2009 21:11:14 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

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?

>  #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
>        if (! grub_util_check_char_device (device_name))
> -        grub_util_error ("%s is not a character device.\n", device_name);
> +     grub_util_error ("%s is not a character device.\n", device_name);
>  #else
>        if (! grub_util_check_block_device (device_name))
> -        grub_util_error ("%s is not a block device.\n", device_name);
> +     grub_util_error ("%s is not a block device.\n", device_name);
>  #endif

Looks like this slipped in.

> +  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.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."




reply via email to

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