Mykola Ivanets
2018-Apr-26 09:55 UTC
[Libguestfs] [PATCH] libldm: fix enumeration of partition table entries
The commit fixes the bug in the code which inspects partition table entries in order to find LDM Metadata partion: _read_privhead_gpt function in ldm.c always calls gpt_get_pte function with 0 (zero) as a second argument which causes the described bug. --- src/ldm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ldm.c b/src/ldm.c index 4897de9..943f095 100644 --- a/src/ldm.c +++ b/src/ldm.c @@ -1345,7 +1345,7 @@ _read_privhead_gpt(const int fd, const gchar * const path, const guint secsize, for (uint32_t i = 0; i < gpt.pte_array_len; i++) { gpt_pte_t pte; - r = gpt_get_pte(h, 0, &pte); + r = gpt_get_pte(h, i, &pte); if (r < 0) { _map_gpt_error(r, path, err); gpt_close(h);
Richard W.M. Jones
2018-Apr-26 11:02 UTC
Re: [Libguestfs] [PATCH] libldm: fix enumeration of partition table entries
On Thu, Apr 26, 2018 at 12:55:30PM +0300, Mykola Ivanets wrote:> The commit fixes the bug in the code which inspects partition table > entries in order to find LDM Metadata partion: > > _read_privhead_gpt function in ldm.c always calls gpt_get_pte > function with 0 (zero) as a second argument which causes the > described bug. > --- > src/ldm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/ldm.c b/src/ldm.c > index 4897de9..943f095 100644 > --- a/src/ldm.c > +++ b/src/ldm.c > @@ -1345,7 +1345,7 @@ _read_privhead_gpt(const int fd, const gchar * const path, const guint secsize, > > for (uint32_t i = 0; i < gpt.pte_array_len; i++) { > gpt_pte_t pte; > - r = gpt_get_pte(h, 0, &pte); > + r = gpt_get_pte(h, i, &pte); > if (r < 0) { > _map_gpt_error(r, path, err); > gpt_close(h);Thanks. It seems like an obvious fix so I pushed it, along with a collection of downstream patches from Debian. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Reasonably Related Threads
- [libldm 1/3] relax uuid, zlib version requirements
- [PATCH 0/1] libldm: Make libldm to parse and return volume GUID.
- [PATCH libldm v2 0/1] Make libldm to parse and return volume GUID.
- [PATCH libldm v3 0/2] Make libldm to parse and return volume GUID.
- [PATCH libldm v4 0/3] Make libldm to parse and return volume GUID.