[syslinux:master] chain.c32: Handle nonlinear logical partitions
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Wed Jan 27 15:48:09 PST 2010
Commit-ID: 1b07af66b1632a5ae269770015583d1b8d48deed
Gitweb: http://syslinux.zytor.com/commit/1b07af66b1632a5ae269770015583d1b8d48deed
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 27 Jan 2010 15:45:01 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 27 Jan 2010 15:45:01 -0800
chain.c32: Handle nonlinear logical partitions
Some partitioning program, including at least parted, apparently
create the list of logical partition headers nonlinearly with the
partition themselves. Thus, make it a requirement that then fit
inside the overall extended partition, but not inside the
corresponding sublogical partition.
Reported-by: Gert Huselmans <gerth at zytor.com>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
com32/modules/chain.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 2dd8074..458ea89 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2003-2009 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -394,10 +394,13 @@ static struct part_entry *find_logical_partition(int whichpart, char *table,
/* Adjust the offset to account for the extended partition itself */
ptab[i].start_lba += self->start_lba;
- /* Sanity check entry: must not extend outside the extended partition.
- This is necessary since some OSes put crap in some entries. */
- if (ptab[i].start_lba + ptab[i].length <= self->start_lba ||
- ptab[i].start_lba >= self->start_lba + self->length)
+ /*
+ * Sanity check entry: must not extend outside the
+ * extended partition. This is necessary since some OSes
+ * put crap in some entries. Note that root is non-NULL here.
+ */
+ if (ptab[i].start_lba + ptab[i].length <= root->start_lba ||
+ ptab[i].start_lba >= root->start_lba + root->length)
continue;
/* OK, it's a data partition. Is it the one we're looking for? */
More information about the Syslinux-commits
mailing list