]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
disk: part_efi: fix regression due to incorrect buffer usage
authorStephen Warren <swarren@nvidia.com>
Fri, 28 Oct 2011 09:21:46 +0000 (09:21 +0000)
committerWolfgang Denk <wd@denx.de>
Mon, 5 Dec 2011 21:23:21 +0000 (22:23 +0100)
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@nvidia.com>
Acked-by: Doug Anderson <dianders@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
disk/part_efi.c

index e7f27147f12c505ff5932b46824fe766c73b616c..ddf80a73d2f1bf27dc4ad75dc46396a5a2d2ed40 100644 (file)
@@ -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;
        }