Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev clamp total number of sectors to UINT32_MAX instead ...
details: https://anonhg.NetBSD.org/src/rev/1cc61387342b
branches: trunk
changeset: 332899:1cc61387342b
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sat Oct 11 12:01:27 2014 +0000
description:
clamp total number of sectors to UINT32_MAX instead of providing the
lower 32bit of the 64bit number.
diffstat:
sys/dev/ccd.c | 11 +++++++----
sys/dev/dksubr.c | 11 +++++++----
sys/dev/ld.c | 12 +++++++-----
sys/dev/raidframe/rf_netbsdkintf.c | 11 +++++++----
sys/dev/vnd.c | 9 ++++++---
5 files changed, 34 insertions(+), 20 deletions(-)
diffs (185 lines):
diff -r 185bf328b421 -r 1cc61387342b sys/dev/ccd.c
--- a/sys/dev/ccd.c Sat Oct 11 11:55:07 2014 +0000
+++ b/sys/dev/ccd.c Sat Oct 11 12:01:27 2014 +0000
@@ -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 @@
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 @@
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;
diff -r 185bf328b421 -r 1cc61387342b sys/dev/dksubr.c
--- a/sys/dev/dksubr.c Sat Oct 11 11:55:07 2014 +0000
+++ b/sys/dev/dksubr.c Sat Oct 11 12:01:27 2014 +0000
@@ -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 @@
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 @@
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;
diff -r 185bf328b421 -r 1cc61387342b sys/dev/ld.c
--- a/sys/dev/ld.c Sat Oct 11 11:55:07 2014 +0000
+++ b/sys/dev/ld.c Sat Oct 11 12:01:27 2014 +0000
@@ -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 @@
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;
diff -r 185bf328b421 -r 1cc61387342b sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c Sat Oct 11 11:55:07 2014 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c Sat Oct 11 12:01:27 2014 +0000
@@ -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 @@
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 @@
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;
diff -r 185bf328b421 -r 1cc61387342b sys/dev/vnd.c
--- a/sys/dev/vnd.c Sat Oct 11 11:55:07 2014 +0000
+++ b/sys/dev/vnd.c Sat Oct 11 12:01:27 2014 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index