[U-Boot] [PATCH] disk: part_efi: fix regression due to incorrect buffer usage

Simon Glass sjg at chromium.org
Sat Oct 29 02:04:13 CEST 2011


On Fri, Oct 28, 2011 at 3:47 PM, Anton Staaf <robotboy at chromium.org> wrote:
> Thanks Stephen, sorry Doug.  :)
>
> -Anton
>
> On Fri, Oct 28, 2011 at 12:43 PM, Doug Anderson <dianders at chromium.org> wrote:
>> Acked-by: Doug Anderson <dianders at chromium.org>

Tested-by: Simon Glass <sjg at chromium.org>

>>
>> ...to be fair though, the regression appears to be caused by a mid-air
>> collision of Anton's change (f75dd584cdfe29dfdcfd424bb237b9238cfb8fe4) with
>> my change.  His patch was committed on Oct 25th (though authored earlier).
>>  When I submitted my patch on the Oct 19th against denx/master, I'm pretty
>> sure it was correct.
>>
>> Thank you for finding / fixing!  :)
>>
>> -Doug
>>
>> ---
>>
>> On Fri, Oct 28, 2011 at 12:21 PM, Stephen Warren <swarren at nvidia.com> wrote:
>>
>>> Commit deb5ca80275e8cfa74d5680b41204e08a095eca5 "disk: part_efi: fix
>>> **pgpt_pte == NULL" modified the code to pass "&gpt_head" to
>>> is_gpt_valid() rather than the previous "gpt_head". However, gpt_head
>>> is a pointer to the buffer, not the actual buffer, since it was allocated
>>> using ALLOC_CACHE_ALIGN_BUFFER. This caused is_gpt_valid() to read the
>>> disk block onto the stack rather than into the buffer, causing the
>>> code to fail.
>>>
>>> This change reverts that portion of the commit mentioned above.
>>>
>>> Signed-off-by: Stephen Warren <swarren at nvidia.com>
>>> ---
>>>  disk/part_efi.c |    4 ++--
>>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/disk/part_efi.c b/disk/part_efi.c
>>> index e7f2714..ddf80a7 100644
>>> --- a/disk/part_efi.c
>>> +++ b/disk/part_efi.c
>>> @@ -130,7 +130,7 @@ void print_part_efi(block_dev_desc_t * dev_desc)
>>>        }
>>>        /* This function validates AND fills in the GPT header and PTE */
>>>        if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
>>> -                        &(gpt_head), &gpt_pte) != 1) {
>>> +                        gpt_head, &gpt_pte) != 1) {
>>>                printf("%s: *** ERROR: Invalid GPT ***\n", __func__);
>>>                return;
>>>        }
>>> @@ -169,7 +169,7 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc,
>>> int part,
>>>
>>>        /* This function validates AND fills in the GPT header and PTE */
>>>        if (is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
>>> -                       &(gpt_head), &gpt_pte) != 1) {
>>> +                       gpt_head, &gpt_pte) != 1) {
>>>                printf("%s: *** ERROR: Invalid GPT ***\n", __func__);
>>>                return -1;
>>>        }
>>> --
>>> 1.7.0.4
>>>
>>>
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>
>>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>


More information about the U-Boot mailing list