Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Aug 2019 22:31:05 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r508691 - in branches/2019Q3/games: openbor openbor/files openbor3482 openbor3482/files openbor3711 openbor3979 openbor3979/files openbor4432 openbor4432/files
Message-ID:  <201908112231.x7BMV5Is028308@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Sun Aug 11 22:31:04 2019
New Revision: 508691
URL: https://svnweb.freebsd.org/changeset/ports/508691

Log:
  MFH: r508689
  
  games/openbor: fix free memory stats
  
  source/ramlib/ram.c:137:18: runtime error: unsigned integer overflow: 9420649 * 4096 cannot be represented in type 'unsigned int'
  
  Reported by:	-fsanitize=integer
  Approved by:	ports-secteam blanket

Modified:
  branches/2019Q3/games/openbor/Makefile
  branches/2019Q3/games/openbor/files/patch-source_ramlib_ram.c
  branches/2019Q3/games/openbor3482/Makefile
  branches/2019Q3/games/openbor3482/files/patch-source_ramlib_ram.c
  branches/2019Q3/games/openbor3711/Makefile
  branches/2019Q3/games/openbor3979/Makefile
  branches/2019Q3/games/openbor3979/files/patch-source_ramlib_ram.c
  branches/2019Q3/games/openbor4432/Makefile
  branches/2019Q3/games/openbor4432/files/patch-source_ramlib_ram.c
Directory Properties:
  branches/2019Q3/   (props changed)

Modified: branches/2019Q3/games/openbor/Makefile
==============================================================================
--- branches/2019Q3/games/openbor/Makefile	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor/Makefile	Sun Aug 11 22:31:04 2019	(r508691)
@@ -4,7 +4,7 @@ PORTNAME=	openbor
 # Hint: svn revision is git rev-list --count ${GH_TAGNAME}
 PORTVERSION?=	7066
 .ifndef PKGNAMESUFFIX
-PORTREVISION=	0
+PORTREVISION=	1
 .endif
 CATEGORIES=	games
 

Modified: branches/2019Q3/games/openbor/files/patch-source_ramlib_ram.c
==============================================================================
--- branches/2019Q3/games/openbor/files/patch-source_ramlib_ram.c	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor/files/patch-source_ramlib_ram.c	Sun Aug 11 22:31:04 2019	(r508691)
@@ -59,8 +59,8 @@ Implement Linux-like memory stats for BSDs
 +    {
 +        return 0;
 +    }
-+    return (u64)((vms.v_free_count + vms.v_inactive_count
-+                  + vms.v_cache_count) * getpagesize()) / byte_size;
++    return (u64)(vms.v_free_count + vms.v_inactive_count
++		 + vms.v_cache_count) * getpagesize() / byte_size;
 +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 +    u_int v_free_count = 0, v_inactive_count = 0, v_cache_count = 0;
 +    size_t sz = sizeof(u_int);
@@ -70,8 +70,8 @@ Implement Linux-like memory stats for BSDs
 +                 &v_inactive_count, &sz, NULL, 0);
 +    sysctlbyname("vm.stats.vm.v_cache_count",
 +                 &v_cache_count, &sz, NULL, 0);
-+    return (u64)((v_free_count + v_inactive_count + v_cache_count)
-+                 * getpagesize()) / byte_size;
++    return (u64)(v_free_count + v_inactive_count
++		 + v_cache_count) * getpagesize() / byte_size;
 +#elif defined(__NetBSD__) || defined(__OpenBSD__)
 +# if defined(__NetBSD__)
 +#undef VM_UVMEXP
@@ -92,8 +92,8 @@ Implement Linux-like memory stats for BSDs
 +    {
 +        return 0;
 +    }
-+    return (u64)((uvmexp.free + uvmexp.inactive + uvmexp.filepages
-+                  + uvmexp.execpages) * uvmexp.pagesize) / byte_size;
++    return (u64)(uvmexp.free + uvmexp.inactive + uvmexp.filepages
++		 + uvmexp.execpages) * uvmexp.pagesize / byte_size;
  #elif LINUX
      struct sysinfo info;
      sysinfo(&info);

Modified: branches/2019Q3/games/openbor3482/Makefile
==============================================================================
--- branches/2019Q3/games/openbor3482/Makefile	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor3482/Makefile	Sun Aug 11 22:31:04 2019	(r508691)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTVERSION=	3482
-PORTREVISION=	1
+PORTREVISION=	2
 PKGNAMESUFFIX=	${PORTVERSION}
 
 MASTERDIR=	${.CURDIR}/../openbor

Modified: branches/2019Q3/games/openbor3482/files/patch-source_ramlib_ram.c
==============================================================================
--- branches/2019Q3/games/openbor3482/files/patch-source_ramlib_ram.c	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor3482/files/patch-source_ramlib_ram.c	Sun Aug 11 22:31:04 2019	(r508691)
@@ -82,8 +82,8 @@ Implement Linux-like memory stats for BSDs
 +	{
 +		return 0;
 +	}
-+	return (u64)((vms.v_free_count + vms.v_inactive_count
-+				  + vms.v_cache_count) * getpagesize()) / byte_size;
++	return (u64)(vms.v_free_count + vms.v_inactive_count
++		+ vms.v_cache_count) * getpagesize() / byte_size;
 +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 +	u_int v_free_count = 0, v_inactive_count = 0, v_cache_count = 0;
 +	size_t sz = sizeof(u_int);
@@ -93,8 +93,8 @@ Implement Linux-like memory stats for BSDs
 +				 &v_inactive_count, &sz, NULL, 0);
 +	sysctlbyname("vm.stats.vm.v_cache_count",
 +				 &v_cache_count, &sz, NULL, 0);
-+	return (u64)((v_free_count + v_inactive_count + v_cache_count)
-+				 * getpagesize()) / byte_size;
++	return (u64)(v_free_count + v_inactive_count
++		+ v_cache_count) * getpagesize() / byte_size;
 +#elif defined(__NetBSD__) || defined(__OpenBSD__)
 +# if defined(__NetBSD__)
 +#undef VM_UVMEXP
@@ -115,8 +115,8 @@ Implement Linux-like memory stats for BSDs
 +	{
 +		return 0;
 +	}
-+	return (u64)((uvmexp.free + uvmexp.inactive + uvmexp.filepages
-+				  + uvmexp.execpages) * uvmexp.pagesize) / byte_size;
++	return (u64)(uvmexp.free + uvmexp.inactive + uvmexp.filepages
++		+ uvmexp.execpages) * uvmexp.pagesize / byte_size;
  #elif LINUX
  	struct sysinfo info;
  	sysinfo(&info);

Modified: branches/2019Q3/games/openbor3711/Makefile
==============================================================================
--- branches/2019Q3/games/openbor3711/Makefile	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor3711/Makefile	Sun Aug 11 22:31:04 2019	(r508691)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTVERSION=	3711
-PORTREVISION=	1
+PORTREVISION=	2
 PKGNAMESUFFIX=	${PORTVERSION}
 
 MASTERDIR=	${.CURDIR}/../openbor

Modified: branches/2019Q3/games/openbor3979/Makefile
==============================================================================
--- branches/2019Q3/games/openbor3979/Makefile	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor3979/Makefile	Sun Aug 11 22:31:04 2019	(r508691)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTVERSION=	3979
-PORTREVISION=	1
+PORTREVISION=	2
 PKGNAMESUFFIX=	${PORTVERSION}
 
 MASTERDIR=	${.CURDIR}/../openbor

Modified: branches/2019Q3/games/openbor3979/files/patch-source_ramlib_ram.c
==============================================================================
--- branches/2019Q3/games/openbor3979/files/patch-source_ramlib_ram.c	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor3979/files/patch-source_ramlib_ram.c	Sun Aug 11 22:31:04 2019	(r508691)
@@ -82,8 +82,8 @@ Implement Linux-like memory stats for BSDs
 +    {
 +        return 0;
 +    }
-+    return (u64)((vms.v_free_count + vms.v_inactive_count
-+                  + vms.v_cache_count) * getpagesize()) / byte_size;
++    return (u64)(vms.v_free_count + vms.v_inactive_count
++		 + vms.v_cache_count) * getpagesize() / byte_size;
 +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 +    u_int v_free_count = 0, v_inactive_count = 0, v_cache_count = 0;
 +    size_t sz = sizeof(u_int);
