clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
This commit is contained in:
parent
bc6310c5db
commit
53385cb9cd
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ccd.c,v 1.152 2014/08/16 19:27:27 sborrill Exp $ */
|
||||
/* $NetBSD: ccd.c,v 1.153 2014/10/11 12:01:27 mlelstv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -88,7 +88,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.152 2014/08/16 19:27:27 sborrill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.153 2014/10/11 12:01:27 mlelstv Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -1479,7 +1479,10 @@ ccdgetdefaultlabel(struct ccd_softc *cs, struct disklabel *lp)
|
|||
|
||||
memset(lp, 0, sizeof(*lp));
|
||||
|
||||
lp->d_secperunit = cs->sc_size;
|
||||
if (cs->sc_size > UINT32_MAX)
|
||||
lp->d_secperunit = UINT32_MAX;
|
||||
else
|
||||
lp->d_secperunit = cs->sc_size;
|
||||
lp->d_secsize = ccg->ccg_secsize;
|
||||
lp->d_nsectors = ccg->ccg_nsectors;
|
||||
lp->d_ntracks = ccg->ccg_ntracks;
|
||||
|
@ -1494,7 +1497,7 @@ ccdgetdefaultlabel(struct ccd_softc *cs, struct disklabel *lp)
|
|||
lp->d_flags = 0;
|
||||
|
||||
lp->d_partitions[RAW_PART].p_offset = 0;
|
||||
lp->d_partitions[RAW_PART].p_size = cs->sc_size;
|
||||
lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
|
||||
lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dksubr.c,v 1.51 2014/06/14 07:39:00 hannken Exp $ */
|
||||
/* $NetBSD: dksubr.c,v 1.52 2014/10/11 12:01:27 mlelstv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.51 2014/06/14 07:39:00 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.52 2014/10/11 12:01:27 mlelstv Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -530,7 +530,10 @@ dk_getdefaultlabel(struct dk_intf *di, struct dk_softc *dksc,
|
|||
|
||||
memset(lp, 0, sizeof(*lp));
|
||||
|
||||
lp->d_secperunit = dg->dg_secperunit;
|
||||
if (dg->dg_secperunit > UINT32_MAX)
|
||||
lp->d_secperunit = UINT32_MAX;
|
||||
else
|
||||
lp->d_secperunit = dg->dg_secperunit;
|
||||
lp->d_secsize = dg->dg_secsize;
|
||||
lp->d_nsectors = dg->dg_nsectors;
|
||||
lp->d_ntracks = dg->dg_ntracks;
|
||||
|
@ -545,7 +548,7 @@ dk_getdefaultlabel(struct dk_intf *di, struct dk_softc *dksc,
|
|||
lp->d_flags = 0;
|
||||
|
||||
lp->d_partitions[RAW_PART].p_offset = 0;
|
||||
lp->d_partitions[RAW_PART].p_size = dg->dg_secperunit;
|
||||
lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
|
||||
lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
|
||||
|
|
12
sys/dev/ld.c
12
sys/dev/ld.c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ld.c,v 1.76 2014/09/05 05:27:23 matt Exp $ */
|
||||
/* $NetBSD: ld.c,v 1.77 2014/10/11 12:01:27 mlelstv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.76 2014/09/05 05:27:23 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.77 2014/10/11 12:01:27 mlelstv Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -814,14 +814,16 @@ ldgetdefaultlabel(struct ld_softc *sc, struct disklabel *lp)
|
|||
lp->d_type = DTYPE_LD;
|
||||
strlcpy(lp->d_typename, "unknown", sizeof(lp->d_typename));
|
||||
strlcpy(lp->d_packname, "fictitious", sizeof(lp->d_packname));
|
||||
lp->d_secperunit = sc->sc_secperunit;
|
||||
if (sc->sc_secperunit > UINT32_MAX)
|
||||
lp->d_secperunit = UINT32_MAX;
|
||||
else
|
||||
lp->d_secperunit = sc->sc_secperunit;
|
||||
lp->d_rpm = 7200;
|
||||
lp->d_interleave = 1;
|
||||
lp->d_flags = 0;
|
||||
|
||||
lp->d_partitions[RAW_PART].p_offset = 0;
|
||||
lp->d_partitions[RAW_PART].p_size =
|
||||
lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
|
||||
lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
|
||||
lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_netbsdkintf.c,v 1.312 2014/07/25 08:10:38 dholland Exp $ */
|
||||
/* $NetBSD: rf_netbsdkintf.c,v 1.313 2014/10/11 12:01:27 mlelstv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
|
||||
|
@ -101,7 +101,7 @@
|
|||
***********************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.312 2014/07/25 08:10:38 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.313 2014/10/11 12:01:27 mlelstv Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -2365,7 +2365,10 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr, struct raid_softc *rs,
|
|||
memset(lp, 0, sizeof(*lp));
|
||||
|
||||
/* fabricate a label... */
|
||||
lp->d_secperunit = raidPtr->totalSectors;
|
||||
if (raidPtr->totalSectors > UINT32_MAX)
|
||||
lp->d_secperunit = UINT32_MAX;
|
||||
else
|
||||
lp->d_secperunit = raidPtr->totalSectors;
|
||||
lp->d_secsize = raidPtr->bytesPerSector;
|
||||
lp->d_nsectors = raidPtr->Layout.dataSectorsPerStripe;
|
||||
lp->d_ntracks = 4 * raidPtr->numCol;
|
||||
|
@ -2381,7 +2384,7 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr, struct raid_softc *rs,
|
|||
lp->d_flags = 0;
|
||||
|
||||
lp->d_partitions[RAW_PART].p_offset = 0;
|
||||
lp->d_partitions[RAW_PART].p_size = raidPtr->totalSectors;
|
||||
lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
|
||||
lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vnd.c,v 1.232 2014/07/25 08:10:35 dholland Exp $ */
|
||||
/* $NetBSD: vnd.c,v 1.233 2014/10/11 12:01:27 mlelstv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -91,7 +91,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.232 2014/07/25 08:10:35 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.233 2014/10/11 12:01:27 mlelstv Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_vnd.h"
|
||||
|
@ -1789,7 +1789,10 @@ vndgetdefaultlabel(struct vnd_softc *sc, struct disklabel *lp)
|
|||
|
||||
memset(lp, 0, sizeof(*lp));
|
||||
|
||||
lp->d_secperunit = sc->sc_size / (vng->vng_secsize / DEV_BSIZE);
|
||||
if (sc->sc_size > UINT32_MAX)
|
||||
lp->d_secperunit = UINT32_MAX;
|
||||
else
|
||||
lp->d_secperunit = sc->sc_size;
|
||||
lp->d_secsize = vng->vng_secsize;
|
||||
lp->d_nsectors = vng->vng_nsectors;
|
||||
lp->d_ntracks = vng->vng_ntracks;
|
||||
|
|
Loading…
Reference in New Issue