Module Name:    src
Committed By:   mlelstv
Date:           Sat Nov 28 14:37:50 UTC 2015

Modified Files:
        src/sys/dev: dksubr.c

Log Message:
bounds check requires consistent units, i.e. DEV_BSIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/dksubr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.81 src/sys/dev/dksubr.c:1.82
--- src/sys/dev/dksubr.c:1.81	Fri Oct 23 01:34:22 2015
+++ src/sys/dev/dksubr.c	Sat Nov 28 14:37:49 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.81 2015/10/23 01:34:22 christos Exp $ */
+/* $NetBSD: dksubr.c,v 1.82 2015/11/28 14:37:49 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.81 2015/10/23 01:34:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.82 2015/11/28 14:37:49 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -246,7 +246,8 @@ dk_translate(struct dk_softc *dksc, stru
 
 	wlabel = dksc->sc_flags & (DKF_WLABEL|DKF_LABELLING);
 	if (part == RAW_PART) {
-		if (bounds_check_with_mediasize(bp, DEV_BSIZE, numsecs) <= 0)
+		uint64_t numblocks = btodb(numsecs * secsize);
+		if (bounds_check_with_mediasize(bp, DEV_BSIZE, numblocks) <= 0)
 			goto done;
 	} else {
 		if (bounds_check_with_label(&dksc->sc_dkdev, bp, wlabel) <= 0)

Reply via email to