Module Name:    src
Committed By:   mrg
Date:           Thu Oct 14 00:47:17 UTC 2010

Modified Files:
        src/sys/kern: subr_disk.c

Log Message:
add some (uint64_t) casts so avoid 32 bit overflows.  this fixes my
3TB disk with 4KB sectors and disklabel (which looks like it would
work upto 16TB.)

idea from mlel...@.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/kern/subr_disk.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/kern/subr_disk.c
diff -u src/sys/kern/subr_disk.c:1.99 src/sys/kern/subr_disk.c:1.100
--- src/sys/kern/subr_disk.c:1.99	Sat Nov 28 22:38:07 2009
+++ src/sys/kern/subr_disk.c	Thu Oct 14 00:47:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_disk.c,v 1.99 2009/11/28 22:38:07 dsl Exp $	*/
+/*	$NetBSD: subr_disk.c,v 1.100 2010/10/14 00:47:16 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.99 2009/11/28 22:38:07 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.100 2010/10/14 00:47:16 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -363,8 +363,8 @@
 		return -1;
 	}
 
-	p_size = p->p_size << dk->dk_blkshift;
-	p_offset = p->p_offset << dk->dk_blkshift;
+	p_size = (uint64_t)p->p_size << dk->dk_blkshift;
+	p_offset = (uint64_t)p->p_offset << dk->dk_blkshift;
 #if RAW_PART == 3
 	labelsector = lp->d_partitions[2].p_offset;
 #else

Reply via email to