forked from pool/parted
partition on the disk (bnc#735763) - fix-nilfs2-probe-function.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=60
39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From 2147402b83b27a35011cad032d0519c4a0672280 Mon Sep 17 00:00:00 2001
|
|
From: Jim Meyering <meyering@redhat.com>
|
|
Date: Sat, 25 Jun 2011 08:49:58 +0200
|
|
Subject: [PATCH] libparted: fix a bug in the nilfs2 probe function
|
|
|
|
* libparted/fs/nilfs2/nilfs2.c (nilfs2_probe): Reject this partition
|
|
if we get a negative sb2 offset. Passing a negative offset to
|
|
ped_geometry_read_alloc would evoke a failed assertion.
|
|
Bug introduced by 2010-07-09 commit d463e7de.
|
|
* NEWS: (Bug fixes): Mention it.
|
|
Reported by Daniel Fandrich in
|
|
http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10466/focus=10472
|
|
---
|
|
NEWS | 3 +++
|
|
libparted/fs/nilfs2/nilfs2.c | 5 +++--
|
|
2 files changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
Index: parted-2.4/libparted/fs/nilfs2/nilfs2.c
|
|
===================================================================
|
|
--- parted-2.4.orig/libparted/fs/nilfs2/nilfs2.c
|
|
+++ parted-2.4/libparted/fs/nilfs2/nilfs2.c
|
|
@@ -108,13 +108,14 @@ nilfs2_probe (PedGeometry* geom)
|
|
struct nilfs2_super_block *sb = NULL;
|
|
struct nilfs2_super_block *sb2 = NULL;
|
|
PedSector length = geom->length;
|
|
- PedSector sb2off;
|
|
|
|
/* ignore if sector size is not 512bytes for now */
|
|
if (geom->dev->sector_size != PED_SECTOR_SIZE_DEFAULT)
|
|
return NULL;
|
|
|
|
- sb2off = NILFS_SB2_OFFSET(length);
|
|
+ PedSector sb2off = NILFS_SB2_OFFSET(length);
|
|
+ if (sb2off <= 2)
|
|
+ return NULL;
|
|
|
|
if (ped_geometry_read_alloc(geom, &sb_v, 2, 1))
|
|
sb = sb_v;
|