From: Karel Zak Date: Mon, 28 Jan 2013 09:37:45 +0000 (+0100) Subject: fdisk: correctly initialize pointer to sun label X-Git-Tag: v2.23-rc1~125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aace6e9d1ce59fc6298c8a754e180ec00b149671;p=thirdparty%2Futil-linux.git fdisk: correctly initialize pointer to sun label Signed-off-by: Karel Zak --- diff --git a/fdisks/fdisksunlabel.c b/fdisks/fdisksunlabel.c index ecb6c1c55c..3c450ae1f5 100644 --- a/fdisks/fdisksunlabel.c +++ b/fdisks/fdisksunlabel.c @@ -137,11 +137,15 @@ static int sun_probe_label(struct fdisk_context *cxt) assert(cxt->label); assert(fdisk_is_disklabel(cxt, SUN)); - sunlabel = self_disklabel(cxt); + /* map first sector to header */ + sun = (struct fdisk_sun_label *) cxt->label; + sun->header = (struct sun_disk_label *) cxt->firstsector; + sunlabel = sun->header; if (sunlabel->magic != SUN_LABEL_MAGIC && sunlabel->magic != SUN_LABEL_MAGIC_SWAPPED) { other_endian = 0; + sun->header = NULL; return 0; /* failed */ }