* [PATCH] fs:partitions:efi.c: bugfix a issue in find_valid_gpt
@ 2011-11-21 9:38 wangyanqing
2011-11-21 22:33 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: wangyanqing @ 2011-11-21 9:38 UTC (permalink / raw)
To: warns; +Cc: akpm, linux-kernel, tj, warns, jaxboe
I meet a 3T disk, which partitioned by Windows 7,
and linux report unknow partition table. But it can been
detected the partition table when I add gpt to boot
parameter.
This issue caused by the find_valid_gpt function will fail
out when check the legacy mbr failed if there is no gpt boot
parameter.
if boot without gpt, we should fail back to check the guid
partition table when check the legacy mbr failed instead of
fail out.
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
fs/partitions/efi.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
index 6296b40..302631e 100644
--- a/fs/partitions/efi.c
+++ b/fs/partitions/efi.c
@@ -543,8 +543,6 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
good_pmbr = is_pmbr_valid(legacymbr);
kfree(legacymbr);
}
- if (!good_pmbr)
- goto fail;
}
good_pgpt = is_gpt_valid(state, GPT_PRIMARY_PARTITION_TABLE_LBA,
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs:partitions:efi.c: bugfix a issue in find_valid_gpt
2011-11-21 9:38 [PATCH] fs:partitions:efi.c: bugfix a issue in find_valid_gpt wangyanqing
@ 2011-11-21 22:33 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2011-11-21 22:33 UTC (permalink / raw)
To: wangyanqing; +Cc: warns, linux-kernel, tj, jaxboe, Matt Domsch
On Mon, 21 Nov 2011 17:38:01 +0800
wangyanqing <udknight@gmail.com> wrote:
> I meet a 3T disk, which partitioned by Windows 7,
> and linux report unknow partition table. But it can been
> detected the partition table when I add gpt to boot
> parameter.
>
> This issue caused by the find_valid_gpt function will fail
> out when check the legacy mbr failed if there is no gpt boot
> parameter.
>
> if boot without gpt, we should fail back to check the guid
> partition table when check the legacy mbr failed instead of
> fail out.
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
> fs/partitions/efi.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
> index 6296b40..302631e 100644
> --- a/fs/partitions/efi.c
> +++ b/fs/partitions/efi.c
> @@ -543,8 +543,6 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
> good_pmbr = is_pmbr_valid(legacymbr);
> kfree(legacymbr);
> }
> - if (!good_pmbr)
> - goto fail;
> }
>
> good_pgpt = is_gpt_valid(state, GPT_PRIMARY_PARTITION_TABLE_LBA,
If we make this change then we didn't need to calculate good_pmbr. So
we didn't need to read the LBA and we didn't need to allocate and free
legacymbr. So afaict all this code just goes away:
--- a/fs/partitions/efi.c
+++ a/fs/partitions/efi.c
@@ -534,18 +534,6 @@
return 0;
lastlba = last_lba(state->bdev);
- if (!force_gpt) {
- /* This will be added to the EFI Spec. per Intel after v1.02. */
- legacymbr = kzalloc(sizeof (*legacymbr), GFP_KERNEL);
- if (legacymbr) {
- read_lba(state, 0, (u8 *) legacymbr,
- sizeof (*legacymbr));
- good_pmbr = is_pmbr_valid(legacymbr);
- kfree(legacymbr);
- }
- if (!good_pmbr)
- goto fail;
- }
good_pgpt = is_gpt_valid(state, GPT_PRIMARY_PARTITION_TABLE_LBA,
&pgpt, &pptes);
and I don't know what the implications of that would be.
Matt, could you please take a look at this?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-21 22:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 9:38 [PATCH] fs:partitions:efi.c: bugfix a issue in find_valid_gpt wangyanqing
2011-11-21 22:33 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox