Module Name:    src
Committed By:   kre
Date:           Wed Nov 28 00:44:08 UTC 2018

Modified Files:
        src/usr.sbin/sysinst: label.c

Log Message:
Divide GIG by 512 (DEV_BLKSIZE) so we don't overflow 32 bit u_long
when multiplying by 128 (in 32 bits, 128 * GIG == 0)

Should fix i386 build )and other 32 bit ports).

An alternative would be to use ULL rather than UL for the numbers,
but that would mean needlessly doing 64 bit arith for data that is
resticted to 32 bit results anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/label.c

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

Modified files:

Index: src/usr.sbin/sysinst/label.c
diff -u src/usr.sbin/sysinst/label.c:1.5 src/usr.sbin/sysinst/label.c:1.6
--- src/usr.sbin/sysinst/label.c:1.5	Tue Nov 27 17:13:41 2018
+++ src/usr.sbin/sysinst/label.c	Wed Nov 28 00:44:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: label.c,v 1.5 2018/11/27 17:13:41 martin Exp $	*/
+/*	$NetBSD: label.c,v 1.6 2018/11/28 00:44:08 kre Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: label.c,v 1.5 2018/11/27 17:13:41 martin Exp $");
+__RCSID("$NetBSD: label.c,v 1.6 2018/11/28 00:44:08 kre Exp $");
 #endif
 
 #include <sys/types.h>
@@ -237,7 +237,7 @@ set_ptype(partinfo *p, int fstype, int f
 			p->pi_fsize = 512;
 		else if (p->pi_size < (1000 * MEG / 512))
 			p->pi_fsize = 1024;
-		else if (p->pi_size < (128 * GIG / 512))
+		else if (p->pi_size < (128 * (GIG / 512)))
 			p->pi_fsize = 2048;
 		else
 			p->pi_fsize = 4096;

Reply via email to