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: Bean
Subject: Re: [PATCH] Bug fix for LVM
Date: Wed, 29 Jul 2009 11:22:56 +0800

On Wed, Jul 29, 2009 at 1:42 AM, Robert Millan<address@hidden> wrote:
> On Tue, Jul 28, 2009 at 11:15:09PM +0800, Bean wrote:
>> -  buf2 = grub_zalloc (size);
>> +  buf2 = grub_malloc (size);
>>    if (!buf2)
>>      return grub_errno;
>>
>> +  grub_memset (buf, 0, size);
>
> We just received 'buf' as parameter.  Why do we have to zero it here?

Hi,

Because we are in a recovery function, the original content may not be
correct, we need to clear it out before continue.

>
>> +static int
>> +probe_raid_level (grub_disk_t disk)
>> +{
>> +  if (disk->dev->id != GRUB_DISK_DEVICE_RAID_ID)
>> +    return -1;
>> +
>> +  return ((struct grub_raid_array *) disk->data)->level;
>> +}
>
> Since this an ad-hoc function, could you put it in the same block that
> needs it?  If 'static' qualifier is present, it won't result in nested
> function AFAICT.

It's used by the next function probe, so unless we use nested
function, it can't be placed closer.

-- 
Bean




reply via email to

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