Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sysinst Divide GIG by 512 (DEV_BLKSIZE) so we don't...



details:   https://anonhg.NetBSD.org/src/rev/124d63e2ace1
branches:  trunk
changeset: 446217:124d63e2ace1
user:      kre <kre%NetBSD.org@localhost>
date:      Wed Nov 28 00:44:08 2018 +0000

description:
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.

diffstat:

 usr.sbin/sysinst/label.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 9ff92de9140a -r 124d63e2ace1 usr.sbin/sysinst/label.c
--- a/usr.sbin/sysinst/label.c  Tue Nov 27 21:03:50 2018 +0000
+++ b/usr.sbin/sysinst/label.c  Wed Nov 28 00:44:08 2018 +0000
@@ -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 @@
                        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;



Home | Main Index | Thread Index | Old Index