nilfs2_probe used to fail with the partition which is 1 sector long,
since NILFS_SB2_OFFSET(x) returns negative number for x < 8. This
led to crash in ped_geometry_read_alloc().

* libparted/fs/nilfs2/nilfs2.c (nilfs2_probe): Make sure sb2off is
not negative.

Signed-off-by: Petr Uzel <[email protected]>
---
 libparted/fs/nilfs2/nilfs2.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
index 511b155..6a97443 100644
--- a/libparted/fs/nilfs2/nilfs2.c
+++ b/libparted/fs/nilfs2/nilfs2.c
@@ -115,6 +115,8 @@ nilfs2_probe (PedGeometry* geom)
                return NULL;
 
        sb2off = NILFS_SB2_OFFSET(length);
+       if (sb2off < 0)
+               sb2off = 0;
 
        if (ped_geometry_read_alloc(geom, &sb_v, 2, 1))
                sb = sb_v;
-- 
1.7.3.4


_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/parted-devel

Reply via email to