Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 May 2011 16:40:42 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221969 - stable/8/sys/geom/part
Message-ID:  <201105151640.p4FGegjq044916@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Sun May 15 16:40:42 2011
New Revision: 221969
URL: http://svn.freebsd.org/changeset/base/221969

Log:
  MFC r221644,221645,221652,221656,221658:
    Limit number of sectors that can be addressed.
  
  MFC r221647:
    Replace UINT_MAX to UINT32_MAX.

Modified:
  stable/8/sys/geom/part/g_part_bsd.c
  stable/8/sys/geom/part/g_part_ebr.c
  stable/8/sys/geom/part/g_part_mbr.c
  stable/8/sys/geom/part/g_part_pc98.c
  stable/8/sys/geom/part/g_part_vtoc8.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/geom/part/g_part_bsd.c
==============================================================================
--- stable/8/sys/geom/part/g_part_bsd.c	Sun May 15 16:33:13 2011	(r221968)
+++ stable/8/sys/geom/part/g_part_bsd.c	Sun May 15 16:40:42 2011	(r221969)
@@ -203,7 +203,7 @@ g_part_bsd_create(struct g_part_table *b
 	if (BBSIZE % pp->sectorsize)
 		return (ENOTBLK);
 
-	msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff);
+	msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 	secpercyl = basetable->gpt_sectors * basetable->gpt_heads;
 	ncyls = msize / secpercyl;
 
@@ -362,7 +362,7 @@ g_part_bsd_read(struct g_part_table *bas
 
 	pp = cp->provider;
 	table = (struct g_part_bsd_table *)basetable;
-	msize = pp->mediasize / pp->sectorsize;
+	msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 
 	table->bbarea = g_read_data(cp, 0, BBSIZE, &error);
 	if (table->bbarea == NULL)

Modified: stable/8/sys/geom/part/g_part_ebr.c
==============================================================================
--- stable/8/sys/geom/part/g_part_ebr.c	Sun May 15 16:33:13 2011	(r221968)
+++ stable/8/sys/geom/part/g_part_ebr.c	Sun May 15 16:40:42 2011	(r221969)
@@ -280,7 +280,7 @@ g_part_ebr_create(struct g_part_table *b
 	if (strcmp(psn, "MBR"))
 		return (ENXIO);
 
-	msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff);
+	msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 	msize -= msize % basetable->gpt_sectors;
 	basetable->gpt_first = 0;
 	basetable->gpt_last = msize - 1;
@@ -472,7 +472,7 @@ g_part_ebr_read(struct g_part_table *bas
 
 	pp = cp->provider;
 	table = (struct g_part_ebr_table *)basetable;
-	msize = pp->mediasize / pp->sectorsize;
+	msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 
 	lba = 0;
 	while (1) {

Modified: stable/8/sys/geom/part/g_part_mbr.c
==============================================================================
--- stable/8/sys/geom/part/g_part_mbr.c	Sun May 15 16:33:13 2011	(r221968)
+++ stable/8/sys/geom/part/g_part_mbr.c	Sun May 15 16:40:42 2011	(r221969)
@@ -259,7 +259,7 @@ g_part_mbr_create(struct g_part_table *b
 	if (pp->sectorsize < MBRSIZE)
 		return (ENOSPC);
 
-	msize = MIN(pp->mediasize / pp->sectorsize, 0xffffffff);
+	msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 	basetable->gpt_first = basetable->gpt_sectors;
 	basetable->gpt_last = msize - (msize % basetable->gpt_sectors) - 1;
 
@@ -430,7 +430,7 @@ g_part_mbr_read(struct g_part_table *bas
 
 	pp = cp->provider;
 	table = (struct g_part_mbr_table *)basetable;
-	msize = pp->mediasize / pp->sectorsize;
+	msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 
 	buf = g_read_data(cp, 0L, pp->sectorsize, &error);
 	if (buf == NULL)

Modified: stable/8/sys/geom/part/g_part_pc98.c
==============================================================================
--- stable/8/sys/geom/part/g_part_pc98.c	Sun May 15 16:33:13 2011	(r221968)
+++ stable/8/sys/geom/part/g_part_pc98.c	Sun May 15 16:40:42 2011	(r221969)
@@ -233,7 +233,7 @@ g_part_pc98_create(struct g_part_table *
 
 	cyl = basetable->gpt_heads * basetable->gpt_sectors;
 
-	msize = MIN(pp->mediasize / SECSIZE, 0xffffffff);
+	msize = MIN(pp->mediasize / SECSIZE, UINT32_MAX);
 	basetable->gpt_first = cyl;
 	basetable->gpt_last = msize - (msize % cyl) - 1;
 
@@ -417,7 +417,7 @@ g_part_pc98_read(struct g_part_table *ba
 
 	pp = cp->provider;
 	table = (struct g_part_pc98_table *)basetable;
-	msize = pp->mediasize / SECSIZE;
+	msize = MIN(pp->mediasize / SECSIZE, UINT32_MAX);
 
 	buf = g_read_data(cp, 0L, 2 * SECSIZE, &error);
 	if (buf == NULL)

Modified: stable/8/sys/geom/part/g_part_vtoc8.c
==============================================================================
--- stable/8/sys/geom/part/g_part_vtoc8.c	Sun May 15 16:33:13 2011	(r221968)
+++ stable/8/sys/geom/part/g_part_vtoc8.c	Sun May 15 16:40:42 2011	(r221969)
@@ -195,9 +195,7 @@ g_part_vtoc8_create(struct g_part_table 
 
 	table = (struct g_part_vtoc8_table *)basetable;
 
-	msize = pp->mediasize / pp->sectorsize;
-	if (msize > 0xffffffffu)
-		msize = 0xffffffffu;
+	msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 	table->secpercyl = basetable->gpt_sectors * basetable->gpt_heads;
 	pcyls = msize / table->secpercyl;
 	acyls = 2;
@@ -389,8 +387,7 @@ g_part_vtoc8_read(struct g_part_table *b
 	bcopy(buf, &table->vtoc, sizeof(table->vtoc));
 	g_free(buf);
 
-	msize = pp->mediasize / pp->sectorsize;
-
+	msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX);
 	sectors = be16dec(&table->vtoc.nsecs);
 	if (sectors < 1)
 		goto invalid_label;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105151640.p4FGegjq044916>