@@ -93,8 +93,8 @@ Implement Linux-like memory stats for BSDs
 +                 &v_inactive_count, &sz, NULL, 0);
 +    sysctlbyname("vm.stats.vm.v_cache_count",
 +                 &v_cache_count, &sz, NULL, 0);
-+    return (u64)((v_free_count + v_inactive_count + v_cache_count)
-+                 * getpagesize()) / byte_size;
++    return (u64)(v_free_count + v_inactive_count
++		 + v_cache_count) * getpagesize() / byte_size;
 +#elif defined(__NetBSD__) || defined(__OpenBSD__)
 +# if defined(__NetBSD__)
 +#undef VM_UVMEXP
@@ -115,8 +115,8 @@ Implement Linux-like memory stats for BSDs
 +    {
 +        return 0;
 +    }
-+    return (u64)((uvmexp.free + uvmexp.inactive + uvmexp.filepages
-+                  + uvmexp.execpages) * uvmexp.pagesize) / byte_size;
++    return (u64)(uvmexp.free + uvmexp.inactive + uvmexp.filepages
++		 + uvmexp.execpages) * uvmexp.pagesize / byte_size;
  #elif LINUX
      struct sysinfo info;
      sysinfo(&info);

Modified: branches/2019Q3/games/openbor4432/Makefile
==============================================================================
--- branches/2019Q3/games/openbor4432/Makefile	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor4432/Makefile	Sun Aug 11 22:31:04 2019	(r508691)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTVERSION=	4432
-PORTREVISION=	2
+PORTREVISION=	3
 PKGNAMESUFFIX=	${PORTVERSION}
 
 MASTERDIR=	${.CURDIR}/../openbor

Modified: branches/2019Q3/games/openbor4432/files/patch-source_ramlib_ram.c
==============================================================================
--- branches/2019Q3/games/openbor4432/files/patch-source_ramlib_ram.c	Sun Aug 11 22:25:00 2019	(r508690)
+++ branches/2019Q3/games/openbor4432/files/patch-source_ramlib_ram.c	Sun Aug 11 22:31:04 2019	(r508691)
@@ -59,8 +59,8 @@ Implement Linux-like memory stats for BSDs
 +    {
 +        return 0;
 +    }
-+    return (u64)((vms.v_free_count + vms.v_inactive_count
-+                  + vms.v_cache_count) * getpagesize()) / byte_size;
++    return (u64)(vms.v_free_count + vms.v_inactive_count
++		 + vms.v_cache_count) * getpagesize() / byte_size;
 +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 +    u_int v_free_count = 0, v_inactive_count = 0, v_cache_count = 0;
 +    size_t sz = sizeof(u_int);
@@ -70,8 +70,8 @@ Implement Linux-like memory stats for BSDs
 +                 &v_inactive_count, &sz, NULL, 0);
 +    sysctlbyname("vm.stats.vm.v_cache_count",
 +                 &v_cache_count, &sz, NULL, 0);
-+    return (u64)((v_free_count + v_inactive_count + v_cache_count)
-+                 * getpagesize()) / byte_size;
++    return (u64)(v_free_count + v_inactive_count
++		 + v_cache_count) * getpagesize() / byte_size;
 +#elif defined(__NetBSD__) || defined(__OpenBSD__)
 +# if defined(__NetBSD__)
 +#undef VM_UVMEXP
@@ -92,8 +92,8 @@ Implement Linux-like memory stats for BSDs
 +    {
 +        return 0;
 +    }
-+    return (u64)((uvmexp.free + uvmexp.inactive + uvmexp.filepages
-+                  + uvmexp.execpages) * uvmexp.pagesize) / byte_size;
++    return (u64)(uvmexp.free + uvmexp.inactive + uvmexp.filepages
++		 + uvmexp.execpages) * uvmexp.pagesize / byte_size;
  #elif LINUX
      struct sysinfo info;
      sysinfo(&info);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908112231.x7BMV5Is028308>